Re: interpolate a point from an array

From: Fred Clare <fred_at_nyahnyahspammersnyahnyah>
Date: Fri, 17 Aug 2007 17:40:46 -0600

On Aug 17, 2007, at 1:00 PM, Ertl, John C CIV 63134 wrote:

> All,
> I am trying to pull a single interpolated value from a grid (it can
> be 1D or 2D). I am trying to find the fastest (computation) way
> but I have not gotten any way in PyNGL to work .
> I am going to be using equally spaced weather grids. I am likely
> going to be needing data from many different parameters for the
> same interpolated point so speed is something I need to keep in mind.
> I have tired: natgrid and linint2_points neither of these worked.
> What would be the best option.
> latI = [0,1,2,3,4]
> lonI = [0,1,2,3,4]
> Lat = [2.5]
> Lon = [2]
> grid = Numeric.array(range(25))
> value = PyNGL.natgrid(latI,lonI,grid,Lat,Lon)
> print "the Value is ", value
> # linint2_points
> #make a 5x5 array
> grid = Numeric.reshape(Numeric.array(range(25)), (5,-1))
> value = PyNGL.linint2_points(latI,lonI,grid,False,Lat,Lon,0)
> print "the Value is ", value
> Thanks for the ideas.

Hi John,

Your example for natgrid is not implemented correctly. The
first three arguments should be 1D arrays of the same size
specifying (lat,lon,value) triples. I have attached a file
that does what I think you were wanting to do with your
example. Unfortunately natgrid can be very slow when
interpolating at a single point. In fact natgrid can be
slow in almost all cases.

With regard to linint2_points, it is an NCL function but as far
as I know was never implemented in PyNGL. Did you actually
ever get anything but a missing warning from trying it?

If natgrid turns out not to work for you, let me know and
I will think about implementing another function for you.

Fred Clare

> John Ertl
> _______________________________________________
> pyngl-talk mailing list

pyngl-talk mailing list

Received on Fri Aug 17 2007 - 17:40:46 MDT

This archive was generated by hypermail 2.2.0 : Thu Aug 23 2007 - 10:48:58 MDT