[Numpy-discussion] subdivide array

Whitcomb, Mr. Tim tim.whitcomb at nrlmry.navy.mil
Tue Nov 30 11:57:07 EST 2010


> I have an array of data for a global grid at 1 degree resolution. It's
> filled with 1s and 0s, and it is just a land sea mask (not only, but
> as an example). I want to be able to regrid the data to higher or
> lower resolutions (i.e. 0.5 or 2 degrees). But if I try to use any
> standard interp functions, such as mpl_toolkits.basemap.interp it
> fails -- I assume due to the data being binary.
> 
> I guess there may be a fairly easy routine to do this?? Does someone
> have an example?
> 

When I've had to do this, I typically set Basemap's interp to do
nearest-neighbor interpolation (by setting order=0).  It defaults to
order=1, which is bilinear interpolation, which will destroy the binary
nature of your data (as you perhaps noticed).

Tim



More information about the NumPy-Discussion mailing list