[SciPy-user] Next neighbor interpolation inside regular griddedarrays

Thomas Nauss nauss@lcrs...
Tue Mar 20 03:19:01 CDT 2007


Hi Stéfan,
thank's for your response.
I have checked map_coordinates but it does not feature next neighbor 
interpolation and as I understood ndimage requires equally-spaced data. 
I think the equally-spaced data is the main problem since the raw 
satellite data doesn't have it (neither lat nor long is continuously 
increasing along cols or rows). That's why I didn't use the inverse way 
because for that I had to go through the entire array for every output 
pixel to check the closest lat/long combination. I also tried 
PyNGL.natgrid to get an equally spaced input grid but it takes much to 
long (> 1e6 pixels) .
I could of course warp the raw data to an equally-spaced 
(non-interpolated) lat/long coordination system so that you can access 
the value of a specific lat/long coordinate directly through the row/col 
number and perform an inverse projection afterwards - this should have a 
slightly better accuracy in the end.
Do you have any other idea?
Cheers
Thomas


Stefan van der Walt wrote:
> Hi Thomas
> 
> On Mon, 19 Mar 2007 11:52:51 +0100, Thomas Nauss <nauss@lcrs.de> wrote:
>> Hi everyone,
>> I have projected raw swath satellite data to map coordinates and stored
>> the data values in a 2D target array that has the geometry of the output
>> dataset already. I have initialized the target array using Numeric.zeros
>> and since not all fields of the target array had corresponding fields in
>> the input dataset, some fields of the target array have still the value 0.
>> Is there a function which performs a next neighbor interpolation for
>> each array field with a specified value?
> 
> Normally, the easiest way to work around this problem is to perform the
> process in reverse.  I.e. for every coordinate in the output frame, do the
> inverse mapping to find the coordinate in the input frame, and, using
> interpolation, calculate the value.
> 
> If you are interested, I have code available that does all sorts of warping,
> or you can take a look at scipy's ndimage.map_coordinates.
> 
> Cheers
> Stéfan
> 
> 
> _______________________________________________
> SciPy-user mailing list
> SciPy-user@scipy.org
> http://projects.scipy.org/mailman/listinfo/scipy-user



More information about the SciPy-user mailing list