Changeset 118 for trunk/SRC/Interpolation
- Timestamp:
- 06/27/06 17:47:06 (18 years ago)
- Location:
- trunk/SRC/Interpolation
- Files:
-
- 22 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SRC/Interpolation/angle.pro
- Property svn:keywords set to Id
r114 r118 3 3 ; @file_comments north stereographic polar projection 4 4 ; 5 ; @keyword /DOUBLE use double precision (default is float) 5 ; @param plam {in}{required} 6 ; 7 ; @param pphi {in}{required} 8 ; 9 ; @keyword /DOUBLE use double precision (default is float) 6 10 ; 7 11 ; @returns … … 26 30 ; 98-06 (G. Madec) 27 31 ; Feb 2005: IDL adaptation S. Masson 32 ; 33 ; @version $Id$ 34 ; 28 35 ;- 29 36 ;--------- … … 54 61 ; glamf, gphif: longitudes and latitudes at F-points 55 62 ; 63 ; @param gcosu {in}{required} 64 ; @param gsinu {in}{required} 65 ; @param gcosv {in}{required} 66 ; @param gsinv {in}{required} 67 ; @param gcost {in}{required} 68 ; @param gsint {in}{required} 56 69 ; @keyword IODIRECTORY the directory path where is located fileocemesh 57 ; @keyword 70 ; @keyword /DOUBLE use double precision (default is float) 58 71 ;- 59 72 ;--------- -
trunk/SRC/Interpolation/clickincell.pro
- Property svn:keywords set to Id
r114 r118 44 44 ; Sebastien Masson (smasson\@lodyc.jussieu.fr) 45 45 ; August 2003 46 ; 47 ; @version $Id$ 48 ; 46 49 ; 47 50 ;- -
trunk/SRC/Interpolation/compute_fromirr_bilinear_weigaddr.pro
- Property svn:keywords set to Id
r110 r118 6 6 ; @categories interpolation 7 7 ; 8 ; @param olonin {in}{required} longitudeof the input data 9 ; @param olat {in}{required} latitude of the input data 10 ; @param omsk {in}{required} land/se mask of the input data 11 ; @param alonin {in}{required} longitude of the output data 12 ; @param alat {in}{required} latitude of the output data 13 ; @param amsk {in}{required} land/se mask of the output data 14 ; 15 ; @returns 16 ; weig, addr: 2D arrays, weig and addr are the weight and addresses used to 17 ; perform the interpolation: 18 ; dataout = total(weig*datain[addr], 1) 19 ; dataout = reform(dataout, jpia, jpja, /over) 8 ; @param olonin {in}{required} longitudeof the input data 9 ; @param olat {in}{required} latitude of the input data 10 ; @param omsk {in}{required} land/se mask of the input data 11 ; @param alonin {in}{required} longitude of the output data 12 ; @param alat {in}{required} latitude of the output data 13 ; @param amsk {in}{required} land/sea mask of the output data 14 ; 15 ; @param weig {out} 16 ; @param addr {out} 17 ; 2D arrays, weig and addr are the weight and addresses used to 18 ; perform the interpolation: 19 ; dataout = total(weig*datain[addr], 1) 20 ; dataout = reform(dataout, jpia, jpja, /over) 20 21 ; 21 22 ; @restrictions … … 34 35 ; June 2006: Sebastien Masson (smasson\@lodyc.jussieu.fr) 35 36 ; 37 ; 38 ; @version $Id$ 39 ; 36 40 ;- 37 41 ; -
trunk/SRC/Interpolation/compute_fromreg_bilinear_weigaddr.pro
- Property svn:keywords set to Id
r114 r118 5 5 ; @categories interpolation 6 6 ; 7 ; 8 ; 9 ; 10 ; 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 11 ; 12 12 ; @keyword /NONORTHERNLINE activate if you don't whant to take into … … 16 16 ; interpolation. 17 17 ; 18 ; @returns 19 ; weig, addr: 2D arrays, weig and addr are the weight and addresses used to 20 ; perform the interpolation: 21 ; dataout = total(weig*datain[addr], 1) 22 ; dataout = reform(dataout, jpio, jpjo, /over) 18 ; @param weig {out} 19 ; @param addr {out} 20 ; 2D arrays, weig and addr are the weight and addresses used to 21 ; perform the interpolation: 22 ; dataout = total(weig*datain[addr], 1) 23 ; dataout = reform(dataout, jpio, jpjo, /over) 23 24 ; 24 25 ; @restrictions … … 34 35 ; November 2005: Sebastien Masson (smasson\@lodyc.jussieu.fr) 35 36 ; 37 ; @version $Id$ 38 ; 36 39 ;- 37 40 ; -
trunk/SRC/Interpolation/compute_fromreg_imoms3_weigaddr.pro
- Property svn:keywords set to Id
r114 r118 6 6 ; @categories interpolation 7 7 ; 8 ; @param alonin {in}{required} longitude of the input data 9 ; @param alatin {in}{required} latitude of the input data 10 ; @param olonin {in}{required} longitude of the output data 11 ; @param olat {in}{required} latitude of the output data 12 ; 13 ; @keyword /NONORTHERNLINE and /NOSOUTHERNLINE activate if you don't whant to take into 14 ; account the northen/southern line of the input data when perfoming the 15 ; interpolation. 16 ; 17 ; @returns 18 ; weig, addr: 2D arrays, weig and addr are the weight and addresses used to 19 ; perform the interpolation: 20 ; dataout = total(weig*datain[addr], 1) 21 ; dataout = reform(dataout, jpio, jpjo, /over) 8 ; @param alonin {in}{required} longitude of the input data 9 ; @param alatin {in}{required} latitude of the input data 10 ; @param olonin {in}{required} longitude of the output data 11 ; @param olat {in}{required} latitude of the output data 12 ; 13 ; @keyword /NONORTHERNLINE 14 ; @keyword /NOSOUTHERNLINE 15 ; activate if you don't whant to take into account the northen/southern line 16 ; of the input data when perfoming the interpolation. 17 ; 18 ; @param weig {out} 19 ; @param addr {out} 20 ; 2D arrays, weig and addr are the weight and addresses used to 21 ; perform the interpolation: 22 ; dataout = total(weig*datain[addr], 1) 23 ; dataout = reform(dataout, jpio, jpjo, /over) 22 24 ; 23 25 ; @restrictions … … 36 38 ; November 2005: Sebastien Masson (smasson\@lodyc.jussieu.fr) 37 39 ; March 2006: works for rectangular grids 40 ; 41 ; @version $Id$ 42 ; 38 43 ;- 39 44 ; -
trunk/SRC/Interpolation/cutpar.pro
- Property svn:keywords set to Id
r114 r118 8 8 ; res = cutpar(x0, y0, x1, y1, x2, y2, x3, y3, n) 9 9 ; 10 ; @param x0,y0 {in}{required} 1d arrays of p elements, giving the edge positions. The 10 ; @param x0 {in}{required} 11 ; @param y0 {in}{required} 12 ; @param x1 {in}{required} 13 ; @param y1 {in}{required} 14 ; @param x2 {in}{required} 15 ; @param y2 {in}{required} 16 ; @param x3 {in}{required} 17 ; @param y3 {in}{required} 18 ; 1d arrays of p elements, giving the edge positions. The 11 19 ; edges must be given as in plot to traw the parallelogram. (see 12 20 ; example). 13 ; @param n {in}{required} each parallelogram will be cutted in n^2 pieces14 21 ; 15 ; @ keyword /endpoints see outputs22 ; @param n {in}{required} each parallelogram will be cutted in n^2 pieces 16 23 ; 17 ; @keyword /onsphere to specify that the points are located on a 24 ; @keyword /endpoints see outputs 25 ; 26 ; @keyword /onsphere to specify that the points are located on a 18 27 ; sphere. In this case, x and y corresponds to longitude and 19 28 ; latitude in degrees. 20 29 ; 21 30 ; @returns 22 ; - defaut: 3d array(2,n^2,p) giving the center position of each31 ; - defaut: 3d array(2,n^2,p) giving the center position of each 23 32 ; piece of the parallelograms 24 ; - /endpoints: 3d array(2,(n+1)^2,p) giving the edge positions33 ; - /endpoints: 3d array(2,(n+1)^2,p) giving the edge positions 25 34 ; of each piece of the parallelograms 26 35 ; … … 29 38 ; @examples 30 39 ; 31 ; x0 = [2,6,2]32 ; y0 = [0,2,6]33 ; x1 = [3,8,4]34 ; y1 = [4,4,6]35 ; x2 = [1,6,4]36 ; y2 = [5,6,8]37 ; x3 = [0,4,2]38 ; y3 = [1,4,8]39 ; n = 440 ; splot, [0,10], [0,10], xstyle = 1, ystyle = 1,/nodata41 ; for i=0,2 do oplot, [x0[i],x1[i],x2[i],x3[i],x0[i]],[y0[i],y1[i],y2[i],y3[i],y0[i]]42 ; res=cutpar(x0, y0, x1, y1, x2, y2, x3, y3, n)43 ; for i=0,2 do oplot, [res[0,*,i]], [res[1,*,i]], color = 20+10*i, psym = 1, thick = 340 ; IDL> x0 = [2,6,2] 41 ; IDL> y0 = [0,2,6] 42 ; IDL> x1 = [3,8,4] 43 ; IDL> y1 = [4,4,6] 44 ; IDL> x2 = [1,6,4] 45 ; IDL> y2 = [5,6,8] 46 ; IDL> x3 = [0,4,2] 47 ; IDL> y3 = [1,4,8] 48 ; IDL> n = 4 49 ; IDL> splot, [0,10], [0,10], xstyle = 1, ystyle = 1,/nodata 50 ; IDL> for i=0,2 do oplot, [x0[i],x1[i],x2[i],x3[i],x0[i]],[y0[i],y1[i],y2[i],y3[i],y0[i]] 51 ; IDL> res=cutpar(x0, y0, x1, y1, x2, y2, x3, y3, n) 52 ; IDL> for i=0,2 do oplot, [res[0,*,i]], [res[1,*,i]], color = 20+10*i, psym = 1, thick = 3 44 53 ; 45 54 ; @history 46 55 ; S. Masson (smasson\@lodyc.jussieu.fr) 47 56 ; July 5th, 2002 57 ; 58 ; @version $Id$ 59 ; 48 60 ;- 49 61 FUNCTION cutpar, x0, y0, x1, y1, x2, y2, x3, y3, n, endpoints = endpoints, onsphere = onsphere -
trunk/SRC/Interpolation/cutsegment.pro
- Property svn:keywords set to Id
r114 r118 8 8 ; res = cutsegment(x0, y0, x1, y1, n) 9 9 ; 10 ; @param x0,y0 and x1,y1 {in}{required} 1d arrays of p elements, the coordinates of 11 ; the endpoints of the p segmements 12 ; @param n {in}{required} the number of pieces we want to cut each segment 10 ; @param x0 {in}{required} 11 ; @param y0 {in}{required} 12 ; @param x1 {in}{required} 13 ; @param y1 {in}{required} 14 ; 1d arrays of p elements, the coordinates of the endpoints of the p segments 13 15 ; 16 ; @param n {in}{required} the number of pieces we want to cut each segment 14 17 ; 15 ; @keyword 18 ; @keyword /endpoints see ouputs 16 19 ; 17 ; @keyword 20 ; @keyword /onsphere to specify that the points are located on a 18 21 ; sphere. In this case, x and y corresponds to longitude and 19 22 ; latitude in degrees. … … 41 44 ; S. Masson (smasson\@lodyc.jussieu.fr) 42 45 ; July 5th, 2002 46 ; 47 ; @version $Id$ 48 ; 43 49 ;- 44 50 FUNCTION cutsegment, x0, y0, x1, y1, n, endpoints = endpoints, onsphere = onsphere -
trunk/SRC/Interpolation/extrapolate.pro
- Property svn:keywords set to Id
r114 r118 1 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. 2 ; @file_comments extrapolate data (zinput) where maskinput eq 0 by filling 3 ; step by step the coastline points with the mean value of the 8 neighbourgs. 4 ; 5 ; @param zinput {in}{required} 6 ; data to be extrapolate 7 ; 8 ; @param maskinput {in}{required} 9 ; 10 ; @param nb_iteration {in}{optional} 11 ; number of iteration 12 ; 13 ; @keyword x_periodic 14 ; @keyword MINVAL 15 ; @keyword MAXVAL 16 ; 17 ; @version $Id$ 4 18 ; 5 19 ;- -
trunk/SRC/Interpolation/fromirr.pro
- Property svn:keywords set to Id
r113 r118 37 37 ; @examples 38 38 ; 39 ; tncep = fromirr('bilinear', topa, glamt, gphit, tmask[*,*,0], lonout, latout, mskout)39 ; IDL> tncep = fromirr('bilinear', topa, glamt, gphit, tmask[*,*,0], lonout, latout, mskout) 40 40 ; 41 41 ; or 42 42 ; 43 ; t1ncep = fromirr('bilinear', topa, glamt, gphit, tmask[*,*,0], lonout, latout, mskout $43 ; IDL> t1ncep = fromirr('bilinear', topa, glamt, gphit, tmask[*,*,0], lonout, latout, mskout $ 44 44 ; , WEIG = a, ADDR = b) 45 ; help, a, b46 ; t2ncep = fromirr('bilinear', topa, WEIG = a, ADDR = b)45 ; IDL> help, a, b 46 ; IDL> t2ncep = fromirr('bilinear', topa, WEIG = a, ADDR = b) 47 47 ; 48 48 ; @history 49 49 ; June 2006: Sebastien Masson (smasson\@lodyc.jussieu.fr) 50 50 ; 51 ; @version $Id$ 52 ; 51 53 ;- 52 54 ;---------------------------------------------------------- -
trunk/SRC/Interpolation/fromreg.pro
- Property svn:keywords set to Id
r114 r118 11 11 ; dataout = fromreg(method, datain [, lonin, latin, lonout, latout]) 12 12 ; 13 ; 13 ; @param method {in}{required} a string defining the interpolation method. 14 14 ; must be 'bilinear' or 'imoms3' 15 ; 16 ; 17 ; 18 ; 19 ; @param lonout {in}{required} 1D or 2D array defining the latitude of the output data15 ; @param datain {in}{required} a 2D array the input data to interpolate 16 ; @param lonin {in}{required} 1D or 2D array defining the longitude of the input data 17 ; @param latin {in}{required} 1D or 2D array defining the latitude of the input data 18 ; @param lonout {in}{required} 1D or 2D array defining the longitude of the output data 19 ; @param latout {in}{required} 1D or 2D array defining the latitude of the output data 20 20 ; 21 ; @keyword 22 ; @keyword 21 ; @keyword WEIG (see ADDR) 22 ; @keyword ADDR 2D arrays, weig and addr are the weight and addresses used to 23 23 ; perform the interpolation: 24 24 ; dataout = total(weig*datain[addr], 1) … … 29 29 ; case, lonin, latin, lonout and latout are not necessary. 30 30 ; 31 ; @keyword /NONORTHERNLINE and /NOSOUTHERNLINE activate if you don't whant to take into 32 ; account the northen/southern line of the input data when perfoming the 33 ; interpolation. 31 ; @keyword /NONORTHERNLINE 32 ; @keyword /NOSOUTHERNLINE 33 ; activate if you don't whant to take into account the northen/southern line 34 ; of the input data when perfoming the interpolation. 34 35 ; 35 36 ; @returns 2D array: the interpolated data … … 40 41 ; @examples 41 42 ; 42 ; topa = fromreg('bilinear', tncep, xncep, yncep, glamt, gphit)43 ; IDL> topa = fromreg('bilinear', tncep, xncep, yncep, glamt, gphit) 43 44 ; 44 45 ; or 45 46 ; 46 ; t1opa = fromreg('bilinear', t1ncep, xncep, yncep, glamt, gphit, WEIG = a, ADDR = b)47 ; help, a, b48 ; t2opa = fromreg('bilinear', t2ncep, xncep, WEIG = a, ADDR = b)47 ; IDL> t1opa = fromreg('bilinear', t1ncep, xncep, yncep, glamt, gphit, WEIG = a, ADDR = b) 48 ; IDL> help, a, b 49 ; IDL> t2opa = fromreg('bilinear', t2ncep, xncep, WEIG = a, ADDR = b) 49 50 ; 50 51 ; @history 51 52 ; November 2005: Sebastien Masson (smasson\@lodyc.jussieu.fr) 52 ; 53 ; 54 ; @version $Id$ 55 ; 53 56 ;- 54 57 ;---------------------------------------------------------- -
trunk/SRC/Interpolation/get_gridparams.pro
- Property svn:keywords set to Id
r114 r118 1 1 ;+ 2 2 ; 3 ; @file_comments 3 ; @file_comments 4 4 ; 1) extract from a NetCDF file the longitude, latidude, and their dimensions 5 ; and make sure it is 1D or 2D arrays 6 ; 7 ; or 2) given longitude and latitude arrays get their dimensions and make sure8 ; they are 1D or 2D arrays5 ; and make sure it is 1D or 2D arrays 6 ; 7 ; or 2) given longitude and latitude arrays get their dimensions and make 8 ; sure they are 1D or 2D arrays 9 9 ; 10 10 ; @categories interpolation 11 11 ; 12 ; @examples 13 ; 12 ; @examples 13 ; 14 14 ; 1) get_gridparams, file, lonname, latname, lon, lat, jpi, jpj, n_dimensions 15 15 ; 16 ; or 16 ; or 17 17 ; 18 18 ; 2) get_gridparams, lon, lat, jpi, jpj, n_dimensions 19 19 ; 20 ; 1) 21 ; @param in1 {in}{required} 22 ; @param in2 {in}{required}the name of the variable that contains the longitude in the NetCDF file23 ; @param in3 {in}{required}the name of the variable that contains the latitude in the NetCDF file24 ; @param in4{out} the number of points in the longitudinal direction25 ; @param in5{out} the number of points in the latitudinal direction20 ; 1) 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 26 ; @param in6 {out} the variable that will contain the longitudes 27 ; @param in7{out} the variable that will contain the latitudes28 ; 29 ; 30 ; or 31 ; 32 ; 2) 33 ; @param in1 {in}{required} 1d or 2D arrays defining longitudes and latitudes.34 ; @param in2 {in}{required} 1d or 2D arrays defining longitudes and latitudes.35 ; Note that these arrays are also outputs and can therefore be modified. 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) 29 ; 30 ; or 31 ; 32 ; 2) 33 ; @param in1 {in}{required} 1d or 2D arrays defining longitudes and latitudes. 34 ; @param in2 {in}{required} 1d or 2D arrays defining longitudes and latitudes. 35 ; Note that these arrays are also outputs and can therefore be modified. 36 36 37 37 ; @param in1 {out} the variable that will contain the longitudes 38 ; @param in2{out} the variable that will contain the latitudes39 ; @param in3{in} the number of points in the longitudinal direction40 ; @param in4{in} the number of points in the latitudinal direction41 ; 38 ; @param in2 {out} the variable that will contain the latitudes 39 ; @param in3 {in} the number of points in the longitudinal direction 40 ; @param in4 {in} the number of points in the latitudinal direction 41 ; @param in5 {in} 1 or 2 to specify if lon and lat should be 1D (jpi or jpj) 42 42 ; arrays or 2D arrays (jpi,jpj). Note that of n_dimensions = 1, then the 43 43 ; grid must be regular (each longitudes must be the same for all latitudes 44 ; and each latitudes should be the sae for all longitudes). 45 ; 46 ; @examples 47 ; 48 ; 1) ncdf_get_gridparams, 'coordinates_ORCA_R05.nc', 'glamt', 'gphit' $ 44 ; and each latitudes should be the sae for all longitudes). 45 ; 46 ; @keyword /DOUBLE use double precision to perform the computation 47 ; 48 ; @examples 49 ; 50 ; 1) IDL> ncdf_get_gridparams, 'coordinates_ORCA_R05.nc', 'glamt', 'gphit' $ 49 51 ; , olon, olat, jpio, jpjo, 2 50 52 ; 51 ; 2) ncdf_get_gridparams, olon, olat, jpio, jpjo, 253 ; 2) IDL> ncdf_get_gridparams, olon, olat, jpio, jpjo, 2 52 54 ; 53 55 ; @history 54 ; November 2005: Sebastien Masson (smasson\@lodyc.jussieu.fr) 55 ; 56 ; November 2005: Sebastien Masson (smasson\@lodyc.jussieu.fr) 57 ; 58 ; @version $Id$ 59 ; 56 60 ;- 57 61 ; … … 59 63 ;---------------------------------------------------------- 60 64 ; 61 62 65 PRO get_gridparams, in1, in2, in3, in4, in5, in6, in7, in8, DOUBLE = double 63 66 ; file, lonname, latname, lon, lat, jpi, jpj, n_dimensions … … 70 73 8:BEGIN 71 74 ; get longitude and latitude 72 IF file_test(in1) EQ 0 THEN BEGIN 75 IF file_test(in1) EQ 0 THEN BEGIN 73 76 print, 'file ' + in1 + ' does not exist' 74 77 stop … … 77 80 ncdf_varget, cdfido, in2, lon 78 81 ncdf_varget, cdfido, in3, lat 79 ncdf_close, cdfido 82 ncdf_close, cdfido 80 83 n_dimensions = in8 81 84 END 82 5:BEGIN 85 5:BEGIN 83 86 lon = temporary(in1) 84 87 lat = temporary(in2) 85 88 n_dimensions = in5 86 89 END 87 ELSE:BEGIN 90 ELSE:BEGIN 88 91 print, 'Bad nimber of input parameters' 89 92 stop … … 93 96 sizelon = size(lon) 94 97 sizelat = size(lat) 95 CASE 1 OF 98 CASE 1 OF 96 99 ;------- 97 100 ; lon and lat are 1D arrays 98 101 ;------- 99 sizelon[0] EQ 1 AND sizelat[0] EQ 1:BEGIN 102 sizelon[0] EQ 1 AND sizelat[0] EQ 1:BEGIN 100 103 ; get jpi and jpj 101 104 jpi = sizelon[1] 102 105 jpj = sizelat[1] 103 106 ; make sure that lon and lat have the good number of dimensions 104 CASE n_dimensions OF 107 CASE n_dimensions OF 105 108 1: 106 109 2:BEGIN … … 115 118 ; lon is 2D array and lat is 1D array 116 119 ;------- 117 sizelon[0] EQ 2 AND sizelat[0] EQ 1:BEGIN 120 sizelon[0] EQ 2 AND sizelat[0] EQ 1:BEGIN 118 121 ; get jpi and jpj 119 122 jpi = sizelon[1] … … 121 124 IF jpj NE n_elements(lat) THEN stop 122 125 ; make sure that lon and lat have the good number of dimensions 123 CASE n_dimensions OF 124 1:BEGIN 125 IF array_equal(lon, lon[*, 0] # replicate(1, jpj)) NE 1 THEN BEGIN 126 CASE n_dimensions OF 127 1:BEGIN 128 IF array_equal(lon, lon[*, 0] # replicate(1, jpj)) NE 1 THEN BEGIN 126 129 print, 'Longitudes are not the same for all latitudes, imposible to extract a 1D array of the longitudes' 127 130 stop … … 136 139 ; lon is 1D array and lat is 2D array 137 140 ;------- 138 sizelon[0] EQ 1 AND sizelat[0] EQ 2:BEGIN 141 sizelon[0] EQ 1 AND sizelat[0] EQ 2:BEGIN 139 142 ; get jpi and jpj 140 143 jpi = sizelat[1] … … 142 145 IF jpi NE n_elements(lon) THEN stop 143 146 ; make sure that lon and lat have the good number of dimensions 144 CASE n_dimensions OF 145 1:BEGIN 146 IF array_equal(lat, replicate(1, jpi) # lat[0, *]) NE 1 THEN BEGIN 147 CASE n_dimensions OF 148 1:BEGIN 149 IF array_equal(lat, replicate(1, jpi) # lat[0, *]) NE 1 THEN BEGIN 147 150 print, 'Latitudes are not the same for all longitudes, imposible to extract a 1D array of the latitudes' 148 151 stop … … 157 160 ; lon and lat are 2D arrays 158 161 ;------- 159 sizelon[0] EQ 2 AND sizelat[0] EQ 2:BEGIN 162 sizelon[0] EQ 2 AND sizelat[0] EQ 2:BEGIN 160 163 ; get jpi and jpj 161 164 IF array_equal(sizelon[1:2], sizelat[1:2]) NE 1 THEN stop 162 165 jpi = sizelon[1] 163 jpj = sizelon[2] 164 ; make sure that lon and lat have the good number of dimensions 165 CASE n_dimensions OF 166 1:BEGIN 167 IF array_equal(lon, lon[*, 0] # replicate(1, jpj)) NE 1 THEN BEGIN 166 jpj = sizelon[2] 167 ; make sure that lon and lat have the good number of dimensions 168 CASE n_dimensions OF 169 1:BEGIN 170 IF array_equal(lon, lon[*, 0] # replicate(1, jpj)) NE 1 THEN BEGIN 168 171 print, 'Longitudes are not the same for all latitudes, imposible to extract a 1D array of the longitudes' 169 172 stop 170 173 ENDIF 171 174 lon = lon[*, 0] 172 IF array_equal(lat, replicate(1, jpi) # reform(lat[0, *])) NE 1 THEN BEGIN 175 IF array_equal(lat, replicate(1, jpi) # reform(lat[0, *])) NE 1 THEN BEGIN 173 176 print, 'Latitudes are not the same for all longitudes, imposible to extract a 1D array of the latitudes' 174 177 stop … … 189 192 ; double keyword 190 193 ;------- 191 if keyword_set(double) then BEGIN 194 if keyword_set(double) then BEGIN 192 195 lon = double(temporary(lon)) 193 196 lat = double(temporary(lat)) -
trunk/SRC/Interpolation/imoms3.pro
- Property svn:keywords set to Id
r114 r118 1 1 ;+ 2 2 ; 3 ; 4 ; @param xin {in}{required} 5 ; 6 ; @version $Id$ 7 ; 3 8 ;- 4 9 FUNCTION imoms3, xin -
trunk/SRC/Interpolation/inquad.pro
- Property svn:keywords set to Id
r114 r118 5 5 ; 6 6 ; @examples 7 ; 8 ; res = inquad(x, y, x1, y1, x2, y2, x3, y3, x4, y4) 9 ; 10 ; @param x y {in}{required} the coordinates of the point we want to know where it 11 ; is. Must be a scalar if /onsphere activated else can be scalar 12 ; or array. 13 ; 14 ; @param x1 y1 x2 y2 x3 y3 x4 y4 {in}{required} the coordinates of the 15 ; quadrilateral given in the CLOCKWISE order. Scalar or array. 16 ; 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 7 ; IDL> res = inquad(x, y, x1, y1, x2, y2, x3, y3, x4, y4) 8 ; 9 ; @param x {in}{required} 10 ; @param y {in}{required} 11 ; the coordinates of the point we want to know where it is. 12 ; Must be a scalar if /onsphere activated else can be scalar or array. 13 ; 14 ; @param x1 {in}{required} 15 ; @param y1 {in}{required} 16 ; @param x2 {in}{required} 17 ; @param y2 {in}{required} 18 ; @param x3 {in}{required} 19 ; @param y3 {in}{required} 20 ; @param x4 {in}{required} 21 ; @param y4 {in}{required} 22 ; the coordinates of the quadrilateral given in the CLOCKWISE order. 23 ; Scalar or array. 24 ; 25 ; @keyword /DOUBLE use double precision to perform the computation 26 ; 27 ; @keyword /ONSPHERE to specify that the quadilateral are on a sphere and 21 28 ; that teir coordinates are longitude-latitude coordinates. In this 22 29 ; case, est-west periodicity, poles singularity and other pbs … … 24 31 ; automatically. 25 32 ; 26 ; @keyword ZOOMRADIUS :the zoom (circle centred on the (x,y) with a radius of33 ; @keyword ZOOMRADIUS the zoom (circle centred on the (x,y) with a radius of 27 34 ; zoomradius degree where we look for the the quadrilateral which; contains the (x,y) point) used for the satellite projection 28 35 ; when /onsphere is activated. Default is 4 and seems to be the … … 30 37 ; larger than 5 degrees. 31 38 ; 32 ; @keyword /NOPRINT to suppress the print messages. 39 ; @keyword /NOPRINT to suppress the print messages. 40 ; 41 ; @keyword NEWCOORD 33 42 ; 34 43 ; @returns … … 42 51 ; @examples 43 52 ; 44 ; 45 ; 46 ; 47 ; 48 ; 49 ; 50 ; 51 ; 52 ; 53 ; 54 ; 55 ; 56 ; 57 ; 53 ; IDL> x = 1.*[1, 2, 6, 7, 3] 54 ; IDL> y = 1.*[1, 3, 3, 4, 7] 55 ; IDL> x1 = 1.*[0,4,2] 56 ; IDL> y1 = 1.*[1,4,8] 57 ; IDL> x2 = 1.*[1,6,4] 58 ; IDL> y2 = 1.*[5,6,8] 59 ; IDL> x3 = 1.*[3,8,4] 60 ; IDL> y3 = 1.*[4,4,6] 61 ; IDL> x4 = 1.*[2,6,2] 62 ; IDL> y4 = 1.*[0,2,6] 63 ; IDL> splot, [0,10], [0,10], xstyle = 1, ystyle = 1,/nodata 64 ; IDL> for i=0,2 do oplot, [x4[i],x1[i],x2[i],x3[i],x4[i]],[y4[i],y1[i],y2[i],y3[i],y4[i]] 65 ; IDL> oplot, x, y, color = 20, psym = 1, thick = 2 66 ; IDL> print, inquad(x, y, x1, y1, x2, y2, x3, y3, x4, y4) 58 67 ; 59 68 ; On a sphere see clickincell.pro... … … 63 72 ; August 2003 64 73 ; Based on Convert_clic_ij.pro written by Gurvan Madec 74 ; 75 ; @version $Id$ 65 76 ; 66 77 ;- -
trunk/SRC/Interpolation/inrecgrid.pro
- Property svn:keywords set to Id
r114 r118 10 10 ; res = inrecgrid(xin, yin, left, bottom) 11 11 ; 12 ; 13 ; 14 ; left {in}{required} a 1d, monotonically increasing array, the position of the15 ; 16 ; @param bottom {in}{required} a 1d, monotonically increasing array, the position of the17 ; 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 ; @param left {in}{required} a 1d, monotonically increasing array, 15 ; the position of the "left" border of each cell. 16 ; @param bottom {in}{required} a 1d, monotonically increasing array, 17 ; the position of the "bottom" border of each cell. 18 18 ; 19 ; 20 ; @keyword /output2d to get the output as a 2d array (2,n_elements(x1d)), 19 ; @keyword /output2d to get the output as a 2d array (2,n_elements(x1d)), 21 20 ; with res[0,*] the x index accoring to the 1d array defined by 22 21 ; left and res[1,*] the y index accoring to the 1d array defined by 23 22 ; bottom. 24 23 ; 25 ; @keyword 24 ; @keyword checkout=[rbgrid,ubgrid] specify the right and upper bondaries of 26 25 ; the grid and check if some points are out. 27 26 ; … … 46 45 ; July 3rd, 2002 47 46 ; October 3rd, 2003: use value_locate 47 ; 48 ; @version $Id$ 49 ; 48 50 ;- 49 51 -
trunk/SRC/Interpolation/ll_narcs_distances.pro
- Property svn:keywords set to Id
r114 r118 62 62 ; Sebastien Masson (smasson\@lodyc.jussieu.fr) 63 63 ; August 2005 64 ; 65 ; @version $Id$ 66 ; 64 67 ;- 65 68 -
trunk/SRC/Interpolation/map_npoints.pro
- Property svn:keywords set to Id
r114 r118 12 12 ; 13 13 ; @examples 14 ; Result = Map_nPoints(lon0, lat0, lon1, lat1)14 ; IDL> Result = Map_nPoints(lon0, lat0, lon1, lat1) 15 15 ; 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 16 ; @param Lon0 {in}{required} 17 ; @param Lat0 {in}{required} 18 ; np0 elements vector. longitudes and latitudes of np0 points P0 18 19 ; 19 ; @keyword AZIMUTH A named variable that will receive the azimuth of the great 20 ; @param Lon1 {in}{required} 21 ; @param Lat1 {in}{required} 22 ; np1 elements vector. longitude and latitude of np1 points P1 23 ; 24 ; @keyword AZIMUTH A named variable that will receive the azimuth of the great 20 25 ; circle connecting the two points, P0 to P1 21 ; @keyword 22 ; @keyword RADIANS =if set, inputs and angular outputs are in radians, otherwise26 ; @keyword /MIDDLE to get the longitude/latitude of the middle point betwen P0 and P1. 27 ; @keyword RADIANS if set, inputs and angular outputs are in radians, otherwise 23 28 ;degrees. 24 ; @keyword 29 ; @keyword RADIUS If given, return the distance between the two points 25 30 ;calculated using the given radius. 26 ; Default value is the earth radius : 6378206.4d0 27 ; @keyword TWO_BY_TWO:If given,then Map_nPoints returns the distances between 31 ; Default value is the earth radius : 6378206.4d0 32 ; 33 ; @keyword TWO_BY_TWO If given,then Map_nPoints returns the distances between 28 34 ; number n of P0 points and number n of P1 points (in that case, 29 35 ; np0 and np1 must be equal). … … 39 45 ; 40 46 ; @examples 41 ; IDL> print, $42 ; map_npoints([-105.15,1],[40.02,1],[-0.07,100,50],[51.30,20,0])47 ; IDL> print, $ 48 ; map_npoints([-105.15,1],[40.02,1],[-0.07,100,50],[51.30,20,0]) 43 49 ; 7551369.3 5600334.8 44 50 ; 12864354. 10921254. 45 51 ; 14919237. 5455558.8 46 52 ; 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, azi53 ; DIST DOUBLE = Array[3, 3]54 ; AZI DOUBLE = Array[3, 3]55 ; IDL> print, dist[4*lindgen(3)], azi[4*lindgen(3)]53 ; IDL> lon0 = [-10, 20, 100] 54 ; IDL> lat0 = [0, -10, 45] 55 ; IDL> lon1 = [10, 60, 280] 56 ; IDL> lat1 = [0, 10, 45] 57 ; IDL> dist = map_npoints(lon0, lat0, lon1, lat1, azimuth = azi) 58 ; IDL> help, dist, azi 59 ; DIST DOUBLE = Array[3, 3] 60 ; AZI DOUBLE = Array[3, 3] 61 ; IDL> print, dist[4*lindgen(3)], azi[4*lindgen(3)] 56 62 ; 2226414.0 4957944.5 10018863. 57 63 ; 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, azi60 ; DIST DOUBLE = Array[3]61 ; AZI DOUBLE = Array[3]62 ; IDL> print, dist, azi64 ; IDL> dist = map_npoints(lon0, lat0, lon1, lat1, azimuth = azi, /two_by_two) 65 ; IDL> help, dist, azi 66 ; DIST DOUBLE = Array[3] 67 ; AZI DOUBLE = Array[3] 68 ; IDL> print, dist, azi 63 69 ; 2226414.0 4957944.5 10018863. 64 70 ; 90.000000 64.494450 4.9615627e-15 65 ; IDL> print, map_2points(lon0[0], lat0[0], lon1[0], lat1[0])71 ; IDL> print, map_2points(lon0[0], lat0[0], lon1[0], lat1[0]) 66 72 ; 20.000000 90.000000 67 ; IDL> print, map_npoints(lon0[0], lat0[0], lon1[0], lat1[0], azi=azi)/6378206.4d0 / !dtor, azi73 ; IDL> print, map_npoints(lon0[0], lat0[0], lon1[0], lat1[0], azi=azi)/6378206.4d0 / !dtor, azi 68 74 ; 20.000000 69 75 ; 90.000000 70 76 ; 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 ; IDL> lon0 = [-10, 20, 100] 78 ; IDL> lat0 = [0, -10, 45] 79 ; IDL> lon1 = [10, 60, 280] 80 ; IDL> lat1 = [0, 10, 45] 81 ; IDL> mid = map_npoints(lon0, lat0, lon1, lat1, /middle, /two_by_two) 82 ; IDL> print, reform(mid[0,*]), reform(mid[1,*]) 77 83 ; 0.0000000 40.000000 190.00000 78 84 ; 0.0000000 -1.5902773e-15 90.000000 79 ; IDL> print, (map_2points(lon0[0], lat0[0], lon1[0], lat1[0], npath = 3))[*, 1]85 ; IDL> print, (map_2points(lon0[0], lat0[0], lon1[0], lat1[0], npath = 3))[*, 1] 80 86 ; 0.0000000 0.0000000 81 ; IDL> print, (map_2points(lon0[1], lat0[1], lon1[1], lat1[1], npath = 3))[*, 1]87 ; IDL> print, (map_2points(lon0[1], lat0[1], lon1[1], lat1[1], npath = 3))[*, 1] 82 88 ; 40.000000 -1.5902773e-15 83 ; IDL> print, (map_2points(lon0[2], lat0[2], lon1[2], lat1[2], npath = 3))[*, 1]89 ; IDL> print, (map_2points(lon0[2], lat0[2], lon1[2], lat1[2], npath = 3))[*, 1] 84 90 ; 190.00000 90.000000 85 91 ; … … 88 94 ; Sebastien Masson (smasson\@lodyc.jussieu.fr) 89 95 ; October 2003 96 ; 97 ; @version $Id$ 98 ; 90 99 ;- 91 100 Function Map_npoints, lon0, lat0, lon1, lat1, azimuth = azimuth $ -
trunk/SRC/Interpolation/neighbor.pro
- Property svn:keywords set to Id
r114 r118 10 10 ; IDL> Result = neighbor(lon0, lat0, lon1, lat1) 11 11 ; 12 ;@param p0lon {in}{required} scalar. longitudes of point P0. 13 ;@param p0lat {in}{required} scalar. latitudes of point P0. 12 ; @param p0lon {in}{required} scalar. longitudes of point P0. 13 ; @param p0lat {in}{required} scalar. latitudes of point P0. 14 ; @param neighlon {in}{optional} 15 ; @param neighlat {in}{optional} 14 16 ; 15 ; @keyword 17 ; @keyword RADIANS if set, inputs and angular outputs are in radians, otherwise 16 18 ;degrees. 17 ; @keyword 19 ; @keyword DISTANCE dis, to get back the distances between P0 and the np1 18 20 ; points P1 in the variable dis. 19 ; @keyword 21 ; @keyword /SPHERE to activate if points are located on a sphere. 20 22 ; 21 23 ; @returns 22 ; index giving the P1[index] point that is the closetest point 23 ; of (P0) 24 ; index giving the P1[index] point that is the closest point of (P0) 24 25 ; 25 26 ; @examples … … 33 34 ; Sebastien Masson (smasson\@lodyc.jussieu.fr) 34 35 ; October 2003 36 ; 37 ; @version $Id$ 38 ; 35 39 ;- 36 40 FUNCTION neighbor, p0lon, p0lat, neighlon, neighlat, sphere = sphere, distance = distance, radians = radians -
trunk/SRC/Interpolation/quadrilateral2square.pro
- Property svn:keywords set to Id
r114 r118 16 16 ; @examples 17 17 ; 18 ; 18 ; IDL> res = square2quadrilateral(x0,y0,x1,y1,x2,y2,x3,y3,xin,yin) 19 19 ; 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 28 ; (see above for correspondance with the unit square). Can be 29 ; scalar or array. (x0,y0), (x1,y1), (x2,y2) and (x3,y3) are 30 ; given in the anticlockwise order. 20 ; @param x0in {in}{required} 21 ; @param y0in {in}{required} 22 ; @param x1in {in}{required} 23 ; @param y1in {in}{required} 24 ; @param x2in {in}{required} 25 ; @param y2in {in}{required} 26 ; @param x3in {in}{required} 27 ; @param y3in {in}{required} 28 ; 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. 31 32 ; 32 ; @param xxin {in}{required} the coordinates of the point(s) for which we want to do the33 ; 34 ; @param yyin {in}{required} the coordinates of the point(s) for which we want to do the35 ; mapping. Can be scalar or array.33 ; @param xxin {in}{required} the coordinates of the point(s) for which we want to do the mapping. Can be scalar or array. 34 ; @param yyin {in}{required} the coordinates of the point(s) for which we want to do the mapping. Can be scalar or array. 35 ; 36 ; @keyword PERF 36 37 ; 37 38 ; @returns … … 65 66 ; Chapter 3, see p 52-56 66 67 ; 68 ; 69 ; @version $Id$ 70 ; 67 71 ;- 68 72 ;------------------------------------------------------------ -
trunk/SRC/Interpolation/spl_fstdrv.pro
- Property svn:keywords set to Id
r114 r118 31 31 ; y2: f'(x2) = y2. 32 32 ; 33 ;34 33 ; @history 35 34 ; Sebastien Masson (smasson\@lodyc.jussieu.fr): May 2005 35 ; 36 ; @version $Id$ 37 ; 36 38 ;- 37 39 ;------------------------------------------------------------ -
trunk/SRC/Interpolation/spl_incr.pro
- Property svn:keywords set to Id
r114 r118 12 12 ; in a way that interpolated values are also monotonically increasing. 13 13 ; 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 17 ; tabulate points in a strict ascending order. 18 ; 19 ; @param y1 {in}{required} f(x) = y. An n-element input vector that specifies the values 14 ; @examples 15 ; IDL> y2 = spl_incr(x, y, x2) 16 ; 17 ; @param x1 {in}{required} 18 ; An n-element (at least 2) input vector that specifies the tabulate points in 19 ; a strict ascending order. 20 ; 21 ; @param y1 {in}{required} 22 ; f(x) = y. An n-element input vector that specifies the values 20 23 ; of the tabulated function F(Xi) corresponding to Xi. As f is 21 24 ; supposed to be monotonically increasing, y values must be 22 25 ; monotonically increasing. y can have equal consecutive values. 23 26 ; 24 ; @param x2 {in}{required} The input values for which the interpolated values are 25 ; desired. Its values must be strictly monotonically increasing. 26 ; 27 ; 28 ; 27 ; @param x2 {in}{required} 28 ; The input values for which the interpolated values are 29 ; desired. Its values must be strictly monotonically increasing. 30 ; 31 ; @param der2 32 ; @param x 29 33 ; 30 34 ; @returns … … 38 42 ; @examples 39 43 ; 40 ; 41 ; x = (dindgen(n))^242 ; 43 ; 44 ; 45 ; 46 ; 47 ; 48 ; 49 ; 50 ; 51 ; 52 ; 53 ; 54 ; 55 ; 56 ; 57 ; 44 ; IDL> n = 100L 45 ; IDL> x = (dindgen(n))^2 46 ; IDL> y = abs(randomn(0, n)) 47 ; IDL> y[n/2:n/2+1] = 0. 48 ; IDL> y[n-n/3] = 0. 49 ; IDL> y[n-n/6:n-n/6+5] = 0. 50 ; IDL> y = total(y, /cumulative, /double) 51 ; IDL> x2 = dindgen((n-1)^2) 52 ; IDL> n2 = n_elements(x2) 53 ; IDL> print, min(y[1:n-1]-y[0:n-2]) LT 0 54 ; IDL> y2 = spl_incr( x, y, x2) 55 ; IDL> splot, x, y, xstyle = 1, ystyle = 1, ysurx=.25, petit = [1, 2, 1], /land 56 ; IDL> oplot, x2, y2, color = 100 57 ; IDL> c = y2[1:n2-1] - y2[0:n2-2] 58 ; IDL> print, min(c) LT 0 59 ; IDL> print, min(c, max = ma), ma 60 ; IDL> splot,c,xstyle=1,ystyle=1, yrange=[-.01,.05], ysurx=.25, petit = [1, 2, 2], /noerase 61 ; IDL> oplot,[0, n_elements(c)], [0, 0], linestyle = 1 58 62 ; 59 63 ; @history 60 64 ; Sebastien Masson (smasson\@lodyc.jussieu.fr): May-Dec 2005 65 ; 66 ; @version $Id$ 67 ; 61 68 ;- 62 69 ;------------------------------------------------------------ … … 82 89 END 83 90 91 ;+ 92 ; @param x1 {in}{required} 93 ; An n-element (at least 2) input vector that specifies the tabulate points in 94 ; a strict ascending order. 95 ; 96 ; @param y1 {in}{required} 97 ; f(x) = y. An n-element input vector that specifies the values 98 ; of the tabulated function F(Xi) corresponding to Xi. As f is 99 ; supposed to be monotonically increasing, y values must be 100 ; monotonically increasing. y can have equal consecutive values. 101 ; 102 ; @param x2 {in}{required} 103 ; The input values for which the interpolated values are 104 ; desired. Its values must be strictly monotonically increasing. 105 ; 106 ; @param der2 107 ; @param x 108 ; 109 ;- 84 110 FUNCTION pure_convex, x1, x2, y1, y2, der2, x 85 111 ; 1-(1-X)^n type … … 103 129 104 130 ;+ 105 ; @keyword YP0 The first derivative of the interpolating function at the 131 ; @param x 132 ; @param y 133 ; @param x2 134 ; @keyword YP0 The first derivative of the interpolating function at the 106 135 ; point X0. If YP0 is omitted, the second derivative at the 107 136 ; boundary is set to zero, resulting in a "natural spline." 108 ; @keyword 137 ; @keyword YPN_1 The first derivative of the interpolating function at the 109 138 ; point Xn-1. If YPN_1 is omitted, the second derivative at the 110 139 ; boundary is set to zero, resulting in a "natural spline." -
trunk/SRC/Interpolation/spl_keep_mean.pro
- Property svn:keywords set to Id
r114 r118 72 72 ; @history 73 73 ; Sebastien Masson (smasson\@lodyc.jussieu.fr): May 2005 74 ; 75 ; @version $Id$ 76 ; 74 77 ;- 75 78 ;------------------------------------------------------------ -
trunk/SRC/Interpolation/square2quadrilateral.pro
- Property svn:keywords set to Id
r114 r118 84 84 ; Chapter 3, see p 52-56 85 85 ; 86 ; 87 ; @version $Id$ 88 ; 86 89 ;- 87 90 ;------------------------------------------------------------
Note: See TracChangeset
for help on using the changeset viewer.