Ignore:
Timestamp:
06/27/06 17:47:06 (18 years ago)
Author:
pinsard
Message:

add $ in Calendar, Grid, Interpolation, Obsolete and Postscript *.pro files, add svn:keywords Id to all these files, some improvements in header

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/SRC/Interpolation/get_gridparams.pro

    • Property svn:keywords set to Id
    r114 r118  
    11;+ 
    22; 
    3 ; @file_comments  
     3; @file_comments 
    44;   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 sure  
    8     they are 1D or 2D arrays  
     5;      and make sure it is 1D or 2D arrays 
     6; 
     7;   or 2) given longitude and latitude arrays get their dimensions and make 
     8sure they are 1D or 2D arrays 
    99; 
    1010; @categories interpolation 
    1111; 
    12 ; @examples  
    13 ;  
     12; @examples 
     13; 
    1414; 1) get_gridparams, file, lonname, latname, lon, lat, jpi, jpj, n_dimensions 
    1515; 
    16 ; or  
     16; or 
    1717; 
    1818; 2) get_gridparams, lon, lat, jpi, jpj, n_dimensions 
    1919; 
    20 ; 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 
     20; 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 
    2626; @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) 
    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. 
    3636 
    3737; @param in1 {out} the variable that will contain the longitudes 
    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) 
     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) 
    4242;    arrays or 2D arrays (jpi,jpj). Note that of  n_dimensions = 1, then the 
    4343;    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' $ 
    4951;            , olon, olat, jpio, jpjo, 2 
    5052; 
    51 ; 2) ncdf_get_gridparams, olon, olat, jpio, jpjo, 2 
     53; 2) IDL> ncdf_get_gridparams, olon, olat, jpio, jpjo, 2 
    5254; 
    5355; @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; 
    5660;- 
    5761; 
     
    5963;---------------------------------------------------------- 
    6064; 
    61  
    6265PRO get_gridparams, in1,   in2,   in3,     in4, in5, in6, in7, in8, DOUBLE = double 
    6366;                  file, lonname, latname, lon, lat, jpi, jpj, n_dimensions 
     
    7073    8:BEGIN 
    7174; get longitude and latitude 
    72       IF file_test(in1) EQ 0 THEN BEGIN  
     75      IF file_test(in1) EQ 0 THEN BEGIN 
    7376        print, 'file ' + in1 + ' does not exist' 
    7477        stop 
     
    7780      ncdf_varget, cdfido, in2, lon 
    7881      ncdf_varget, cdfido, in3, lat 
    79       ncdf_close, cdfido  
     82      ncdf_close, cdfido 
    8083      n_dimensions = in8 
    8184    END 
    82     5:BEGIN  
     85    5:BEGIN 
    8386      lon = temporary(in1) 
    8487      lat = temporary(in2) 
    8588      n_dimensions = in5 
    8689    END 
    87     ELSE:BEGIN  
     90    ELSE:BEGIN 
    8891      print, 'Bad nimber of input parameters' 
    8992      stop 
     
    9396  sizelon = size(lon) 
    9497  sizelat = size(lat) 
    95   CASE 1 OF  
     98  CASE 1 OF 
    9699;------- 
    97100; lon and lat are 1D arrays 
    98101;------- 
    99     sizelon[0] EQ 1 AND sizelat[0] EQ 1:BEGIN  
     102    sizelon[0] EQ 1 AND sizelat[0] EQ 1:BEGIN 
    100103; get jpi and jpj 
    101104      jpi = sizelon[1] 
    102105      jpj = sizelat[1] 
    103106; make sure that lon and lat have the good number of dimensions 
    104       CASE n_dimensions OF  
     107      CASE n_dimensions OF 
    105108        1: 
    106109        2:BEGIN 
     
    115118; lon is 2D array and lat is 1D array 
    116119;------- 
    117     sizelon[0] EQ 2 AND sizelat[0] EQ 1:BEGIN  
     120    sizelon[0] EQ 2 AND sizelat[0] EQ 1:BEGIN 
    118121; get jpi and jpj 
    119122      jpi = sizelon[1] 
     
    121124      IF jpj NE n_elements(lat) THEN stop 
    122125; 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 
    126129            print, 'Longitudes are not the same for all latitudes, imposible to extract a 1D array of the longitudes' 
    127130            stop 
     
    136139; lon is 1D array and lat is 2D array 
    137140;------- 
    138     sizelon[0] EQ 1 AND sizelat[0] EQ 2:BEGIN  
     141    sizelon[0] EQ 1 AND sizelat[0] EQ 2:BEGIN 
    139142; get jpi and jpj 
    140143      jpi = sizelat[1] 
     
    142145      IF jpi NE n_elements(lon) THEN stop 
    143146; 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 
    147150            print, 'Latitudes are not the same for all longitudes, imposible to extract a 1D array of the latitudes' 
    148151            stop 
     
    157160; lon and lat are 2D arrays 
    158161;------- 
    159     sizelon[0] EQ 2 AND sizelat[0] EQ 2:BEGIN  
     162    sizelon[0] EQ 2 AND sizelat[0] EQ 2:BEGIN 
    160163; get jpi and jpj 
    161164      IF array_equal(sizelon[1:2], sizelat[1:2]) NE 1 THEN stop 
    162165      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 
    168171            print, 'Longitudes are not the same for all latitudes, imposible to extract a 1D array of the longitudes' 
    169172            stop 
    170173          ENDIF 
    171174          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 
    173176            print, 'Latitudes are not the same for all longitudes, imposible to extract a 1D array of the latitudes' 
    174177            stop 
     
    189192; double keyword 
    190193;------- 
    191   if keyword_set(double) then BEGIN  
     194  if keyword_set(double) then BEGIN 
    192195    lon = double(temporary(lon)) 
    193196    lat = double(temporary(lat)) 
Note: See TracChangeset for help on using the changeset viewer.