MGH_LOCATE2A Name
MGH_LOCATE2A 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
This function accepts the same keywords as GRIDDATA to define the
output grid, ie: 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
For each (x,y) pair in turn search for the location in 2D index space
where the distance function d(x,y) = (xin-x)^2 + (yin-x)^2 is
minimised.
PERFORMANCE
I have tested this function using a [439,439] moderately curved
input grid (NZ region SST--see MGH_EXAMPLE_LOCATE2). Time taken is
linear with number of output points @ 1050 per second on a Pentium
4 2.67 GHz.
See also MGH_LOCATE2 which has essentially the same functionality
but is faster on larger 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, 2000-12:
Written.