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

Home » Public Forums » archive » Re: Another triangulate/griddata question
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: Another triangulate/griddata question [message #75375 is a reply to message #75370] Wed, 02 March 2011 16:55 Go to previous message
ben.bighair is currently offline  ben.bighair
Messages: 221
Registered: April 2007
Senior Member
On 3/2/11 2:56 PM, Barry Lesht wrote:
> I have a problem that I thought would be easy to solve using griddata
> as David Fanning did in his tip (http://www.idlcoyote.com/code_tips/
> usegriddata.html). As input I have some 2D data arrays (can be either
> 512x512 or 1024x1024) with a longitude and latitude value associated
> with each element. I want to output data arrays that represent sub-
> regions of the input arrays in a particular map projection. Being sub-
> regions, the output arrays are smaller than the input arrays. I know
> the dimensions of the output arrays (xSize,ySize) as well as their
> geographic limits (limits) and geographic position
> (xStartDeg,yStartDeg) of the lower left corner.
>
> Following David's example, I do the following:
>
> mapStruct = MAP_PROJ_INIT('CYLINDRICAL', LIMIT=limit)
> xy = MAP_PROJ_FORWARD(lons, lats, MAP_STRUCTURE=mapStruct)
> x = REFORM(xy[0,*], xIn, yIn) ; xIn, yIn
> based on input array size
> y = REFORM(xy[1,*], xIn, yIn)
> ;
> ; Get the x, y coordinates of the ouput array southwest corner
> ;
> llxy = MAP_PROJ_FORWARD(xStartDeg, yStartDeg, MAP_STRUCTURE=mapStruct)
> xStart=llxy[0]
> yStart=llxy[1]
> ;
> TRIANGULATE, x, y, triangles, TOLERANCE=1.0
> griddedData = GRIDDATA(x,y,wtmp,/NEAREST_NEIGHBOR,
> TRIANGLES=triangles, DIMENSION=[xSize,ySize], MISSING=nan,
> START=[xStart,yStart])
>
> This fails with the error: % GRIDDATA: Value of Triangle index is out
> of allowed range.
>
> I'm not sure why this is happening. Could it be because some of the
> triangles that are defined in the triangulate step are completely
> outside the domain of the defined subregion? If so, is there a way
> around this? Thanks.

Hi,

As a starting point it is always good to run your points through
GRID_INPUT before sending them along to GRIDDATA. There isn't anyway to
be sure that this solves things but it is a simple thing to try.

Cheers,
Ben
[Message index]
 
Read Message
Read Message
Read Message
Previous Topic: Re: v8 plot challenge
Next Topic: Re: HASH question

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

Current Time: Wed Oct 08 19:22:22 PDT 2025

Total time taken to generate the page: 0.00435 seconds