Changeset 172 for trunk/SRC/ToBeReviewed/INIT
- Timestamp:
- 09/11/06 09:11:26 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SRC/ToBeReviewed/INIT/initncdf.pro
r167 r172 5 5 ; 6 6 ; @file_comments 7 ; Initfile for Netcdf file. define all the grid parameters 7 ; Initfile for Netcdf file. define all the grid parameters through 8 ; an appropriate call to computegid 8 9 ; 9 10 ; @categories 10 ; 11 ; Grid 11 12 ; 12 ; @param NCFILEIN {in}{required}{type=s tring}13 ; @param NCFILEIN {in}{required}{type=scalar string} 13 14 ; A string giving the name of the NetCdf file 14 15 ; 15 ; @keyword INVMASK 16 ; To inverse the mask: mask = 1-mask16 ; @keyword INVMASK {default=0}{type=scalar: 0 or 1} 17 ; Inverse the land/sea mask (that should have 0/1 values for land/sea): mask = 1-mask 17 18 ; 18 19 ; @keyword MASKNAME {type=string} … … 20 21 ; that contains the land/sea mask 21 22 ; 22 ; @keyword MISSING_VALUE 23 ; @keyword MISSING_VALUE {type=scalar} 23 24 ; To define (or redefine if the attribute is 24 25 ; already existing) the missing values used with USEASMASK 25 26 ; keyword 26 27 ; 27 ; @keyword START1 28 ; @keyword START1 {default=0}{type=scalar: 0 or 1} 28 29 ; Index the axis from 1 instead of 0 when using 29 30 ; /xyindex and/or zindex 30 31 ; 31 ; @keyword USEASMASK {type=s tring}32 ; @keyword USEASMASK {type=scalar string} 32 33 ; A string giving the name of the variable in the file 33 34 ; that will be used to build the land/sea mask. In this case the … … 38 39 ; 3 NaN values if existing 39 40 ; 40 ; @keyword XAXISNAME {default='x', 'longitude', 'nav_lon' or 'lon'}{type=string}41 ; @keyword XAXISNAME {default='x', 'longitude', 'nav_lon', 'lon', 'lon_rho' or 'NbLongitudes'}{type=scalar string} 41 42 ; A string giving the name of the variable in the file 42 43 ; that contains the [xyz]axis. 43 44 ; 44 ; @keyword YAXISNAME {default='y', 'latitude', 'nav_lat' or 'lat'}{type=string}45 ; @keyword YAXISNAME {default='y', 'latitude', 'nav_lat','lat', 'lat_rho' or 'NbLatitudes'}{type=scalar string} 45 46 ; A string giving the name of the variable in the file 46 47 ; that contains the [xyz]axis. 47 48 ; 48 ; @keyword ZAXISNAME {default='z', 'level', 'lev', 'depth...'}{type=s tring}49 ; @keyword ZAXISNAME {default='z', 'level', 'lev', 'depth...'}{type=scalar string} 49 50 ; A string giving the name of the variable in the file 50 51 ; that contains the [xyz]axis. 51 52 ; 52 ; @keyword XYINDEX 53 ; @keyword XYINDEX {default=0}{type=scalar: 0 or 1} 53 54 ; To define the x/y axis with index instead of using 54 55 ; the values contained in X/YAXISNAME. … … 56 57 ; this forces key_onearth = 0 57 58 ; 58 ; @keyword ZINDEX 59 ; @keyword ZINDEX {default=0}{type=scalar: 0 or 1} 59 60 ; To define the z axis with index instead of using 60 61 ; the values contained in ZAXISNAME. … … 62 63 ; 63 64 ; @keyword _EXTRA 64 ; Used to pass your keywords/65 ; Used to pass keywords to computegrid 65 66 ; 66 67 ; @uses … … 68 69 ; 69 70 ; @restrictions 70 ; Change the grid parameters of the common.pro71 ; Change the grid parameters (see computegrid) 71 72 ; 72 73 ; @restrictions … … 122 123 ; find the xaxis 123 124 if keyword_set(xaxisname) then xaxisname = strlowcase(xaxisname) ELSE xaxisname = 'x' 124 xvarid = where(namevar EQ xaxisname OR namevar EQ 'longitude' $125 OR namevar EQ 'nav_lon' OR namevar EQ 'lon' $126 OR namevar EQ 'NbLongitudes')127 xvarid = xvarid[0]125 xvarid = (where(namevar EQ xaxisname OR namevar EQ 'longitude' $ 126 OR namevar EQ 'nav_lon' OR namevar EQ 'lon' $ 127 OR namevar EQ 'lon_rho' OR namevar EQ 'NbLongitudes'))[0] 128 romsgrid = strmid(namevar[xvarid], 0, 4) EQ 'lon_' 128 129 if xvarid EQ -1 then begin 129 130 print, 'the xaxis was not found, check the use of XAXISNAME keyword' … … 146 147 ; find the yaxis 147 148 if keyword_set(yaxisname) then yaxisname = strlowcase(yaxisname) ELSE yaxisname = 'y' 148 yvarid = where(namevar EQ yaxisname OR namevar EQ 'latitude' $149 OR namevar EQ 'nav_lat' OR namevar EQ 'lat' $150 OR namevar EQ 'NbLatitudes')149 yvarid = (where(namevar EQ yaxisname OR namevar EQ 'latitude' $ 150 OR namevar EQ 'nav_lat' OR namevar EQ 'lat' $ 151 OR namevar EQ 'lat_rho' OR namevar EQ 'NbLatitudes'))[0] 151 152 yvarid = yvarid[0] 152 153 if yvarid EQ -1 then begin … … 177 178 ;---------------------------------------------------------- 178 179 ; find the zaxis 179 if keyword_set(zaxisname) then zaxisname = strlowcase(zaxisname) ELSE zaxisname = 'z' 180 zvarid = where(namevar EQ 'nav_lev' or namevar EQ zaxisname OR namevar EQ 'level' OR namevar EQ 'lev' OR strmid(namevar, 0, 5) EQ 'depth') 181 zvarid = zvarid[0] 182 if zvarid EQ -1 AND inside.ndims GT 3 then begin 183 print, 'initncdf: the zaxis was not found..., check the the use of ZAXISNAME keyword if you whant to find one...' 180 IF keyword_set(romsgrid) THEN BEGIN 181 FOR i = 0, inside.ndims-1 DO BEGIN 182 ncdf_diminq, cdfid, i, name, size 183 CASE strlowcase(name) OF 184 's_rho':zaxis = reverse(indgen(size)) 185 's_u':zaxis = reverse(indgen(size)) 186 's_v':zaxis = reverse(indgen(size)) 187 's_psi':zaxis = reverse(indgen(size)) 188 's_w':zaxis = reverse(indgen(size-1)) 189 ELSE: 190 ENDCASE 191 ENDFOR 192 IF (where(namevar EQ 'h'))[0] NE -1 THEN BEGIN 193 ncdf_varget, cdfid, 'h', romsh 194 ENDIF ELSE romsh = -1 195 ENDIF ELSE BEGIN 196 if keyword_set(zaxisname) then zaxisname = strlowcase(zaxisname) ELSE zaxisname = 'z' 197 zvarid = (where(namevar EQ 'nav_lev' or namevar EQ zaxisname OR namevar EQ 'level' OR namevar EQ 'lev' OR strmid(namevar, 0, 5) EQ 'depth'))[0] 198 if zvarid EQ -1 AND inside.ndims GT 3 then begin 199 print, 'initncdf: the zaxis was not found..., check the the use of ZAXISNAME keyword if you whant to find one...' 184 200 ; stop 185 endif201 endif 186 202 ; read the zaxis 187 if zvarid NE -1 THEN ncdf_varget, cdfid, zvarid, zaxis 188 IF keyword_set(zindex) THEN $ 189 zaxis = keyword_set(start1) + findgen(n_elements(zaxis)) 203 if zvarid NE -1 THEN ncdf_varget, cdfid, zvarid, zaxis 204 ENDELSE 205 IF keyword_set(zindex) AND keyword_set(zaxis) THEN $ 206 zaxis = keyword_set(start1) + findgen(n_elements(zaxis)) 190 207 ;---------------------------------------------------------- 191 208 ; mask 209 IF NOT (keyword_set(maskname) OR keyword_set(useasmask)) AND keyword_set(romsgrid) THEN maskname = 'mask_rho' 192 210 CASE 1 OF 193 211 keyword_set(maskname):BEGIN … … 252 270 'scale_factor':ncdf_attget, cdfid, mskid, attname, scale_factor 253 271 'missing_value':IF n_elements(missing_value) EQ 0 THEN $ 254 ncdf_attget, cdfid, mskid, attname, missing_value272 ncdf_attget, cdfid, mskid, attname, missing_value 255 273 ELSE: 256 274 ENDCASE … … 279 297 ELSE:tmask = -1 280 298 ENDCASE 299 ; 281 300 ncdf_close, cdfid 282 301 ; 283 302 ; compute the grid 284 if zvarid EQ -1then BEGIN303 if NOT keyword_set(zaxis) then BEGIN 285 304 computegrid, xaxis = xaxis, yaxis = yaxis $ 286 , mask = tmask, onearth = 1b - keyword_set(xyindex), _EXTRA = ex305 , mask = tmask, onearth = 1b - keyword_set(xyindex), ROMSH = romsh, _EXTRA = ex 287 306 ENDIF ELSE BEGIN 288 307 computegrid, xaxis = xaxis, yaxis = yaxis, zaxis = zaxis $ 289 , mask = tmask, onearth = 1b - keyword_set(xyindex), _EXTRA = ex308 , mask = tmask, onearth = 1b - keyword_set(xyindex), ROMSH = romsh, _EXTRA = ex 290 309 ENDELSE 291 310 IF n_elements(time) EQ 0 THEN time = 0
Note: See TracChangeset
for help on using the changeset viewer.