Changeset 101 for trunk/SRC/Interpolation
- Timestamp:
- 06/12/06 10:29:56 (18 years ago)
- Location:
- trunk/SRC/Interpolation
- Files:
-
- 21 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SRC/Interpolation/angle.pro
r59 r101 1 1 ;--------- 2 2 ;+ 3 ; NAME:angle.pro (fom angle.F,v 2.2 in OPA8.2)3 ; @file_comments north stereographic polar projection 4 4 ; 5 ; PURPOSE:Compute angles between grid lines and direction of the North5 ; @keyword /DOUBLE use double precision (default is float) 6 6 ; 7 ; CALLING SEQUENCE: 8 ; angle, fileocemesh, gcosu, gsinu, gcosv, gsinv, gcost, gsint 9 ; 10 ; INPUTS: 11 ; fileocemesh a netcdf file that contains (at least): 12 ; glamu, gphiu: longitudes and latitudes at U-points 13 ; glamv, gphiv: longitudes and latitudes at V-points 14 ; glamf, gphif: longitudes and latitudes at F-points 15 ; 16 ; KEYWORD PARAMETERS: 17 ; 18 ; IODIRECTORY: the directory path where is located fileocemesh 19 ; 20 ; /DOUBLE: use double precision (default is float) 21 ; 22 ; OUTPUTS: 7 ; @returns 23 8 ; gsinu,gcosu : sinus and cosinus of the angle 24 9 ; gsinv,gcosv between north-south direction 25 10 ; gsint,gcost and the j-direction of the mesh 26 ;27 11 ; 28 ; RESTRICTIONS:to compute the lateral boundary conditions, we assume12 ; @restrictions to compute the lateral boundary conditions, we assume 29 13 ; that: 30 14 ; (1) the first line is similar to the second line … … 37 21 ; 38 22 ; 39 ; MODIFICATION HISTORY:23 ; @history 40 24 ; -------------- 41 25 ; Original : 96-07 (O. Marti) … … 45 29 ;--------- 46 30 ; 47 ; fsnspp: north stereographic polar projection48 31 FUNCTION fsnspp, plam, pphi, DOUBLE = double 49 32 IF keyword_set(double) THEN BEGIN … … 59 42 END 60 43 ;--------- 44 ;+ 45 ; @file_comments Compute angles between grid lines and direction of the North 46 ;(fom angle.F,v 2.2 in OPA8.2) 47 ; 48 ; @param fileocemesh {in}{required} a netcdf file that contains (at least): 49 ; glamu, gphiu: longitudes and latitudes at U-points 50 ; glamv, gphiv: longitudes and latitudes at V-points 51 ; glamf, gphif: longitudes and latitudes at F-points 52 ; 53 ; @keyword IODIRECTORY the directory path where is located fileocemesh 54 ; @keyword /DOUBLE use double precision (default is float) 55 ;- 61 56 ;--------- 62 57 ; -
trunk/SRC/Interpolation/clickincell.pro
r69 r101 1 1 ;+ 2 ; NAME:clickincell2 ; @file_comments click on a map and find in which cell the click was 3 3 ; 4 ; PURPOSE: click on a map and find in which cell the click was4 ; @categories finding where is a point on a grid 5 5 ; 6 ; CATEGORY:finding where is a point on a grid 7 ; 8 ; CALLING SEQUENCE: 6 ; @examples 9 7 ; 10 8 ; res = clickincell() … … 13 11 ; Click on the right button to quit. 14 12 ; 15 ; INPUTS:None 16 ; 17 ; KEYWORD PARAMETERS: 18 ; 19 ; CELLTYPE = 'T', 'W', 'U', 'V' or 'F': This this the type of point 13 ; @keyword CELLTYPE = 'T', 'W', 'U', 'V' or 'F' This this the type of point 20 14 ; that is located in the center of the cell which the click is 21 15 ; located. default is T type of cell (with corner defined by F 22 16 ; points). 23 17 ; 24 ; /DRAWCELL:to draw the cell in which we clicked18 ; @keyword /DRAWCELL to draw the cell in which we clicked 25 19 ; 26 ; COLOR =the color used to draw the cells (Clicking one more20 ; @keyword COLOR the color used to draw the cells (Clicking one more 27 21 ; time in the same cell will draw the cell with the white color) 28 22 ; 29 ; /ORIGINAL:to get the position of the cell regarding the original23 ; @keyword /ORIGINAL to get the position of the cell regarding the original 30 24 ; grid (with no key_shift, ixminmesh, iyminmesh...) 31 25 ; 32 ; /IJ:see outpus26 ; @keyword /IJ see outpus 33 27 ; 34 ; _EXTRA:to pass extra keywords to inquad and plot (when /drawcell)28 ; @keyword _EXTRA to pass extra keywords to inquad and plot (when /drawcell) 35 29 ; 36 ; OUTPUTS:37 ; the theindex of the selected cells regarding to the grid which30 ; @returns 31 ; the index of the selected cells regarding to the grid which 38 32 ; is in memory in the variable of the common. If /ij keyword is 39 33 ; activated give 2D array (2, n) which are the i,j position of the 40 34 ; n selected cells. 41 35 ; 42 ; COMMON BLOCKS:common.pro36 ; @uses common.pro 43 37 ; 44 ; SIDE EFFECTS: 45 ; 46 ; RESTRICTIONS: 47 ; 48 ; EXAMPLE: 38 ; @examples 49 39 ; 50 40 ; IDL> plt, findgen(jpi,jpj),/nodata,map=[90,0,0],/ortho 51 41 ; IDL> print, clickincell(/draw,color=150,/xy) 52 42 ; 53 ; MODIFICATION HISTORY:54 ; Sebastien Masson (smasson @lodyc.jussieu.fr)43 ; @history 44 ; Sebastien Masson (smasson\@lodyc.jussieu.fr) 55 45 ; August 2003 56 46 ; -
trunk/SRC/Interpolation/compute_fromreg_bilinear_weigaddr.pro
r98 r101 1 1 ;+ 2 ; NAME: compute_fromreg_bilinear_weigaddr 3 ; 4 ; PURPOSE: compute the weight and address neede to interpolate data from a 2 ; @file_comments compute the weight and address neede to interpolate data from a 5 3 ; "regular grid" to any grid using the bilinear method 6 4 ; 7 ; CATEGORY:interpolation 8 ; 9 ; CALLING SEQUENCE: 10 ; compute_fromreg_bilinear_weigaddr, alon, alat, olon, olat, weig, addr 11 ; 12 ; INPUTS: 13 ; lonin and latin: longitude/latitude of the input data. Must be 1D arrays 14 ; lonout and latout: longitude/latitude of the output data. Must be 2D arrays 15 ; 16 ; KEYWORD PARAMETERS: 17 ; 18 ; /NONORTHERNLINE and /NOSOUTHERNLINE: activate if you don't whant to take into 19 ; account the northen/southern line of the input data when perfoming the 5 ; @categories interpolation 6 ; 7 ; @param alonin {in}{required} longitudeof the input data 8 ; @param alatin {in}{required} latitude of the input data 9 ; @param olonin {in}{required} longitude of the output data 10 ; @param olat {in}{required} latitude of the output data 11 ; 12 ; @keyword /NONORTHERNLINE activate if you don't whant to take into 13 ; account the northen line of the input data when perfoming the 14 ; @keyword /NOSOUTHERNLINE activate if you don't whant to take into 15 ; account the southern line of the input data when perfoming the 20 16 ; interpolation. 21 17 ; 22 ; OUTPUTS:18 ; @returns 23 19 ; weig, addr: 2D arrays, weig and addr are the weight and addresses used to 24 20 ; perform the interpolation: … … 26 22 ; dataout = reform(dataout, jpio, jpjo, /over) 27 23 ; 28 ; COMMON BLOCKS: none 29 ; 30 ; SIDE EFFECTS: ? 31 ; 32 ; RESTRICTIONS: 24 ; @restrictions 33 25 ; - the input grid must be a "regular grid", defined as a grid for which each 34 26 ; lontitudes lines have the same latitude and each latitudes columns have the … … 39 31 ; using a linear interpolation only along the longitudinal direction. 40 32 ; 41 ; EXAMPLE: 42 ; 43 ; MODIFICATION HISTORY: 33 ; @history 44 34 ; November 2005: Sebastien Masson (smasson@lodyc.jussieu.fr) 45 35 ; -
trunk/SRC/Interpolation/compute_fromreg_imoms3_weigaddr.pro
r69 r101 1 1 ;+ 2 ; NAME: compute_fromreg_imoms3_weigaddr 3 ; 4 ; PURPOSE: compute the weight and address neede to interpolate data from a 2 ; 3 ; @file_comments compute the weight and address neede to interpolate data from a 5 4 ; "regular grid" to any grid using the imoms3 method 6 5 ; 7 ; CATEGORY:interpolation 8 ; 9 ; CALLING SEQUENCE: 10 ; compute_fromreg_imoms3_weigaddr, alon, alat, olon, olat, weig, addr 11 ; 12 ; INPUTS: 13 ; lonin and latin: longitude/latitude of the input data 14 ; lonout and latout: longitude/latitude of the output data 15 ; 16 ; KEYWORD PARAMETERS: 17 ; 18 ; /NONORTHERNLINE and /NOSOUTHERNLINE: activate if you don't whant to take into 6 ; @categories interpolation 7 PRO compute_fromreg_imoms3_weigaddr, alonin, alatin, olonin, olat, weig, addr $ 8 ; 9 ; @param alonin {in}{required} longitude of the input data 10 ; @param alatin {in}{required} latitude of the input data 11 ; @param olonin {in}{required} longitude of the output data 12 ; @param olat {in}{required} latitude of the output data 13 ; 14 ; @keyword /NONORTHERNLINE and /NOSOUTHERNLINE activate if you don't whant to take into 19 15 ; account the northen/southern line of the input data when perfoming the 20 16 ; interpolation. 21 17 ; 22 ; OUTPUTS:18 ; @returns 23 19 ; weig, addr: 2D arrays, weig and addr are the weight and addresses used to 24 20 ; perform the interpolation: … … 26 22 ; dataout = reform(dataout, jpio, jpjo, /over) 27 23 ; 28 ; COMMON BLOCKS: none 29 ; 30 ; SIDE EFFECTS: ? 31 ; 32 ; RESTRICTIONS: 24 ; @restrictions 33 25 ; - the input grid must be a "regular/rectangular grid", defined as a grid for 34 26 ; which each lontitudes lines have the same latitude and each latitudes columns … … 42 34 ; using a imoms3 interpolation only along the longitudinal direction. 43 35 ; 44 ; EXAMPLE: 45 ; 46 ; MODIFICATION HISTORY: 47 ; November 2005: Sebastien Masson (smasson@lodyc.jussieu.fr) 36 ; @history 37 ; November 2005: Sebastien Masson (smasson\@lodyc.jussieu.fr) 48 38 ; March 2006: works for rectangular grids 49 39 ;- -
trunk/SRC/Interpolation/cutpar.pro
r59 r101 1 1 ;+ 2 ; NAME: cutpar3 2 ; 4 ; PURPOSE:cut p parallelogram(s) into p*n^2 parallelograms3 ; @file_comments cut p parallelogram(s) into p*n^2 parallelograms 5 4 ; 6 ; CATEGORY:basic work5 ; @categories basic work 7 6 ; 8 ; CALLING SEQUENCE:res = cutpar(x0, y0, x1, y1, x2, y2, x3, y3, n) 7 ; @examples 8 ; res = cutpar(x0, y0, x1, y1, x2, y2, x3, y3, n) 9 9 ; 10 ; INPUTS: 11 ; x0,y0 1d arrays of p elements, giving the edge positions. The 10 ; @param x0,y0 {in}{required} 1d arrays of p elements, giving the edge positions. The 12 11 ; edges must be given as in plot to traw the parallelogram. (see 13 12 ; example). 14 ; n:each parallelogram will be cutted in n^2 pieces13 ; @param n {in}{required} each parallelogram will be cutted in n^2 pieces 15 14 ; 16 ; KEYWORD PARAMETERS:15 ; @keyword /endpoints see outputs 17 16 ; 18 ; /endpoints: see outputs 19 ; 20 ; /onsphere: to specify that the points are located on a 17 ; @keyword /onsphere to specify that the points are located on a 21 18 ; sphere. In this case, x and y corresponds to longitude and 22 19 ; latitude in degrees. 23 20 ; 24 ; OUTPUTS:21 ; @returns 25 22 ; -defaut: 3d array(2,n^2,p) giving the center position of each 26 23 ; piece of the parallelograms … … 28 25 ; of each piece of the parallelograms 29 26 ; 30 ; COMMON BLOCKS: no27 ; @uses cutsegment.pro 31 28 ; 32 ; SIDE EFFECTS: need cutsegment.pro 33 ; 34 ; RESTRICTIONS: ? 35 ; 36 ; EXAMPLE: 29 ; @examples 37 30 ; 38 31 ; x0 = [2,6,2] … … 50 43 ; for i=0,2 do oplot, [res[0,*,i]], [res[1,*,i]], color = 20+10*i, psym = 1, thick = 3 51 44 ; 52 ; MODIFICATION HISTORY:53 ; S. Masson (smasson @lodyc.jussieu.fr)45 ; @history 46 ; S. Masson (smasson\@lodyc.jussieu.fr) 54 47 ; July 5th, 2002 55 48 ;- -
trunk/SRC/Interpolation/cutsegment.pro
r59 r101 1 1 ;+ 2 ; NAME: cutsegment3 2 ; 4 ; PURPOSE:cut p segments into p*n equal parts3 ; @file_comments cut p segments into p*n equal parts 5 4 ; 6 ; CATEGORY:basic work5 ; @categories basic work 7 6 ; 8 ; CALLING SEQUENCE: res = cutsegment(x0, y0, x1, y1, n) 7 ; @examples 8 ; res = cutsegment(x0, y0, x1, y1, n) 9 9 ; 10 ; INPUTS: 11 ; x0,y0 and x1,y1, 1d arrays of p elements, the coordinates of 10 ; @param x0,y0 and x1,y1 {in}{required} 1d arrays of p elements, the coordinates of 12 11 ; the endpoints of the p segmements 13 ; n:the number of pieces we want to cut each segment12 ; @param n {in}{required} the number of pieces we want to cut each segment 14 13 ; 15 ; KEYWORD PARAMETERS:16 14 ; 17 ; /endpoints:see ouputs15 ; @keyword /endpoints see ouputs 18 16 ; 19 ; /onsphere:to specify that the points are located on a17 ; @keyword /onsphere to specify that the points are located on a 20 18 ; sphere. In this case, x and y corresponds to longitude and 21 19 ; latitude in degrees. 22 20 ; 23 ; OUTPUTS:21 ; @returns 24 22 ; defaut: a 3d array (2,n,p) that gives the coordinates of the 25 23 ; middle of the cutted segments. … … 27 25 ; coordinates of the endpoints of the cutted segments. 28 26 ; 29 ; COMMON BLOCKS: no 30 ; 31 ; SIDE EFFECTS: no 32 ; 33 ; RESTRICTIONS: ? 34 ; 35 ; EXAMPLE: 27 ; @examples 36 28 ; 37 29 ; IDL> x0=[2,5] … … 46 38 ; IDL> oplot, [res[0,*,1]], [res[1,*,1]], color = 40, psym = 1, thick = 3 47 39 ; 48 ; MODIFICATION HISTORY:49 ; S. Masson (smasson @lodyc.jussieu.fr)40 ; @history 41 ; S. Masson (smasson\@lodyc.jussieu.fr) 50 42 ; July 5th, 2002 51 43 ;- -
trunk/SRC/Interpolation/extrapolate.pro
r69 r101 1 ;+ 2 ; @file_comments extrapolate data (zinput) where maskinput eq 0 by filling step by 3 ; step the coastline points with the mean value of the 8 neighbourgs. 4 ; 5 ;- 1 6 FUNCTION extrapolate, zinput, maskinput, nb_iteration, x_periodic = x_periodic, MINVAL = minval, MAXVAL = maxval 2 7 ; 3 8 compile_opt strictarr, strictarrsubs 4 ;5 ; extrapolate data (zinput) where maskinput eq 0 by filling step by6 ; step the coastline points with the mean value of the 8 neighbourgs.7 9 ; 8 10 ; check the number of iteration used in the extrapolation. -
trunk/SRC/Interpolation/fromreg.pro
r69 r101 1 1 ;+ 2 ; NAME: fromreg3 2 ; 4 ; PURPOSE:interpolate data from a "regular/rectangular grid" to any grid.3 ; @file_comments interpolate data from a "regular/rectangular grid" to any grid. 5 4 ; 2 metods availables: bilinear and imoms3 6 5 ; A "regular/rectangular grid" is defined as a grid for which each lontitudes lines have 7 6 ; the same latitude and each latitudes columns have the same longitude. 8 7 ; 9 ; CATEGORY:interpolation8 ; @categories interpolation 10 9 ; 11 ; CALLING SEQUENCE: dataout = fromreg(method, datain [, lonin, latin, lonout, latout]) 10 ; @examples 11 ; dataout = fromreg(method, datain [, lonin, latin, lonout, latout]) 12 12 ; 13 ; INPUTS: 14 ; method: a string defining the interpolation method. 13 ; @param method {in}{required} a string defining the interpolation method. 15 14 ; must be 'bilinear' or 'imoms3' 16 ; datain:a 2D array the input data to interpolate17 ; lonin and latin:longitude/latitude of the input data. optionals if15 ; @param datain {in}{required} a 2D array the input data to interpolate 16 ; @param lonin latin {in}{required} longitude/latitude of the input data. optionals if 18 17 ; WEIG and ADDR keywords used. 19 ; lonout and latout:longitude/latitude of the output data. optionals if18 ; @param lonout latout {in}{required} longitude/latitude of the output data. optionals if 20 19 ; WEIG and ADDR keywords used. 21 20 ; 22 ; KEYWORD PARAMETERS: 23 ; 24 ; WEIG, ADDR: 2D arrays, weig and addr are the weight and addresses used to 21 ; @keyword WEIG, ADDR 2D arrays, weig and addr are the weight and addresses used to 25 22 ; perform the interpolation: 26 23 ; dataout = total(weig*datain[addr], 1) … … 31 28 ; case, lonin, latin, lonout and latout are not necessary. 32 29 ; 33 ; /NONORTHERNLINE and /NOSOUTHERNLINE:activate if you don't whant to take into30 ; @keyword /NONORTHERNLINE and /NOSOUTHERNLINE activate if you don't whant to take into 34 31 ; account the northen/southern line of the input data when perfoming the 35 32 ; interpolation. 36 33 ; 37 ; OUTPUTS:2D array: the interpolated data34 ; @returns 2D array: the interpolated data 38 35 ; 39 ; COMMON BLOCKS: none 36 ; @restrictions We supposed the data are located on a sphere, with a 37 ; periodicity along the longitude. 40 38 ; 41 ; SIDE EFFECTS: ? 42 ; 43 ; RESTRICTIONS:We supposed the data are located on a sphere, with a periodicity along 44 ; the longitude. 45 ; 46 ; EXAMPLE: 39 ; @examples 47 40 ; 48 41 ; topa = fromreg('bilinear', tncep, xncep, yncep, glamt, gphit) … … 54 47 ; t2opa = fromreg('bilinear', t2ncep, xncep, WEIG = a, ADDR = b) 55 48 ; 56 ; MODIFICATION HISTORY:57 ; November 2005: Sebastien Masson (smasson @lodyc.jussieu.fr)49 ; @history 50 ; November 2005: Sebastien Masson (smasson\@lodyc.jussieu.fr) 58 51 ; 59 52 ;- -
trunk/SRC/Interpolation/get_gridparams.pro
r69 r101 1 1 ;+ 2 ; NAME: get_gridparams 3 ; 4 ; PURPOSE: 2 ; 3 ; @file_comments 5 4 ; 1) extract from a NetCDF file the longitude, latidude, and their dimensions 6 5 ; and make sure it is 1D or 2D arrays … … 9 8 ; they are 1D or 2D arrays 10 9 ; 11 ; CATEGORY:for interpolations tools12 ; 13 ; CALLING SEQUENCE:10 ; @categories interpolation 11 ; 12 ; @examples 14 13 ; 15 14 ; 1) get_gridparams, file, lonname, latname, lon, lat, jpi, jpj, n_dimensions … … 19 18 ; 2) get_gridparams, lon, lat, jpi, jpj, n_dimensions 20 19 ; 21 ; INPUTS:22 ;23 20 ; 1) 24 ; file: the name of the netcdf file 25 ; loname: the name of the variable that contains the longitude in the NetCDF file 26 ; latname: the name of the variable that contains the latitude in the NetCDF file 21 ; @param in1 {in}{required} the name of the netcdf file 22 ; @param in2 {in}{required} the name of the variable that contains the longitude in the NetCDF file 23 ; @param in3 {in}{required} the name of the variable that contains the latitude in the NetCDF file 24 ; @param in4 {out} the number of points in the longitudinal direction 25 ; @param in5 {out} the number of points in the latitudinal direction 26 ; @param in6 {out} the variable that will contain the longitudes 27 ; @param in7 {out} the variable that will contain the latitudes 28 ; @param in8 {out} 1 or 2 to specify if lon and lat should be 1D (jpi or jpj) 27 29 ; 28 30 ; or 29 31 ; 30 ; 2) lon and lat: 1d or 2D arrays defining longitudes and latitudes. 32 ; 2) 33 ; @param lon lat {in}{required} 1d or 2D arrays defining longitudes and latitudes. 31 34 ; Note that these arrays are also outputs and can therefore be modified. 32 35 33 ; KEYWORD PARAMETERS: none 34 ; 35 ; OUTPUTS: 36 ; lon the variable that will contain the longitudes 37 ; lat the variable that will contain the latitudes 38 ; jpi the number of points in the longitudinal direction 39 ; jpj the number of points in the latitudinal direction 40 ; n_dimensions: 1 or 2 to specify if lon and lat should be 1D (jpi or jpj) 36 ; @param in1 {out} the variable that will contain the longitudes 37 ; @param in2 {out} the variable that will contain the latitudes 38 ; @param in3 {out} the number of points in the longitudinal direction 39 ; @param in4 {out} the number of points in the latitudinal direction 40 ; @param in5 {out} 1 or 2 to specify if lon and lat should be 1D (jpi or jpj) 41 41 ; arrays or 2D arrays (jpi,jpj). Note that of n_dimensions = 1, then the 42 42 ; grid must be regular (each longitudes must be the same for all latitudes 43 43 ; and each latitudes should be the sae for all longitudes). 44 44 ; 45 ; COMMON BLOCKS: none 46 ; 47 ; SIDE EFFECTS: ? 48 ; 49 ; RESTRICTIONS: ? 50 ; 51 ; EXAMPLE: 45 ; @examples 52 46 ; 53 47 ; 1) ncdf_get_gridparams, 'coordinates_ORCA_R05.nc', 'glamt', 'gphit' $ … … 56 50 ; 2) ncdf_get_gridparams, olon, olat, jpio, jpjo, 2 57 51 ; 58 ; MODIFICATION HISTORY:59 ; November 2005: Sebastien Masson (smasson @lodyc.jussieu.fr)52 ; @history 53 ; November 2005: Sebastien Masson (smasson\@lodyc.jussieu.fr) 60 54 ; 61 55 ;- -
trunk/SRC/Interpolation/imoms3.pro
r69 r101 1 ;+ 2 ; 3 ;- 1 4 FUNCTION imoms3, xin 2 5 -
trunk/SRC/Interpolation/inquad.pro
r59 r101 1 1 ;+ 2 ; NAME:inquad 3 ; 4 ; PURPOSE: to find if an (x,y) point is in a quadrilateral (x1,x2,x3,x4) 5 ; 6 ; CATEGORY:grid manipulation 7 ; 8 ; CALLING SEQUENCE: 2 ; @file_comments to find if an (x,y) point is in a quadrilateral (x1,x2,x3,x4) 3 ; 4 ; @categories grid manipulation 5 ; 6 ; @examples 9 7 ; 10 8 ; res = inquad(x, y, x1, y1, x2, y2, x3, y3, x4, y4) 11 9 ; 12 ; INPUTS: 13 ; 14 ; x,y: the coordinates of the point we want to know where it 10 ; @param x y {in}{required} the coordinates of the point we want to know where it 15 11 ; is. Must be a scalar if /onsphere activated else can be scalar 16 12 ; or array. 17 13 ; 18 ; x1, y1, x2, y2, x3, y3, x4, y4:the coordinates of the14 ; @param x1 y1 x2 y2 x3 y3 x4 y4 {in}{required} the coordinates of the 19 15 ; quadrilateral given in the CLOCKWISE order. Scalar or array. 20 16 ; 21 ; KEYWORD PARAMETERS: 22 ; 23 ; /DOUBLE: use double precision to perform the computation 24 ; 25 ; /ONSPHERE: to specify that the quadilateral are on a sphere and 17 ; 18 ; @keyword /DOUBLE use double precision to perform the computation 19 ; 20 ; @keyword /ONSPHERE to specify that the quadilateral are on a sphere and 26 21 ; that teir coordinates are longitude-latitude coordinates. In this 27 22 ; case, est-west periodicity, poles singularity and other pbs … … 29 24 ; automatically. 30 25 ; 31 ; ZOOMRADIUS:the zoom (circle centred on the (x,y) with a radius of26 ; @keyword ZOOMRADIUS :the zoom (circle centred on the (x,y) with a radius of 32 27 ; zoomradius degree where we look for the the quadrilateral which; contains the (x,y) point) used for the satellite projection 33 28 ; when /onsphere is activated. Default is 4 and seems to be the … … 35 30 ; larger than 5 degrees. 36 31 ; 37 ; /NOPRINT: to suppress the print messages. 38 ; 39 ; OUTPUTS: 40 ; 41 ; res, a n element vector. Where n is the number of elements of 32 ; @keyword /NOPRINT to suppress the print messages. 33 ; 34 ; @returns 35 ; a n element vector. Where n is the number of elements of 42 36 ; x. res[i]=j means that the point number i is located in the 43 37 ; quadrilateral number j with (0 <= j <= n_elements(x0)-1) 44 38 ; 45 ; COMMON BLOCKS:none 46 ; 47 ; SIDE EFFECTS: 48 ; 49 ; RESTRICTIONS: I think degenerated quadrilateral (e.g. flat of 39 ; @restrictions I think degenerated quadrilateral (e.g. flat of 50 40 ; twisted) is not work. This has to be tested. 51 41 ; 52 ; EXAMPLE:42 ; @examples 53 43 ; 54 44 ; x = 1.*[1, 2, 6, 7, 3] … … 69 59 ; On a sphere see clickincell.pro... 70 60 ; 71 ; MODIFICATION HISTORY:72 ; Sebastien Masson (smasson @lodyc.jussieu.fr)61 ; @history 62 ; Sebastien Masson (smasson\@lodyc.jussieu.fr) 73 63 ; August 2003 74 64 ; Based on Convert_clic_ij.pro written by Gurvan Madec … … 192 182 ; the point is inside the quadilateral if test eq 1 193 183 ; with test equal to: 194 ; test = ((x-x1)*(y2-y1) GE (x2-x1)*(y-y1)) $ 184 ; test = ((x-x1)*(y2-y1) GE (x2-x1)*(y-y1)) $ 195 185 ; *((x-x2)*(y3-y2) GT (x3-x2)*(y-y2)) $ 196 186 ; *((x-x3)*(y4-y3) GT (x4-x3)*(y-y3)) $ -
trunk/SRC/Interpolation/inrecgrid.pro
r59 r101 1 1 ;+ 2 ; NAME: inrecgrid3 2 ; 4 ; PURPOSE:given - a list of points, (x,y) position3 ; @file_comments given - a list of points, (x,y) position 5 4 ; - the x and y limits of a rectangular grid 6 5 ; find in which cell is located each given point. 7 6 ; 8 ; CATEGORY:no DO loop, use the wonderfull value_locate function!7 ; @categories no DO loop, use the wonderfull value_locate function! 9 8 ; 10 ; CALLING SEQUENCE:res = inrecgrid(xin, yin, left, bottom) 9 ; @examples 10 ; res = inrecgrid(xin, yin, left, bottom) 11 11 ; 12 ; INPUTS: 13 ; 14 ; x1d: a 1d array, the x position on the points 15 ; y1d: a 1d array, the y position on the points 16 ; left: a 1d, monotonically increasing array, the position of the 12 ; @param x1d {in}{required} a 1d array, the x position on the points 13 ; @param y1d {in}{required} a 1d array, the y position on the points 14 ; left {in}{required} a 1d, monotonically increasing array, the position of the 17 15 ; "left" border of each cell. 18 ; bottom:a 1d, monotonically increasing array, the position of the16 ; @param bottom {in}{required} a 1d, monotonically increasing array, the position of the 19 17 ; "bottom" border of each cell. 20 18 ; 21 ; OPTIONAL INPUTS:22 19 ; 23 ; KEYWORD PARAMETERS:; 24 ; 25 ; /output2d: to get the output as a 2d array (2,n_elements(x1d)), 20 ; @keyword /output2d to get the output as a 2d array (2,n_elements(x1d)), 26 21 ; with res[0,*] the x index accoring to the 1d array defined by 27 22 ; left and res[1,*] the y index accoring to the 1d array defined by 28 23 ; bottom. 29 24 ; 30 ; checkout=[rbgrid,ubgrid] specify the right and upper bondaries of25 ; @keyword checkout=[rbgrid,ubgrid] specify the right and upper bondaries of 31 26 ; the grid and check if some points are out. 32 27 ; 33 ; OUTPUTS:the index on the cell accoring to the 2d array defined by28 ; @returns the index on the cell accoring to the 2d array defined by 34 29 ; left and bottom. 35 30 ; 36 ; OPTIONAL OUTPUTS: 37 ; 38 ; COMMON BLOCKS: no 39 ; 40 ; SIDE EFFECTS: 41 ; 42 ; RESTRICTIONS: 43 ; 44 ; PROCEDURE: 45 ; 46 ; EXAMPLE: 31 ; @examples 47 32 ; 48 33 ; IDL> a=indgen(5) … … 57 42 ; 2.00000 1.00000 58 43 ; 59 ; MODIFICATION HISTORY:60 ; S. Masson (smasson @lodyc.jussieu.fr)44 ; @history 45 ; S. Masson (smasson\@lodyc.jussieu.fr) 61 46 ; July 3rd, 2002 62 47 ; October 3rd, 2003: use value_locate -
trunk/SRC/Interpolation/ll_narcs_distances.pro
r59 r101 1 1 ;+ 2 ; NAME:3 ; LL_NARCS_DISTANCES4 2 ; 5 ; PURPOSE:6 ; 7 ; 8 ; 3 ; @file_comments 4 ; This function returns the longitude and latitude [lon, lat] of 5 ;a point a given arc distance (-pi <= Arc_Dist <= pi), and azimuth (Az), 6 ;from a specified location Lon0, lat0. 9 7 ; Same as LL_ARC_DISTANCE but for n points without do loop. 10 8 ; 11 ; CATEGORY: 12 ; Mapping, geography. 9 ; @categories Mapping, geography 13 10 ; 14 ; CALLING SEQUENCE:15 ; 11 ; @examples 12 ;Result = LL_NARCS_DISTANCES(Lon, lat0, Arc_Dist, Az) 16 13 ; 17 ; INPUTS: 18 ; Lon0: An array containing the longitude of the starting point. 14 ; @param Lon0 {in}{required} An array containing the longitude of the starting point. 19 15 ; Values are assumed to be in radians unless the keyword 20 16 ; DEGREES is set. 21 ; Lat0:An array containing the latitude of the starting point.17 ; @param Lat0 {in}{required} An array containing the latitude of the starting point. 22 18 ; Values are assumed to be in radians unless the keyword 23 19 ; DEGREES is set. 24 ; Arc_Dist:The arc distance from Lon_lat0. The value must be between25 ; 26 ; 27 ; 28 ; 29 ; Az:The azimuth from Lon_lat0. The value is assumed to be in30 ; 20 ; @param Arc_Dist {in}{required} The arc distance from Lon_lat0. The value must be between 21 ; -!PI and +!PI. To express distances in arc units, divide 22 ; by the radius of the globe expressed in the original units. 23 ; For example, if the radius of the earth is 6371 km, divide 24 ; the distance in km by 6371 to obtain the arc distance. 25 ; @param Az {in}{required} The azimuth from Lon_lat0. The value is assumed to be in 26 ; radians unless the keyword DEGREES is set. 31 27 ; 32 ; KEYWORD PARAMETERS: 33 ; DEGREES: Set this keyword to express all measurements and 34 ; results in degrees. 28 ; @keyword DEGREES Set this keyword to express all measurements and 29 ; results in degrees. 35 30 ; 36 ; OUTPUTS:37 ; This function returnsa (2, n) array containing the31 ; @returns 32 ; a (2, n) array containing the 38 33 ; longitude / latitude of the resultings points. Values are in radians 39 34 ; unless the keyword DEGREES is set. 40 35 ; 41 ; PROCEDURE:42 ; 43 ; 36 ; @file_comments 37 ;Formula from Map Projections - a working manual. USGS paper 38 ;1395. Equations (5-5) and (5-6). 44 39 ; 45 ; EXAMPLE:46 ; Lon_lat0 = [1.0, 2.0] ; Initial point specified in radians47 ; Arc_Dist = 2.0; Arc distance in radians48 ; Az = 1.0; Azimuth in radians49 ; 50 ; 51 ; 40 ; @examples 41 ;Lon_lat0 = [1.0, 2.0]; Initial point specified in radians 42 ;Arc_Dist = 2.0; Arc distance in radians 43 ;Az = 1.0; Azimuth in radians 44 ;Result = LL_ARC_DISTANCE(Lon_lat0, Arc_Dist, Az) 45 ;PRINT, Result 46 ; 2.91415 -0.622234 52 47 ; 53 ; 54 ; 55 ; 56 ; 57 ; 58 ; 59 ; 60 ; 61 ; 62 ; 48 ;IDL> lon0 = [-10, 20, 100] 49 ;IDL> lat0 = [0, -10, 45] 50 ;IDL> lon1 = [10, 60, 280] 51 ;IDL> lat1 = [0, 10, 45] 52 ;IDL> dist = map_npoints(lon0, lat0, lon1, lat1, azimuth = azi, /two_by_two) 53 ;IDL> earthradius = 6378206.4d0 54 ;IDL> res = ll_narcs_distances(lon0, lat0, dist/earthradius, azi, /degrees) 55 ;IDL> print, reform(res[0, *]) 56 ; 10.000000 60.000000 280.00000 57 ;IDL> print, reform(res[1, *]) 63 58 ; 1.1999280e-15 10.000000 45.000000 64 59 ; 65 ; MODIFICATION HISTORY:60 ; @history 66 61 ; Based on the IDL function ll_arc_distance.pro,v 1.11 2003/02/03 67 ; Sebastien Masson (smasson@lodyc.jussieu.fr)62 ; Sebastien Masson (smasson\@lodyc.jussieu.fr) 68 63 ; August 2005 69 64 ;- 70 65 71 ; Return the [lon, lat] of the point a given arc distance 72 ; (-pi <= arc_dist <= pi), 66 ;+ 67 ; @file_comments Return the [lon, lat] of the point a given arc distance 68 ;(-pi <= arc_dist <= pi), 73 69 ; and azimuth (az), from lon_lat0. 70 ;- 74 71 ; 75 72 FUNCTION LL_NARCS_DISTANCES, lon0, lat0, arc_dist, az, DEGREES = degs -
trunk/SRC/Interpolation/map_npoints.pro
r59 r101 1 1 ;+ 2 ; NAME:3 ; Map_nPoints4 2 ; 5 ; PURPOSE:6 ; 3 ; @file_comments 4 ;Return the distance in meter between all np0 points P0 and all 7 5 ; np1 points P1 on a sphere. If keyword /TWO_BY_TWO is given then 8 6 ; returns the distances between number n of P0 points and number … … 11 9 ; without do loop. 12 10 ; 13 ; CATEGORY: 14 ; Maps. 11 ; @categories Maps 15 12 ; 16 ; CALLING SEQUENCE:17 ; 13 ; @examples 14 ;Result = Map_nPoints(lon0, lat0, lon1, lat1) 18 15 ; 19 ; INPUTS: 20 ; Lon0, Lat0 = np0 elements vector. longitudes and latitudes of 21 ; np0 points P0 22 ; Lon1, Lat1 = np1 elements vector. longitude and latitude of 23 ; np1 points P1 16 ;@param Lon0 Lat0 {in}{required} np0 elements vector. longitudes and latitudes of np0 points P0 17 ;@param Lon1 Lat1 {in}{required} np1 elements vector. longitude and latitude of np1 points P1 24 18 ; 25 ; KEYWORD PARAMETERS: 26 ; 27 ; AZIMUTH: A named variable that will receive the azimuth of the great 19 ; @keyword AZIMUTH A named variable that will receive the azimuth of the great 28 20 ; circle connecting the two points, P0 to P1 29 ; /MIDDLE:to get the longitude/latitude of the middle point betwen P0 and P1.30 ; RADIANS = if set, inputs and angular outputs are in radians, otherwise31 ; 32 ; RADIUS:If given, return the distance between the two points33 ; 21 ; @keyword /MIDDLE to get the longitude/latitude of the middle point betwen P0 and P1. 22 ; @keyword RADIANS = if set, inputs and angular outputs are in radians, otherwise 23 ;degrees. 24 ; @keyword RADIUS If given, return the distance between the two points 25 ;calculated using the given radius. 34 26 ; Default value is the earth radius : 6378206.4d0 35 ; TWO_BY_TWO:If given,then Map_nPoints returns the distances between27 ; @keyword TWO_BY_TWO:If given,then Map_nPoints returns the distances between 36 28 ; number n of P0 points and number n of P1 points (in that case, 37 29 ; np0 and np1 must be equal). 38 30 ; 39 ; OUTPUTS:31 ; @returns 40 32 ; An (np0,np1) array giving the distance in meter between np0 41 33 ; points P0 and np1 points P1. Element (i,j) of the ouput is the … … 46 38 ; if /MIDDLE see this keyword. 47 39 ; 48 ; EXAMPLES: 49 ; IDL> print, $ 50 ; map_npoints([-105.15,1],[40.02,1],[-0.07,100,50],[51.30,20,0]) 51 ; 7551369.3 5600334.8 52 ; 12864354. 10921254. 53 ; 14919237. 5455558.8 54 ; 55 ; IDL> lon0 = [-10, 20, 100] 56 ; IDL> lat0 = [0, -10, 45] 57 ; IDL> lon1 = [10, 60, 280] 58 ; IDL> lat1 = [0, 10, 45] 59 ; IDL> dist = map_npoints(lon0, lat0, lon1, lat1, azimuth = azi) 60 ; IDL> help, dist, azi 61 ; DIST DOUBLE = Array[3, 3] 62 ; AZI DOUBLE = Array[3, 3] 63 ; IDL> print, dist[4*lindgen(3)], azi[4*lindgen(3)] 64 ; 2226414.0 4957944.5 10018863. 65 ; 90.000000 64.494450 4.9615627e-15 66 ; IDL> dist = map_npoints(lon0, lat0, lon1, lat1, azimuth = azi, /two_by_two) 67 ; IDL> help, dist, azi 68 ; DIST DOUBLE = Array[3] 69 ; AZI DOUBLE = Array[3] 70 ; IDL> print, dist, azi 71 ; 2226414.0 4957944.5 10018863. 72 ; 90.000000 64.494450 4.9615627e-15 73 ; IDL> print, map_2points(lon0[0], lat0[0], lon1[0], lat1[0]) 74 ; 20.000000 90.000000 75 ; IDL> print, map_npoints(lon0[0], lat0[0], lon1[0], lat1[0], azi=azi)/6378206.4d0 / !dtor, azi 76 ; 20.000000 77 ; 90.000000 40 ; @examples 41 ;IDL> print, $ 42 ;map_npoints([-105.15,1],[40.02,1],[-0.07,100,50],[51.30,20,0]) 43 ; 7551369.3 5600334.8 44 ; 12864354. 10921254. 45 ; 14919237. 5455558.8 78 46 ; 79 ; IDL> lon0 = [-10, 20, 100] 80 ; IDL> lat0 = [0, -10, 45] 81 ; IDL> lon1 = [10, 60, 280] 82 ; IDL> lat1 = [0, 10, 45] 83 ; IDL> mid = map_npoints(lon0, lat0, lon1, lat1, /middle, /two_by_two) 84 ; IDL> print, reform(mid[0,*]), reform(mid[1,*]) 85 ; 0.0000000 40.000000 190.00000 86 ; 0.0000000 -1.5902773e-15 90.000000 87 ; IDL> print, (map_2points(lon0[0], lat0[0], lon1[0], lat1[0], npath = 3))[*, 1] 88 ; 0.0000000 0.0000000 89 ; IDL> print, (map_2points(lon0[1], lat0[1], lon1[1], lat1[1], npath = 3))[*, 1] 90 ; 40.000000 -1.5902773e-15 91 ; IDL> print, (map_2points(lon0[2], lat0[2], lon1[2], lat1[2], npath = 3))[*, 1] 92 ; 190.00000 90.000000 93 ; 94 ; MODIFICATION HISTORY: 47 ;IDL> lon0 = [-10, 20, 100] 48 ;IDL> lat0 = [0, -10, 45] 49 ;IDL> lon1 = [10, 60, 280] 50 ;IDL> lat1 = [0, 10, 45] 51 ;IDL> dist = map_npoints(lon0, lat0, lon1, lat1, azimuth = azi) 52 ;IDL> help, dist, azi 53 ;DIST DOUBLE = Array[3, 3] 54 ;AZI DOUBLE = Array[3, 3] 55 ;IDL> print, dist[4*lindgen(3)], azi[4*lindgen(3)] 56 ; 2226414.0 4957944.5 10018863. 57 ; 90.000000 64.494450 4.9615627e-15 58 ;IDL> dist = map_npoints(lon0, lat0, lon1, lat1, azimuth = azi, /two_by_two) 59 ;IDL> help, dist, azi 60 ;DIST DOUBLE = Array[3] 61 ;AZI DOUBLE = Array[3] 62 ;IDL> print, dist, azi 63 ; 2226414.0 4957944.5 10018863. 64 ; 90.000000 64.494450 4.9615627e-15 65 ;IDL> print, map_2points(lon0[0], lat0[0], lon1[0], lat1[0]) 66 ; 20.000000 90.000000 67 ;IDL> print, map_npoints(lon0[0], lat0[0], lon1[0], lat1[0], azi=azi)/6378206.4d0 / !dtor, azi 68 ; 20.000000 69 ; 90.000000 70 ; 71 ;IDL> lon0 = [-10, 20, 100] 72 ;IDL> lat0 = [0, -10, 45] 73 ;IDL> lon1 = [10, 60, 280] 74 ;IDL> lat1 = [0, 10, 45] 75 ;IDL> mid = map_npoints(lon0, lat0, lon1, lat1, /middle, /two_by_two) 76 ;IDL> print, reform(mid[0,*]), reform(mid[1,*]) 77 ; 0.0000000 40.000000 190.00000 78 ; 0.0000000 -1.5902773e-15 90.000000 79 ;IDL> print, (map_2points(lon0[0], lat0[0], lon1[0], lat1[0], npath = 3))[*, 1] 80 ; 0.0000000 0.0000000 81 ;IDL> print, (map_2points(lon0[1], lat0[1], lon1[1], lat1[1], npath = 3))[*, 1] 82 ; 40.000000 -1.5902773e-15 83 ;IDL> print, (map_2points(lon0[2], lat0[2], lon1[2], lat1[2], npath = 3))[*, 1] 84 ; 190.00000 90.000000 85 ; 86 ; @history 95 87 ; Based on the IDL function map_2points.pro,v 1.6 2001/01/15 96 ; Sebastien Masson (smasson@lodyc.jussieu.fr)88 ; Sebastien Masson (smasson\@lodyc.jussieu.fr) 97 89 ; October 2003 98 90 ;- -
trunk/SRC/Interpolation/neighbor.pro
r74 r101 1 1 ;+ 2 ; NAME:3 ; neighbor4 2 ; 5 ; PURPOSE:6 ; 7 ; 3 ; @file_comments 4 ;find the closetest point of (P0) within a list of np1 points 5 ;P1 Which can be on a sphere 8 6 ; 9 ; CATEGORY: 10 ; Maps. 7 ; @categories Maps 11 8 ; 12 ; CALLING SEQUENCE:13 ; 9 ; @examples 10 ; IDL> Result = neighbor(lon0, lat0, lon1, lat1) 14 11 ; 15 ; INPUTS: 16 ; Lon0, Lat0 = scalar. longitudes and latitudes of point P0. 17 ; Lon1, Lat1 = np1 elements vector. longitude and latitude of 18 ; np1 points P1 12 ;@param p0lon {in}{required} scalar. longitudes of point P0. 13 ;@param p0lat {in}{required} scalar. latitudes of point P0. 19 14 ; 20 ; KEYWORD PARAMETERS: 21 ; RADIANS = if set, inputs and angular outputs are in radians, otherwise 22 ; degrees. 23 ; DISTANCE = dis, to get back the distances between P0 and the np1 15 ; @keyword RADIANS if set, inputs and angular outputs are in radians, otherwise 16 ;degrees. 17 ; @keyword DISTANCE dis, to get back the distances between P0 and the np1 24 18 ; points P1 in the variable dis. 25 ; /SPHERE to activate if points are located on a sphere.19 ; @keyword /SPHERE to activate if points are located on a sphere. 26 20 ; 27 ; OUTPUTS:21 ; @returns 28 22 ; index giving the P1[index] point that is the closetest point 29 23 ; of (P0) 30 24 ; 31 ; EXAMPLES:25 ; @examples 32 26 ; IDL> print, neighbor(-105.15,40.02,[-0.07,100,50],[51.30,20,0], $ 33 27 ; distance=dis) … … 36 30 ; 105.684 206.125 160.228 37 31 ; 38 ; MODIFICATION HISTORY:39 ; Sebastien Masson (smasson@lodyc.jussieu.fr)32 ; @history 33 ; Sebastien Masson (smasson\@lodyc.jussieu.fr) 40 34 ; October 2003 41 35 ;- -
trunk/SRC/Interpolation/quadrilateral2square.pro
r59 r101 1 1 ;+ 2 ; NAME:quadrilateral2square3 2 ; 4 ; PURPOSE:warm (or map) an arbitrary quadrilateral onto a unit square3 ; @file_comments warm (or map) an arbitrary quadrilateral onto a unit square 5 4 ; according to the 4-point correspondences: 6 5 ; (x0,y0) -> (0,0) … … 13 12 ; mappings. see ref. bellow. 14 13 ; 15 ; CATEGORY:image/grid manipulation14 ; @categories image, grid manipulation 16 15 ; 17 ; CALLING SEQUENCE:16 ; @examples 18 17 ; 19 18 ; res = square2quadrilateral(x0,y0,x1,y1,x2,y2,x3,y3,xin,yin) 20 19 ; 21 ; INPUTS: 22 ; 23 ; x0,y0,x1,y1,x2,y2,x3,y3 the coordinates of the quadrilateral 20 ; @param x0in {in}{required} the coordinates of the quadrilateral 21 ; @param y0in {in}{required} the coordinates of the quadrilateral 22 ; @param x1in {in}{required} the coordinates of the quadrilateral 23 ; @param y1in {in}{required} the coordinates of the quadrilateral 24 ; @param x2in {in}{required} the coordinates of the quadrilateral 25 ; @param y2in {in}{required} the coordinates of the quadrilateral 26 ; @param x3in {in}{required} the coordinates of the quadrilateral 27 ; @param y3in {in}{required} the coordinates of the quadrilateral 24 28 ; (see above for correspondance with the unit square). Can be 25 29 ; scalar or array. (x0,y0), (x1,y1), (x2,y2) and (x3,y3) are 26 30 ; given in the anticlockwise order. 27 31 ; 28 ; xin,yin:the coordinates of the point(s) for which we want to do the 32 ; @param xxin {in}{required} the coordinates of the point(s) for which we want to do the 33 ; mapping. Can be scalar or array. 34 ; @param yyin {in}{required} the coordinates of the point(s) for which we want to do the 29 35 ; mapping. Can be scalar or array. 30 36 ; 31 ; KEYWORD PARAMETERS: 32 ; 33 ; /DOUBLE: use double precision to perform the computation 34 ; 35 ; OUTPUTS: 37 ; @returns 36 38 ; 37 39 ; (2,n) array: the new coodinates (xout, yout) of the (xin,yin) … … 41 43 ; elements of xin. 42 44 ; 43 ; COMMON BLOCKS:none 44 ; 45 ; SIDE EFFECTS: 46 ; 47 ; RESTRICTIONS: I think degenerated quadrilateral (e.g. flat of 45 ; @restrictions I think degenerated quadrilateral (e.g. flat of 48 46 ; twisted) is not work. This has to be tested. 49 47 ; 50 ; EXAMPLE:48 ; @examples 51 49 ; 52 50 ; IDL> splot,[0,5],[0,3],/nodata,xstyle=1,ystyle=1 … … 60 58 ; IDL> tracegrille, reform(inorg[0,*],11,11), reform(inorg[1,*],11,11),color=indgen(12)*20 61 59 ; 62 ; MODIFICATION HISTORY:63 ; Sebastien Masson (smasson @lodyc.jussieu.fr)60 ; @history 61 ; Sebastien Masson (smasson\@lodyc.jussieu.fr) 64 62 ; August 2003 65 63 ; Based on "Digital Image Warping" by G. Wolberg -
trunk/SRC/Interpolation/spl_fstdrv.pro
r69 r101 3 3 ;------------------------------------------------------------ 4 4 ;+ 5 ; NAME:spl_fstdrv6 5 ; 7 ; PURPOSE:SPL_FSTDRV returns the values of the first derivative of6 ; @file_comments SPL_FSTDRV returns the values of the first derivative of 8 7 ; the interpolating function at the points X2i. it is a double 9 8 ; precision array. … … 15 14 ; in a way that interpolated value are also in ascending order 16 15 ; 17 ; CATEGORY:16 ; @examples y2 = spl_fstdrv(x, y, yscd, x2) 18 17 ; 19 ; CALLING SEQUENCE: y2 = spl_fstdrv(x, y, yscd, x2) 20 ; 21 ; INPUTS: 22 ; 23 ; x: An n-element (at least 2) input vector that specifies the 18 ; @param x {in}{required} An n-element (at least 2) input vector that specifies the 24 19 ; tabulate points in ascending order. 25 20 ; 26 ; y:f(x) = y. An n-element input vector that specifies the values21 ; @param y {in}{required} f(x) = y. An n-element input vector that specifies the values 27 22 ; of the tabulated function F(Xi) corresponding to Xi. 28 23 ; 29 ; yscd:The output from SPL_INIT for the specified X and Y.24 ; @param yscd {in}{required} The output from SPL_INIT for the specified X and Y. 30 25 ; 31 ; x2:The input values for which the first derivative values are26 ; @param x2 {in}{required} The input values for which the first derivative values are 32 27 ; desired. X can be scalar or an array of values. 33 28 34 ; KEYWORD PARAMETERS: none 35 ; 36 ; OUTPUTS: 29 ; @returns 37 30 ; 38 31 ; y2: f'(x2) = y2. 39 32 ; 40 ; COMMON BLOCKS: none41 33 ; 42 ; SIDE EFFECTS: ? 43 ; 44 ; RESTRICTIONS: ? 45 ; 46 ; EXAMPLE: 47 ; 48 ; MODIFICATION HISTORY: 49 ; Sebastien Masson (smasson@lodyc.jussieu.fr): May 2005 34 ; @history 35 ; Sebastien Masson (smasson\@lodyc.jussieu.fr): May 2005 50 36 ;- 51 37 ;------------------------------------------------------------ -
trunk/SRC/Interpolation/spl_incr.pro
r69 r101 3 3 ;------------------------------------------------------------ 4 4 ;+ 5 ; NAME:spl_incr 6 ; 7 ; PURPOSE: 5 ; 6 ; @file_comments 8 7 ; 9 8 ; Given the arrays X and Y, which tabulate a function (with the X[i] … … 13 12 ; in a way that interpolated values are also monotonically increasing. 14 13 ; 15 ; CATEGORY: 16 ; 17 ; CALLING SEQUENCE: y2 = spl_incr(x, y, x2) 18 ; 19 ; INPUTS: 20 ; 21 ; x: An n-element (at least 2) input vector that specifies the 14 ; @examples y2 = spl_incr(x, y, x2) 15 ; 16 ; @param x1 {in}{required} An n-element (at least 2) input vector that specifies the 22 17 ; tabulate points in a strict ascending order. 23 18 ; 24 ; y:f(x) = y. An n-element input vector that specifies the values19 ; @param y1 {in}{required} f(x) = y. An n-element input vector that specifies the values 25 20 ; of the tabulated function F(Xi) corresponding to Xi. As f is 26 21 ; supposed to be monotonically increasing, y values must be 27 22 ; monotonically increasing. y can have equal consecutive values. 28 23 ; 29 ; x2:The input values for which the interpolated values are24 ; @param x2 {in}{required} The input values for which the interpolated values are 30 25 ; desired. Its values must be strictly monotonically increasing. 31 26 ; 32 ; KEYWORD PARAMETERS: 33 ; 34 ; YP0: The first derivative of the interpolating function at the 35 ; point X0. If YP0 is omitted, the second derivative at the 36 ; boundary is set to zero, resulting in a "natural spline." 37 ; 38 ; YPN_1: The first derivative of the interpolating function at the 39 ; point Xn-1. If YPN_1 is omitted, the second derivative at the 40 ; boundary is set to zero, resulting in a "natural spline." 41 ; 42 ; OUTPUTS: 27 ; 28 ; 29 ; 30 ; @returns 43 31 ; 44 32 ; y2: f(x2) = y2. Double precision array 45 33 ; 46 ; COMMON BLOCKS: none 47 ; 48 ; SIDE EFFECTS: ? 49 ; 50 ; RESTRICTIONS: 34 ; @restrictions 51 35 ; It might be possible that y2[i+1]-y2[i] has very small negative 52 36 ; values (amplitude smaller than 1.e-6)... 53 37 ; 54 ; EXAMPLE:38 ; @examples 55 39 ; 56 40 ; n = 100L … … 73 57 ; oplot,[0, n_elements(c)], [0, 0], linestyle = 1 74 58 ; 75 ; MODIFICATION HISTORY:76 ; Sebastien Masson (smasson @lodyc.jussieu.fr): May-Dec 200559 ; @history 60 ; Sebastien Masson (smasson\@lodyc.jussieu.fr): May-Dec 2005 77 61 ;- 78 62 ;------------------------------------------------------------ … … 112 96 END 113 97 98 ;+ 99 ; @keyword YP0 The first derivative of the interpolating function at the 100 ; point X0. If YP0 is omitted, the second derivative at the 101 ; boundary is set to zero, resulting in a "natural spline." 102 ; @keyword YPN_1 The first derivative of the interpolating function at the 103 ; point Xn-1. If YPN_1 is omitted, the second derivative at the 104 ; boundary is set to zero, resulting in a "natural spline." 105 ;- 114 106 FUNCTION spl_incr, x, y, x2, YP0 = yp0, YPN_1 = ypn_1 115 107 ; -
trunk/SRC/Interpolation/spl_keep_mean.pro
r69 r101 3 3 ;------------------------------------------------------------ 4 4 ;+ 5 ; NAME:spl_keep_mean 6 ; 7 ; PURPOSE: 5 ; @file_comments 8 6 ; 9 7 ; Given the arrays X and Y, which tabulate a function (with the X[i] … … 16 14 ; data equa to the original values) 17 15 ; 18 ; CATEGORY:16 ; @examples y2 = spl_keep_mean(x, y, x2) 19 17 ; 20 ; CALLING SEQUENCE: y2 = spl_keep_mean(x, y, x2) 21 ; 22 ; INPUTS: 23 ; 24 ; x: An n-element (at least 2) input vector that specifies the 18 ; @param x {in}{required} An n-element (at least 2) input vector that specifies the 25 19 ; tabulate points in a strict ascending order. 26 20 ; 27 ; y:an array with one element less than x. y[i] represents the21 ; @param yin {in}{required} an array with one element less than x. y[i] represents the 28 22 ; mean value between x[i] and x[i+1]. if /GE0 is activated, y must 29 23 ; have positive values. 30 24 ; 31 ; x2:The input values for which the interpolated values are25 ; @param x2 {in}{required} The input values for which the interpolated values are 32 26 ; desired. Its values must be strictly monotonically increasing. 33 27 ; 34 ; KEYWORD PARAMETERS:35 28 ; 36 ; /GE0:to force that y2 is always GE than 0. In that case, y must29 ; @keyword /GE0 to force that y2 is always GE than 0. In that case, y must 37 30 ; also be GE than 0. 38 31 ; 39 ; YP0:The first derivative of the interpolating function at the32 ; @keyword YP0 The first derivative of the interpolating function at the 40 33 ; point X0. If YP0 is omitted, the second derivative at the 41 34 ; boundary is set to zero, resulting in a "natural spline." 42 35 ; 43 ; YPN_1:The first derivative of the interpolating function at the36 ; @keyword YPN_1 The first derivative of the interpolating function at the 44 37 ; point Xn-1. If YPN_1 is omitted, the second derivative at the 45 38 ; boundary is set to zero, resulting in a "natural spline." 46 39 ; 47 ; OUTPUTS:40 ; @returns 48 41 ; 49 42 ; y2: the meean value between two consecutive values of x2. This 50 43 ; array has one element less than y2. y2 has double precision. 51 44 ; 52 ; COMMON BLOCKS: none 53 ; 54 ; SIDE EFFECTS: ? 55 ; 56 ; RESTRICTIONS: 45 ; @restrictions 57 46 ; It might be possible that y2 has very small negative values 58 47 ; (amplitude smaller than 1.e-6)... 59 48 ; 60 49 ; 61 ; EXAMPLE:50 ; @examples 62 51 ; 63 52 ; 12 monthly values of precipitations into daily values: … … 81 70 ; print, total(y2*(x2[1:n2-1]-x2[0:n2-2])) 82 71 ; 83 ; MODIFICATION HISTORY:84 ; Sebastien Masson (smasson @lodyc.jussieu.fr): May 200572 ; @history 73 ; Sebastien Masson (smasson\@lodyc.jussieu.fr): May 2005 85 74 ;- 86 75 ;------------------------------------------------------------ -
trunk/SRC/Interpolation/square2quadrilateral.pro
r59 r101 1 1 ;+ 2 ; NAME:square2quadrilateral 3 ; 4 ; PURPOSE:warm (or map) a unit square onto an arbitrary quadrilateral 2 ; 3 ; @file_comments warm (or map) a unit square onto an arbitrary quadrilateral 5 4 ; according to the 4-point correspondences: 6 5 ; (0,0) -> (x0,y0) … … 12 11 ; mappings. see ref. bellow. 13 12 ; 14 ; CATEGORY:image/grid manipulation15 ; 16 ; CALLING SEQUENCE:13 ; @categories image, grid manipulation 14 ; 15 ; @examples 17 16 ; 18 17 ; res = square2quadrilateral(x0,y0,x1,y1,x2,y2,x3,y3[,xin,yin]) 19 18 ; 20 ; INPUTS: 21 ; 22 ; x0,y0,x1,y1,x2,y2,x3,y3 the coordinates of the quadrilateral 23 ; (see above for correspondance with the unit square). Can be 24 ; scalar or array. (x0,y0), (x1,y1), (x2,y2) and (x3,y3) are 25 ; given in the anticlockwise order. 26 ; 27 ; xin,yin:the coordinates of the point(s) for which we want to do the 19 FUNCTION square2quadrilateral, x0in, y0in, x1in, y1in, x2in, y2in, x3in, y3in, xxin, yyin 20 ; @param x0in {in}{required} the coordinates of the quadrilateral 21 ; (see above for correspondance with the unit square). Can be 22 ; scalar or array. (x0,y0), (x1,y1), (x2,y2) and (x3,y3) are 23 ; given in the anticlockwise order. 24 ; @param y0in {in}{required} the coordinates of the quadrilateral 25 ; (see above for correspondance with the unit square). Can be 26 ; scalar or array. (x0,y0), (x1,y1), (x2,y2) and (x3,y3) are 27 ; given in the anticlockwise order. 28 ; @param x1in {in}{required} the coordinates of the quadrilateral 29 ; (see above for correspondance with the unit square). Can be 30 ; scalar or array. (x0,y0), (x1,y1), (x2,y2) and (x3,y3) are 31 ; given in the anticlockwise order. 32 ; @param y1in {in}{required} the coordinates of the quadrilateral 33 ; (see above for correspondance with the unit square). Can be 34 ; scalar or array. (x0,y0), (x1,y1), (x2,y2) and (x3,y3) are 35 ; given in the anticlockwise order. 36 ; @param x2in {in}{required} the coordinates of the quadrilateral 37 ; (see above for correspondance with the unit square). Can be 38 ; scalar or array. (x0,y0), (x1,y1), (x2,y2) and (x3,y3) are 39 ; given in the anticlockwise order. 40 ; @param y2in {in}{required} the coordinates of the quadrilateral 41 ; (see above for correspondance with the unit square). Can be 42 ; scalar or array. (x0,y0), (x1,y1), (x2,y2) and (x3,y3) are 43 ; given in the anticlockwise order. 44 ; @param x3in {in}{required} the coordinates of the quadrilateral 45 ; (see above for correspondance with the unit square). Can be 46 ; scalar or array. (x0,y0), (x1,y1), (x2,y2) and (x3,y3) are 47 ; given in the anticlockwise order. 48 ; @param y3in {in}{required} the coordinates of the quadrilateral 49 ; (see above for correspondance with the unit square). Can be 50 ; scalar or array. (x0,y0), (x1,y1), (x2,y2) and (x3,y3) are 51 ; given in the anticlockwise order. 52 ; 53 ; @param xxin {in}{required} the coordinates of the point(s) for which we want to do the 28 54 ; mapping. Can be scalar or array. 29 ; 30 ; KEYWORD PARAMETERS: 31 ; 32 ; /DOUBLE: use double precision to perform the computation 33 ; 34 ; OUTPUTS: 55 ; @param yyin {in}{required} the coordinates of the point(s) for which we want to do the 56 ; mapping. Can be scalar or array. 57 ; 58 ; @returns 35 59 ; 36 60 ; (2,n) array: the new coodinates (xout, yout) of the (xin,yin) … … 42 66 ; matrix A which is used for the inverse transformation. 43 67 ; 44 ; COMMON BLOCKS:none 45 ; 46 ; SIDE EFFECTS: 47 ; 48 ; RESTRICTIONS: I think degenerated quadrilateral (e.g. flat of 68 ; 69 ; @restrictions I think degenerated quadrilateral (e.g. flat of 49 70 ; twisted) is not work. This has to be tested. 50 71 ; 51 ; EXAMPLE:72 ; @examples 52 73 ; 53 74 ; IDL> splot,[0,5],[0,3],/nodata,xstyle=1,ystyle=1 … … 58 79 ; IDL> tracegrille, reform(out[0,*],11,11), reform(out[1,*],11,11),color=indgen(12)*20 59 80 ; 60 ; MODIFICATION HISTORY:61 ; Sebastien Masson (smasson @lodyc.jussieu.fr)81 ; @history 82 ; Sebastien Masson (smasson\@lodyc.jussieu.fr) 62 83 ; August 2003 63 84 ; Based on "Digital Image Warping" by G. Wolberg -
trunk/SRC/Interpolation/testinterp.pro
r59 r101 1 ;+ 2 ;- 1 3 PRO testinterp 2 4
Note: See TracChangeset
for help on using the changeset viewer.