Interpolation/
inrecgrid.pro
given - a list of points, (x,y) position
- the x and y limits of a rectangular grid
find in which cell is located each given point.
inrecgrid
Without loop
result = inrecgrid(x1d, y1d, left, bottom, OUTPUT2D=OUTPUT2D, CHECKOUT=CHECKOUT)
Return value
the index on the cell according to the 2d array defined by left and bottom.
Parameters
x1d
in
required
type: 1d array
the x position on the points
y1d
in
required
type: 1d array
the y position on the points
left
in
required
type: 1d monotonically increasing array
the position of the "left" border of each cell.
bottom
in
required
type: 1d monotonically increasing array
the position of the "bottom" border of each cell.
Keywords
OUTPUT2D
to get the output as a 2d array (2,n_elements(x1d)),
with res[0,*] the x index according to the 1d array defined by
left and res[1,*] the y index according to the 1d array defined by bottom.
CHECKOUT
= [rbgrid,ubgrid] specify the right and upper boundaries of
the grid and check if some points are out.
Examples
IDL> a=indgen(5)
IDL> b=indgen(7)
IDL> r=inrecgrid([0.25,3.25,2],[4.25,2.8,1.4],a,b)
IDL> print, r
20 13 7
IDL> r=inrecgrid([0.25,3.25,2],[4.25,2.8,1.4],a,a+1,b,b+1,/output2d)
IDL> print, r
0.00000 4.00000
3.00000 2.00000
2.00000 1.00000
Version history
Version
$Id: inrecgrid.pro 327 2007-12-13 16:22:35Z pinsard $
History
S. Masson (smasson@lodyc.jussieu.fr)
July 3rd, 2002
October 3rd, 2003: use value_locate
Produced by IDLdoc 2.0.