|
From: <js...@us...> - 2010-02-25 15:53:38
|
Revision: 8154
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=8154&view=rev
Author: jswhit
Date: 2010-02-25 15:53:30 +0000 (Thu, 25 Feb 2010)
Log Message:
-----------
added order=3 option to interp
Modified Paths:
--------------
trunk/toolkits/basemap/Changelog
trunk/toolkits/basemap/lib/mpl_toolkits/basemap/__init__.py
Modified: trunk/toolkits/basemap/Changelog
===================================================================
--- trunk/toolkits/basemap/Changelog 2010-02-24 20:48:26 UTC (rev 8153)
+++ trunk/toolkits/basemap/Changelog 2010-02-25 15:53:30 UTC (rev 8154)
@@ -1,4 +1,6 @@
version 0.99.5 (not yet released)
+ * added option for cubic spline interpolation in interp function
+ (order=3) using scipy.ndimage.
* added "near-sided perspective" projection for a satellite
view at an arbitrary altitude.
* patch from Stephane Raynaud to pass format string to
Modified: trunk/toolkits/basemap/lib/mpl_toolkits/basemap/__init__.py
===================================================================
--- trunk/toolkits/basemap/lib/mpl_toolkits/basemap/__init__.py 2010-02-24 20:48:26 UTC (rev 8153)
+++ trunk/toolkits/basemap/lib/mpl_toolkits/basemap/__init__.py 2010-02-25 15:53:30 UTC (rev 8154)
@@ -3639,7 +3639,7 @@
y, 2nd dimension x.
xin, yin rank-1 arrays containing x and y of
datain grid in increasing order.
- xout, yout arrays containing x and y of desired output grid.
+ xout, yout rank-2 arrays containing x and y of desired output grid.
============== ====================================================
.. tabularcolumns:: |l|L|
@@ -3660,7 +3660,8 @@
points outside the range of xin and yin will be
set to that number. Default False.
order 0 for nearest-neighbor interpolation, 1 for
- bilinear interpolation (default 1).
+ bilinear interpolation, 3 for cublic spline
+ (default 1). order=3 requires scipy.ndimage.
============== ====================================================
.. note::
@@ -3746,8 +3747,15 @@
xcoordsi = np.around(xcoords).astype(np.int32)
ycoordsi = np.around(ycoords).astype(np.int32)
dataout = datain[ycoordsi,xcoordsi]
+ elif order == 3:
+ try:
+ from scipy.ndimage import map_coordinates
+ except ImportError:
+ raise ValueError('scipy.ndimage must be installed if order=3')
+ coords = [ycoords,xcoords]
+ map_coordinates(datain,coords,order=3,mode='constant')
else:
- raise ValueError,'order keyword must be 0 or 1'
+ raise ValueError,'order keyword must be 0, 1 or 3'
if masked and isinstance(masked,bool):
dataout = ma.masked_array(dataout)
newmask = ma.mask_or(ma.getmask(dataout), xymask)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|