comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: matching 2 grids
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: matching 2 grids [message #47853 is a reply to message #47850] Wed, 08 March 2006 16:17 Go to previous messageGo to previous message
Mark Hadfield is currently offline  Mark Hadfield
Messages: 783
Registered: May 1995
Senior Member
Jenny wrote:
> Hi all,
>
> I have 2 sets of lat/lon pairs in different grids - grid1 and grid2,
> both in irregular shape and I've filled some zero numbers to make them
> regular. grid2 is a subset of grid1. I want to find the coordinates of
> x1,y1 in grid1 (lat1/lon1) which are closest to each of the nonzero
> lat2/lon2 paris in grid2.
>
> I made a programm with several loops, it is kind of did what I want,
> but it is very slow and the boundary is not tidy. my grid1 is 600*600,
> and I have 10 grid2 to process.
>
> Is there an IDL function that I could use in this case?

The key to solving a problems like this is to make use of any geometric
structure in the grid (and here I mean the grid you're trying to locate
yourself in, ie. grid1). How irregular is grid1? I presume it's not
rectangular (ie. lon varies in one direction, lat in the other). Is it
curvilinear? Ie, does it look like a rectangular grid that has been
rotated and deformed? Or are the grid1 points just scattered with no
particular relation to each other?

For a rectangular grid, you would have a pair of 1-D location problems
of the sort that were discussed yesterday in this group under the title
"Interpolating a regular grid".

For a curvilinear grid you have a 2-D location problem. As my message
yesterday said, the Motley library has 1-D and 2-D location functions.

For a scattered set of points, I don't know. I suspect you could
approach it by first constructing a Delaunay triangulation for grid1
(see function TRIANGULATE) and then performing a nearest-neighbour
interpolation with GRIDDATA. Give each grid1 point a unique data value,
then the interpolated value on the grid2 points is the value associated
with the nearest grid1 point--something like that.


--
Mark Hadfield "Kei puwaha te tai nei, Hoea tahi tatou"
m.hadfield@niwa.co.nz
National Institute for Water and Atmospheric Research (NIWA)
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: read files with time column
Next Topic: Problems with Restore

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Sun Oct 12 11:55:37 PDT 2025

Total time taken to generate the page: 0.88016 seconds