Changeset 271 for trunk/SRC/Interpolation/get_gridparams.pro
- Timestamp:
- 08/30/07 14:44:23 (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SRC/Interpolation/get_gridparams.pro
r242 r271 2 2 ; 3 3 ; @file_comments 4 ; 1) extract from a NetCDF file the longitude, latitude, andtheir dimensions4 ; Case 1: extract from a NetCDF file longitude and latitude arrays, their dimensions 5 5 ; and make sure it is 1D or 2D arrays 6 6 ; 7 ; or 8 ; 2) given longitude and latitude arrays, get their dimensions and make 7 ; Case 2: given longitude and latitude arrays, get their dimensions and make 9 8 ; sure they are 1D or 2D arrays 10 9 ; … … 14 13 ; @examples 15 14 ; 16 ; 1) 17 ; IDL> get_gridparams, file, lonname, latname, lon, lat, jpi, jpj, n_dimensions 18 ; 19 ; or 20 ; 21 ; 2) 15 ; Case 1: 16 ; IDL> get_gridparams, file name/id, lonname, latname, lon, lat, jpi, jpj, n_dimensions 17 ; 18 ; Case 2: 22 19 ; IDL> get_gridparams, lon, lat, jpi, jpj, n_dimensions 23 20 ; 24 21 ; @param in1 {in}{required} 25 ; Case 1: the nameof the netcdf file26 ; Case 2: 1 d or 2d arrays defining longitudes and latitudes.27 ; Out: the variable that will contain the longitudes22 ; Case 1: name or the id (returned by ncdf_open) of the netcdf file 23 ; Case 2: 1D or 2D arrays defining longitudes, will be forced to have 24 ; n_dimensions dimensions when returned 28 25 ; 29 26 ; @param in2 {in}{required} 30 ; Case 1: the name of the variable that contains the longitude in the NetCDF file 31 ; Case 2: 1d or 2d arrays defining longitudes and latitudes. 32 ; Note that these arrays are also outputs and can therefore be modified. 33 ; Out: the variable that will contain the latitudes 34 ; 35 ; @param in3 {in}{required} 36 ; Case 1: the name of the variable that contains the latitude in the NetCDF file 37 ; Case 2: the number of points in the longitudinal direction. 27 ; Case 1: name of the variable containing the longitude in the NetCDF file 28 ; Case 2: 1D or 2D arrays defining latitudes, will be forced to have 29 ; n_dimensions dimensions when returned 30 ; 31 ; @param in3 32 ; Case 1: name of the variable containing the latitude in the NetCDF file 33 ; Case 2: returned number of points in longitudinal direction. 38 34 ; 39 35 ; @param in4 {out} 40 ; Case 1: the number of points in the longitudinal direction 41 ; Case 2: the number of points in the latitudinal direction 42 ; 43 ; @param in5 {out} 44 ; Case 1: the number of points in the latitudinal direction 45 ; Case 2: 1 or 2 to specify if lon and lat should be 1D (jpi or jpj) 46 ; arrays or 2D arrays (jpi,jpj). Note that of n_dimensions = 1, then the 47 ; grid must be regular (each longitude must be the same for all latitudes 48 ; and each latitude should be the same for all longitudes). 36 ; Case 1: returned longitudes array, with n_dimensions dimensions 37 ; Case 2: returned number of points in latitudinal direction 38 ; 39 ; @param in5 40 ; Case 1: returned latitudes array, with n_dimensions dimensions 41 ; Case 2: input scalar (1 or 2) to specify if lon and lat should be returned 42 ; as 1D or 2D arrays. Note that if n_dimensions = 1, the grid must be 43 ; regular (longitude and latitudes can be described as 1D arrays). 49 44 ; 50 45 ; @param in6 {out} 51 ; the variable that will contain the longitudes46 ; Case 1: returned number of points in longitudinal direction. 52 47 ; 53 48 ; @param in7 {out} 54 ; the variable that will contain the latitudes 55 ; 56 ; @param in8 {out} 57 ; 1 or 2 to specify if lon and lat should be 1D (jpi or jpj) 58 ; 59 ; @keyword DOUBLE 60 ; use double precision to perform the computation 49 ; Case 1: returned number of points in latitudinal direction 50 ; 51 ; @param in8 {in} 52 ; Case 1: input scalar (1 or 2) to specify if lon and lat should be returned 53 ; as 1D or 2D arrays. Note that if n_dimensions = 1, the grid must be 54 ; regular (longitude and latitudes can be described as 1D arrays). 55 ; 56 ; @keyword DOUBLE {default=0}{type=scalar: 0 or 1} 57 ; activate to force double precision for lon/lat arrays 61 58 ; 62 59 ; @examples … … 84 81 8:BEGIN 85 82 ; get longitude and latitude 86 IF file_test(in1) EQ 0 THEN BEGIN 87 ras = report('file ' + in1 + ' does not exist') 88 stop 89 ENDIF 90 cdfido = ncdf_open(in1) 83 IF size(in1, /type) EQ 7 THEN BEGIN 84 IF file_test(in1) EQ 0 THEN BEGIN 85 ras = report('file ' + in1 + ' does not exist') 86 stop 87 ENDIF 88 cdfido = ncdf_open(in1) 89 ENDIF ELSE cdfido = in1 91 90 ncdf_varget, cdfido, in2, lon 92 91 ncdf_varget, cdfido, in3, lat 93 ncdf_close, cdfido92 IF size(in1, /type) EQ 7 THEN ncdf_close, cdfido 94 93 n_dimensions = in8 95 94 END
Note: See TracChangeset
for help on using the changeset viewer.