<<prev file | next file >>    view single page | view frames    summary: fields | routine    details: routine

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.

topinrecgrid no DO loop, use the wonderfull value_locate function!

result = inrecgrid(x1d, y1d, left, bottom, output2d=output2d, checkout=checkout)

Return value

the index on the cell accoring to the 2d array defined by left and bottom.

Parameters

x1d        in required

a 1d array, the x position on the points

y1d        in required

a 1d, monotonically increasing array, the position of the "left" border of each cell.

left       

bottom        in required

a 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 accoring to the 1d array defined by left and res[1,*] the y index accoring to the 1d array defined by bottom.

checkout       

=[rbgrid,ubgrid] specify the right and upper bondaries of the grid and check if some points are out.

Examples

res = inrecgrid(xin, yin, left, bottom) 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

History

S. Masson (smasson@lodyc.jussieu.fr) July 3rd, 2002 October 3rd, 2003: use value_locate
Produced by IDLdoc 2.0.