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/ReadWrite/ncdf_getaxis.pro

    r232 r271  
    55; 
    66; @categories 
    7 ; Reading 
     7; Read NetCDF file 
    88; 
    99; @param cdfid {in}{required}{type=scalar} 
     
    2929; 
    3030; @keyword XDIMNAME {default='longitude', 'lon', 'x', 'longitude*', 'lon*', 'x*', '*longitude*', '*lon*' or '*x*'}{type=scalar string} 
    31 ; A string giving the name of the x dimension 
     31; A string giving the name of the x dimension or/and a named variable 
     32; in which x dimension name is returned. 
    3233; 
    3334; @keyword YDIMNAME {default='latitude', 'lat', 'y', 'latitude*', 'lat*', 'y*', 'eta_*', '*latitude*', '*lat*', '*y*'}{type=scalar string} 
    34 ; A string giving the name of the y dimension 
     35; A string giving the name of the y dimension or/and a named variable 
     36; in which y dimension name is returned. 
    3537; 
    3638; @keyword XAXISNAME {default='x', 'longitude', 'nav_lon', 'lon', 'lon_rho' or 'NbLongitudes'}{type=scalar string} 
    3739; A string giving the name of the variable in the file 
    38 ; that contains the [xyz]axis. 
     40; that contains the x axis or/and a named variable 
     41; in which this variable name is returned. 
    3942; 
    4043; @keyword YAXISNAME {default='y', 'latitude', 'nav_lat','lat', 'lat_rho' or 'NbLatitudes'}{type=scalar string} 
    4144; A string giving the name of the variable in the file 
    42 ; that contains the [xyz]axis. 
     45; that contains the y axis or/and a named variable 
     46; in which this variable name is returned. 
    4347; 
    4448; @keyword XYINDEX {default=0}{type=scalar: 0 or 1} 
     
    4751; x/yaxis = keyword_set(start1) + findgen(jpi/jpj) 
    4852; 
    49 ; @keyword XYINDEX {default=0}{type=scalar: 0 or 1} 
    50 ; 
    5153; @keyword _EXTRA 
    5254; Used to be able to call ncdf_getaxis with _extra 
     
    6062;- 
    6163; 
    62 PRO ncdf_getaxis, cdfid, dimidx, dimidy, xaxis, yaxis $ 
     64PRO ncdf_getaxis, fileid, dimidx, dimidy, xaxis, yaxis $ 
    6365                  , XAXISNAME = xaxisname, YAXISNAME = yaxisname $ 
    6466                  , XDIMNAME = xdimname, YDIMNAME = ydimname $ 
     
    6769  compile_opt idl2, strictarrsubs 
    6870; 
    69  
     71; should we open the file? 
     72  IF size(fileid, /type) EQ 7 THEN cdfid = ncdf_open(fileid) ELSE cdfid = fileid 
    7073; what is inside the file 
    7174  inside = ncdf_inquire(cdfid) 
     
    97100                    , '''longitude'', ''nav_lon'', ''lon'', ''lon_rho'', ''nblongitudes''' $ 
    98101                    , ' we use a fake xaxis based on x dimension size (or use XAXISNAME keyword)'], /simple) 
     102    xaxisname = 'Not Found' 
    99103; try to get the dimension corresponding to x 
    100104; roms file? 
     
    125129        ENDELSE 
    126130      ENDCASE 
    127     ENDIF 
    128     romsgrid = 0b 
     131      romsgrid = 0b 
     132    ENDIF ELSE romsgrid = 1b 
    129133  ENDIF ELSE BEGIN 
    130134    romsgrid = strmid(namevar[xvarid], 0, 4) EQ 'lon_' 
    131135    xinq = ncdf_varinq(cdfid, xvarid) 
     136    xaxisname = xinq.name 
    132137    dimidx = xinq.dim[0] 
    133138    IF xinq.ndims GE 2 THEN ncdf_diminq, cdfid, xinq.dim[1], blabla, jpjfromx 
    134139  ENDELSE 
     140  IF arg_present(xdimname) THEN ncdf_diminq, cdfid, dimidx,  xdimname, jpifromx 
    135141; 
    136142  IF arg_present(xaxis) THEN BEGIN 
     
    162168                    , '''latitude'', ''nav_lat'', ''lat'', ''lat_rho'', ''nblatitudes''' $ 
    163169                    , ' we use a fake yaxis based on y dimension size (or use YAXISNAME keyword)'], /simple) 
     170    yaxisname = 'Not Found' 
    164171; try to get the dimension corresponding to y 
    165172; roms file? 
     
    193200  ENDIF ELSE BEGIN 
    194201    yinq = ncdf_varinq(cdfid, yvarid) 
     202    yaxisname = yinq.name 
    195203    IF yinq.ndims GE 2 THEN BEGIN 
    196204      ncdf_diminq, cdfid, yinq.dim[0], blabla, jpifromy 
     
    198206    ENDIF ELSE dimidy = yinq.dim[0] 
    199207  ENDELSE 
     208  IF arg_present(ydimname) THEN ncdf_diminq, cdfid, dimidy,  ydimname, jpjfromy 
    200209; 
    201210  IF arg_present(yaxis) THEN BEGIN 
     
    224233  ENDIF 
    225234 
     235  IF size(fileid, /type) EQ 7 THEN ncdf_close, cdfid 
     236 
    226237  return 
    227238END 
Note: See TracChangeset for help on using the changeset viewer.