Ignore:
Timestamp:
08/30/07 14:44:23 (17 years ago)
Author:
smasson
Message:

bugfix for interpolation from ORCA2 without mask

File:
1 edited

Legend:

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

    r242 r271  
    22; 
    33; @file_comments 
    4 ; 1) extract from a NetCDF file the longitude, latitude, and their dimensions 
     4; Case 1: extract from a NetCDF file longitude and latitude arrays, their dimensions 
    55; and make sure it is 1D or 2D arrays 
    66; 
    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 
    98; sure they are 1D or 2D arrays 
    109; 
     
    1413; @examples 
    1514; 
    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: 
    2219; IDL> get_gridparams, lon, lat, jpi, jpj, n_dimensions 
    2320; 
    2421; @param in1 {in}{required} 
    25 ; Case 1: the name of the netcdf file 
    26 ; Case 2: 1d or 2d arrays defining longitudes and latitudes. 
    27 ; Out: the variable that will contain the longitudes 
     22; 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 
    2825; 
    2926; @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. 
    3834; 
    3935; @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). 
    4944; 
    5045; @param in6 {out} 
    51 ; the variable that will contain the longitudes 
     46; Case 1: returned number of points in longitudinal direction. 
    5247; 
    5348; @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 
    6158; 
    6259; @examples 
     
    8481    8:BEGIN 
    8582; 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 
    9190      ncdf_varget, cdfido, in2, lon 
    9291      ncdf_varget, cdfido, in3, lat 
    93       ncdf_close, cdfido 
     92      IF size(in1, /type) EQ 7 THEN ncdf_close, cdfido 
    9493      n_dimensions = in8 
    9594    END 
Note: See TracChangeset for help on using the changeset viewer.