MGH_LOCATE2 Name
MGH_LOCATE2 Purpose
This function calculates positions in the "index space" of a 2D
curvilinear grid. Calling Sequence
Result = MGH_LOCATE2(xin, yin)
Positional Parameters
xin, yin (input, 2-D numeric arrays)
X & Y positions of the vertices of the curvilinear input grid.
Keyword Parameters
To define the output locations, this function accepts the
following keywords and passes them to GRIDDATA: DELTA, DIMENSION,
GRID, START, XOUT, YOUT.
Return Value
The function returns a floating array representing the output
locations as fractional indices on the grid represented by the XIN
& YIN arrays. The result is dimensioned [2,m] or [2,m,n] where [m]
or [m,n] are the dimensions of the output locations.
Procedure
Construct variables representing position in i direction and
position in j direction and interpolate with GRIDDATA function
PERFORMANCE
I have tested this function using a [439,439] moderately curved
input grid (NZ region SST--see MGH_EXAMPLE_LOCATE2). For large
output grids (20000 vertices or more) time taken increases linearly
@ 16,000 per second on a Pentium 4 2.67 GHz. For smaller output grids
time is sub-linear.
See also MGH_LOCATE2A which has essentially the same functionality
but is faster on small output grids.
###########################################################################
This software is provided subject to the following conditions:
1. NIWA makes no representations or warranties regarding the
accuracy of the software, the use to which the software may
be put or the results to be obtained from the use of the
software. Accordingly NIWA accepts no liability for any loss
or damage (whether direct of indirect) incurred by any person
through the use of or reliance on the software.
2. NIWA is to be acknowledged as the original author of the
software where the software is used or presented in any form.
###########################################################################
Modification History
Mark Hadfield, 2002-07:
Written.