Changeset 125 for trunk/SRC/Interpolation/inrecgrid.pro
- Timestamp:
- 07/06/06 16:10:25 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SRC/Interpolation/inrecgrid.pro
r121 r125 1 1 ;+ 2 2 ; 3 ; @file_comments given - a list of points, (x,y) position 4 ; - the x and y limits of a rectangular grid 5 ; find in which cell is located each given point. 3 ; @file_comments 4 , given - a list of points, (x,y) position 5 ; - the x and y limits of a rectangular grid 6 ; find in which cell is located each given point. 6 7 ; 7 8 ; @categories no DO loop, use the wonderfull value_locate function! 8 9 ; 9 ; @param x1d {in}{required} a 1d array, the x position on the points 10 ; @param y1d {in}{required} a 1d array, the y position on the points 11 ; @param left {in}{required} a 1d, monotonically increasing array, 10 ; @param x1d {in}{required} 11 ; a 1d array, the x position on the points 12 ; 13 ; @param y1d {in}{required} 14 ; a 1d array, the y position on the points 15 ; 16 ; @param left {in}{required} 17 ; a 1d, monotonically increasing array, 12 18 ; the position of the "left" border of each cell. 13 ; @param bottom {in}{required} a 1d, monotonically increasing array, 19 ; 20 ; @param bottom {in}{required} 21 ; a 1d, monotonically increasing array, 14 22 ; the position of the "bottom" border of each cell. 15 23 ; 16 ; @keyword /output2d to get the output as a 2d array (2,n_elements(x1d)), 24 ; @keyword OUTPUT2D 25 ; to get the output as a 2d array (2,n_elements(x1d)), 17 26 ; with res[0,*] the x index accoring to the 1d array defined by 18 27 ; left and res[1,*] the y index accoring to the 1d array defined by 19 28 ; bottom. 20 29 ; 21 ; @keyword checkout=[rbgrid,ubgrid] specify the right and upper bondaries of 30 ; @keyword CHECKOUT 31 ; = [rbgrid,ubgrid] specify the right and upper boundaries of 22 32 ; the grid and check if some points are out. 23 33 ; 24 ; @returns the index on the cell accoring to the 2d array defined by25 ; left and bottom.34 ; @returns 35 ; the index on the cell accoring to the 2d array defined by left and bottom. 26 36 ; 27 ; @examples 37 ; @examples 28 38 ; 29 ; 30 ; 31 ; 32 ; 39 ; IDL> a=indgen(5) 40 ; IDL> b=indgen(7) 41 ; IDL> r=inrecgrid([0.25,3.25,2],[4.25,2.8,1.4],a,b) 42 ; IDL> print, r 33 43 ; 20 13 7 34 ; 35 ; 44 ; IDL> r=inrecgrid([0.25,3.25,2],[4.25,2.8,1.4],a,a+1,b,b+1,/output2d) 45 ; IDL> print, r 36 46 ; 0.00000 4.00000 37 47 ; 3.00000 2.00000 38 48 ; 2.00000 1.00000 39 ; 49 ; 40 50 ; @history 41 ; 42 ; 43 ; 51 ; S. Masson (smasson\@lodyc.jussieu.fr) 52 ; July 3rd, 2002 53 ; October 3rd, 2003: use value_locate 44 54 ; 45 55 ; @version $Id$ 46 56 ; 47 57 ;- 48 49 FUNCTION inrecgrid, x1d, y1d, left, bottom, output2d = output2d, checkout = checkout 58 FUNCTION inrecgrid, x1d, y1d, left, bottom, OUTPUT2D = output2d, CHECKOUT = checkout 50 59 ; 51 60 compile_opt idl2, strictarrsubs … … 71 80 out = where(xpos EQ -1 OR ypos EQ -1) 72 81 IF out[0] NE -1 THEN res[out] = -1 73 ; 82 ; 74 83 RETURN, res 75 84
Note: See TracChangeset
for help on using the changeset viewer.