Re: How to interpolate missing values of a 2d (lat/lon) variable?

From: Dennis Shea <shea_at_nyahnyahspammersnyahnyah>
Date: Wed May 19 2010 - 15:56:16 MDT

You could really help by including output
from printVarSummary(...). Guessing is hard.

Is this a grid described by 2d arrays of coordinates
or is it (say) satellite swath data ?

Sometimes you have to look at the distribution of the data
to decide what the appropriate function. NCL does have a lot of
function for 'doing things'. However, sometimes it is best
to just write your own function.

Even if not a grid try "poisson_grid_fill". If you have
reasonable boundary points this will likely do a good job.
If you do not have boundary points then any function is
extrapolating. Unless you have some physical relationship
to guide/focus the interpolation I'd be very suspicious
of returned results.

http://www.ncl.ucar.edu/Document/Functions/Built-in/poisson_grid_fill.shtml

Also,
http://www.ncl.ucar.edu/Document/Functions/Built-in/triple2grid2d.shtml

For the letter, you may have to use
y1d = ndtooned(lat2d)
x1d = ndtooned(lon2d)
z1d = ndtooned(z2d)

i = ind(.not.(ismissing(z1d)) .and. .not.(ismissing(x1d))))

grid = triple2grid2d(x1d(i),y1d(i),z(i), lon,lat, opt)

Good luck

On 5/19/10 2:52 PM, Erwan Monier wrote:
> Hi,
>
> I have a 2d variable (lat/lon) with some missing values. I would like
> to interpolate the missing values using nearest neighbors and possibly
> iteratively until all points are filled. I have tried using linmsg but
> since it only uses the rightmost dimension, it yields unrealistic
> results. I have tried to play with cssgrid but keep on getting error
> messages:
>
> CSGETSI - error 12, duplicate input points.
> Error number -2 returned from c_cssgridd
> fatal:cssgrid: Error number -2.
>
> I am not sure what the best way would be. Could you please give me
> some suggestions?
> Thank you in advance,
>
> Erwan
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Wed May 19 15:56:20 2010

This archive was generated by hypermail 2.1.8 : Wed May 26 2010 - 10:39:13 MDT