RE: [pyngl-talk] interpolate a point from an array

From: Ertl, John C CIV 63134 <john.ertl_at_nyahnyahspammersnyahnyah>
Date: Mon, 20 Aug 2007 08:32:10 -0700

Classification: UNCLASSIFIED
Caveat (s): FOUO
 
Fred,
 
Thanks for the help. You are right...natgrid is very slow. I am going to be using grids that are as big as 720X361. It was taking so long that I had to kill the job. What would be the fastest way to get data from the "closest" grid point?
 
Do you have any other ideas?
 
Thanks,
 
John Ertl
Meteorologist
 
FNMOC
7 Grace Hopper Ave.
Monterey, CA 93943
(831) 656-5704
john.ertl_at_navy.mil
 
Classification: UNCLASSIFIED
Caveat (s): FOUO

________________________________

From: Fred Clare [mailto:fred_at_ucar.edu]
Sent: Fri 8/17/2007 4:40 PM
To: Ertl, John C CIV 63134
Cc: pyngl-talk_at_ucar.edu
Subject: Re: interpolate a point from an array

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

_______________________________________________
pyngl-talk mailing list
pyngl-talk_at_ucar.edu
http://mailman.ucar.edu/mailman/listinfo/pyngl-talk
Received on Mon Aug 20 2007 - 09:32:10 MDT

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