Changeset 226 for trunk/SRC/ToBeReviewed/WIDGET/AUTOUR_de_XXX/scanfile.pro
- Timestamp:
- 03/16/07 10:22:26 (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SRC/ToBeReviewed/WIDGET/AUTOUR_de_XXX/scanfile.pro
r221 r226 5 5 ; @categories 6 6 ; 7 ; 7 ; 8 8 ; @param NAMEFILE 9 9 ; 10 ;11 10 ; @keyword GRID {default='T'}{type=scalar string} 12 11 ; Used to specify on which grid type are located the data … … 14 13 ; @keyword _EXTRA 15 14 ; Used to pass your keywords to isafile and ncdf_getaxis 16 ; 15 ; 17 16 ; @returns 18 ; 19 ; 17 ; 20 18 ; @uses 21 ; 22 ; 19 ; 23 20 ; @restrictions 24 ; 25 ; 21 ; 26 22 ; @examples 27 ; 28 ; 23 ; 29 24 ; @history 30 ; 31 ; 32 ; @version 25 ; 26 ; @version 33 27 ; $Id$ 34 28 ; 35 29 ; @todo 36 30 ; seb : I don't know what to do with that... 37 ; 31 ; 38 32 ;- 39 33 ; … … 49 43 ; dont les noms sont 'x','lon...','xi_...' et 'y','lat...' ou 50 44 ; 'eta_...' ou bien en majuscule. 51 ; 4) il doit exi ter ds ce fichier une unique variable n''ayant45 ; 4) il doit exister ds ce fichier une unique variable n''ayant 52 46 ; qu''une dimension et etant la dimension temporelle. cette 53 47 ; variable sera prise comme axe des temps. Rq: si plusieurs … … 55 49 ; variable 56 50 ; 5) Cette variable axe des temps doit contenir l''attribut 57 ; 'units' qui doit etre ecrit suivant la syntaxe:58 ; "seconds since 0001-01-01 00:00:00" 59 ; "hours since 0001-01-01 00:00:00" 60 ; "days since 1979-01-01 00:59:59" 61 ; "months since 1979-01-01 00:59:59" 62 ; "years since 1979-01-01 00:59:59" 51 ; 'units' qui doit etre ecrit suivant la syntaxe: 52 ; "seconds since 0001-01-01 00:00:00" 53 ; "hours since 0001-01-01 00:00:00" 54 ; "days since 1979-01-01 00:59:59" 55 ; "months since 1979-01-01 00:59:59" 56 ; "years since 1979-01-01 00:59:59" 63 57 ; 64 58 ; je crois que c''est tout! … … 93 87 namedim = strarr(inside.ndims) 94 88 for dimiq = 0, inside.ndims-1 do begin 95 ncdf_diminq, cdfid, dimiq, tmpname, value 89 ncdf_diminq, cdfid, dimiq, tmpname, value 96 90 namedim[dimiq] = strlowcase(tmpname) 97 91 ENDFOR … … 110 104 (inter(invar.dim, dimidy))[0] NE -1 AND $ 111 105 ((where(invar.dim EQ inside.recdim))[0] NE -1 OR inside.recdim EQ -1) $ 112 THEN namevar[varid] = invar.name 106 THEN namevar[varid] = invar.name 113 107 ENDFOR 114 108 namevar = namevar[where(namevar NE '')] … … 135 129 tmpnm[0] EQ 'xi_u' AND tmpnm[1] EQ 'eta_rho':listgrid[i] = 'U' 136 130 tmpnm[0] EQ 'xi_u' AND tmpnm[1] EQ 'eta_v' :listgrid[i] = 'F' 137 ELSE: 138 ENDCASE 131 ELSE: 132 ENDCASE 139 133 ENDFOR 140 134 empty = where(listgrid EQ '') 141 IF empty[0] NE -1 THEN BEGIN 135 IF empty[0] NE -1 THEN BEGIN 142 136 ; could we define the grid type from the file name?? 143 137 pattern = ['GRID.', 'GRID_', 'GRID', 'UPID_', '30ID_'] … … 153 147 ENDFOR 154 148 listgrid[empty] = vargrid 155 ENDIF 149 ENDIF 156 150 ENDIF ELSE listgrid[*] = vargrid 157 151 ;------------------------------------------------------------ … … 159 153 ;------------------------------------------------------------ 160 154 date0fk = date2jul(19000101) 161 IF inside.recdim EQ -1 THEN BEGIN 155 IF inside.recdim EQ -1 THEN BEGIN 162 156 jpt = 1 163 157 time = date0fk … … 170 164 repeat BEGIN 171 165 IF varid LT inside.nvars THEN BEGIN 172 invar = ncdf_varinq(cdfid, varid) 173 varid = varid+1 166 invar = ncdf_varinq(cdfid, varid) 167 varid = varid+1 174 168 ENDIF ELSE varid = 0 175 169 endrep until (n_elements(invar.dim) EQ 1 AND invar.dim[0] EQ inside.recdim) OR (varid EQ 0) … … 177 171 ; 178 172 CASE 1 OF 179 varid EQ -1:BEGIN 173 varid EQ -1:BEGIN 180 174 dummy = report('the file '+fullname+' has no time axis.!C we create a fake calendar ...') 181 175 fakecal = 1 182 176 time = date0fk + lindgen(1>jpt) 183 177 END 184 invar.natts EQ 0:BEGIN 178 invar.natts EQ 0:BEGIN 185 179 dummy = report('the variable '+invar.name+' has no attribut.!C we create a fake calendar ...') 186 180 fakecal = 1 … … 197 191 fakecal = 1 198 192 time = date0fk + lindgen(1>jpt) 199 ENDIF ELSE BEGIN 193 ENDIF ELSE BEGIN 200 194 ; we read the time axis 201 195 ncdf_varget, cdfid, varid, time … … 223 217 err = 1 224 218 ENDIF 225 IF err GT 0 THEN BEGIN 219 IF err GT 0 THEN BEGIN 226 220 fakecal = 1 227 221 time = date0fk + lindgen(1>jpt) 228 ENDIF ELSE BEGIN 222 ENDIF ELSE BEGIN 229 223 debut = str_sep(mots[2], '-') 230 224 ; … … 241 235 'greg':IF n_elements(key_caltype) EQ 0 THEN key_caltype = 'greg' 242 236 ELSE:BEGIN 243 ; notused = report('Unknown calendar: '+value+', we use greg calendar.') 237 ; notused = report('Unknown calendar: '+value+', we use greg calendar.') 244 238 key_caltype = 'greg' 245 239 END 246 240 ENDCASE 247 241 ENDIF ELSE BEGIN 248 ; notused = report('Unknown calendar, we use '+key_caltype+' calendar.') 242 ; notused = report('Unknown calendar, we use '+key_caltype+' calendar.') 249 243 IF n_elements(key_caltype) EQ 0 THEN key_caltype = 'greg' 250 244 ENDELSE … … 259 253 'hour':time = julday(debut[1], debut[2], debut[0])+time/24.d 260 254 'day':time = julday(debut[1], debut[2], debut[0])+time 261 'month':BEGIN 255 'month':BEGIN 262 256 if total(fix(time) NE time) NE 0 then $ ; we switch to days with 30d/m 263 257 time = julday(debut[1], debut[2], debut[0])+round(time*30) $
Note: See TracChangeset
for help on using the changeset viewer.