Changeset 271 for trunk/SRC/ReadWrite/ncdf_getaxis.pro
- Timestamp:
- 08/30/07 14:44:23 (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SRC/ReadWrite/ncdf_getaxis.pro
r232 r271 5 5 ; 6 6 ; @categories 7 ; Read ing7 ; Read NetCDF file 8 8 ; 9 9 ; @param cdfid {in}{required}{type=scalar} … … 29 29 ; 30 30 ; @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. 32 33 ; 33 34 ; @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. 35 37 ; 36 38 ; @keyword XAXISNAME {default='x', 'longitude', 'nav_lon', 'lon', 'lon_rho' or 'NbLongitudes'}{type=scalar string} 37 39 ; 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. 39 42 ; 40 43 ; @keyword YAXISNAME {default='y', 'latitude', 'nav_lat','lat', 'lat_rho' or 'NbLatitudes'}{type=scalar string} 41 44 ; 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. 43 47 ; 44 48 ; @keyword XYINDEX {default=0}{type=scalar: 0 or 1} … … 47 51 ; x/yaxis = keyword_set(start1) + findgen(jpi/jpj) 48 52 ; 49 ; @keyword XYINDEX {default=0}{type=scalar: 0 or 1}50 ;51 53 ; @keyword _EXTRA 52 54 ; Used to be able to call ncdf_getaxis with _extra … … 60 62 ;- 61 63 ; 62 PRO ncdf_getaxis, cdfid, dimidx, dimidy, xaxis, yaxis $64 PRO ncdf_getaxis, fileid, dimidx, dimidy, xaxis, yaxis $ 63 65 , XAXISNAME = xaxisname, YAXISNAME = yaxisname $ 64 66 , XDIMNAME = xdimname, YDIMNAME = ydimname $ … … 67 69 compile_opt idl2, strictarrsubs 68 70 ; 69 71 ; should we open the file? 72 IF size(fileid, /type) EQ 7 THEN cdfid = ncdf_open(fileid) ELSE cdfid = fileid 70 73 ; what is inside the file 71 74 inside = ncdf_inquire(cdfid) … … 97 100 , '''longitude'', ''nav_lon'', ''lon'', ''lon_rho'', ''nblongitudes''' $ 98 101 , ' we use a fake xaxis based on x dimension size (or use XAXISNAME keyword)'], /simple) 102 xaxisname = 'Not Found' 99 103 ; try to get the dimension corresponding to x 100 104 ; roms file? … … 125 129 ENDELSE 126 130 ENDCASE 127 ENDIF128 romsgrid = 0b131 romsgrid = 0b 132 ENDIF ELSE romsgrid = 1b 129 133 ENDIF ELSE BEGIN 130 134 romsgrid = strmid(namevar[xvarid], 0, 4) EQ 'lon_' 131 135 xinq = ncdf_varinq(cdfid, xvarid) 136 xaxisname = xinq.name 132 137 dimidx = xinq.dim[0] 133 138 IF xinq.ndims GE 2 THEN ncdf_diminq, cdfid, xinq.dim[1], blabla, jpjfromx 134 139 ENDELSE 140 IF arg_present(xdimname) THEN ncdf_diminq, cdfid, dimidx, xdimname, jpifromx 135 141 ; 136 142 IF arg_present(xaxis) THEN BEGIN … … 162 168 , '''latitude'', ''nav_lat'', ''lat'', ''lat_rho'', ''nblatitudes''' $ 163 169 , ' we use a fake yaxis based on y dimension size (or use YAXISNAME keyword)'], /simple) 170 yaxisname = 'Not Found' 164 171 ; try to get the dimension corresponding to y 165 172 ; roms file? … … 193 200 ENDIF ELSE BEGIN 194 201 yinq = ncdf_varinq(cdfid, yvarid) 202 yaxisname = yinq.name 195 203 IF yinq.ndims GE 2 THEN BEGIN 196 204 ncdf_diminq, cdfid, yinq.dim[0], blabla, jpifromy … … 198 206 ENDIF ELSE dimidy = yinq.dim[0] 199 207 ENDELSE 208 IF arg_present(ydimname) THEN ncdf_diminq, cdfid, dimidy, ydimname, jpjfromy 200 209 ; 201 210 IF arg_present(yaxis) THEN BEGIN … … 224 233 ENDIF 225 234 235 IF size(fileid, /type) EQ 7 THEN ncdf_close, cdfid 236 226 237 return 227 238 END
Note: See TracChangeset
for help on using the changeset viewer.