Changeset 174 for trunk/SRC/ToBeReviewed
- Timestamp:
- 09/12/06 09:07:57 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SRC/ToBeReviewed/LECTURE/read_ncdf.pro
r172 r174 27 27 ; See BEGINNING. 28 28 ; 29 ; @param COMPATIBILITY {in}{ required}30 ; Useless 29 ; @param COMPATIBILITY {in}{optional} 30 ; Useless, defined for compatibility 31 31 ; 32 32 ; @keyword BOXZOOM 33 33 ; Contain the boxzoom on which we have to do the reading 34 34 ; 35 ; @keyword FILENAME {type=string} 35 ; @keyword CALLITSELF {default=0}{type=scalar: 0 or 1} 36 ; For ROMS outputs. Use by read_ncdf itself to access auxilliary data (h and zeta). 37 ; 38 ; @keyword FILENAME {required}{type=string} 36 39 ; It contains he file's name. 37 40 ; 38 ; @keyword INIT 41 ; @keyword INIT {default=0}{type=scalar: 0 or 1} 39 42 ; To call automatically initncdf, filename and thus 40 43 ; redefine all the grid parameters … … 46 49 ; is not found. 47 50 ; 48 ; @keyword TIMESTEP 49 ; We activate to specify that BEGINNING and ENDING refer to indexes 50 ; of the time axis and not to dates 51 ; 52 ; @keyword TOUT 51 ; @keyword TIMESTEP {default=0}{type=scalar: 0 or 1} 52 ; Specify that BEGINNING and ENDING refer to indexes of the time axis and not to dates 53 ; 54 ; @keyword TOUT {default=0}{type=scalar: 0 or 1} 53 55 ; We activate it if we want to read the file on the whole domain without 54 56 ; considerate the sub-domain defined by the boxzoom or 55 57 ; lon1,lon2,lat1,lat2,vert1,vert2. 56 58 ; 57 ; @keyword NOSTRUCT 59 ; @keyword NOSTRUCT {default=0}{type=scalar: 0 or 1} 58 60 ; We activate it if we do not want that read_ncdf send back a structure 59 61 ; but only the array referring to the field. … … 64 66 ; is no unlimited dimension or if the time axis selected by default 65 67 ; (the first 1D array with unlimited dimension) is not the good one. 68 ; 69 ; @keyword HFILENAME {default=FILENAME}{type=string} 70 ; For ROMS outputs. The filename of the file where h vriable should be read 71 ; 72 ; @keyword ZETAFILENAME {default=FILENAME}{type=string} 73 ; For ROMS outputs. The filename of the file where zeta vriable should be read 74 ; 75 ; @keyword ZETAZERO {default=0}{type=scalar: 0 or 1} 76 ; For ROMS outputs. To define zeta to 0. instead of reading it 66 77 ; 67 78 ; @keyword _EXTRA … … 91 102 , PARENTIN = parentin, TIMESTEP = timestep, TIMEVAR = timevar $ 92 103 , TOUT = tout, NOSTRUCT = nostruct, CONT_NOFILL = CONT_NOFILL, INIT = init $ 93 , GRID = grid, FBASE2TBASE = fbase2tbase, _EXTRA = ex, CALLITSELF = callitself 104 , GRID = grid, FBASE2TBASE = fbase2tbase, CALLITSELF = callitself $ 105 , HFILENAME = hfilename, ZETAFILENAME = zetafilename, ZETAZERO = zetazero $ 106 , _EXTRA = ex 94 107 ;--------------------------------------------------------- 95 108 ; … … 547 560 ncdf_attget, cdfid, 'theta_b', theta_b, /global 548 561 ncdf_attget, cdfid, 'hc', hc, /global 549 ; +++ binder l'exsitance de h et zeta... 550 ; +++ mettre zeta a 0 par defaut 551 hroms = read_ncdf('h', 0, 0, FILENAME = filename $ 552 , /TIMESTEP, /NOSTRUCT, CONT_NOFILL = CONT_NOFILL $ 553 , GRID = vargrid, /CALLITSELF, _EXTRA = ex) 554 zeta = read_ncdf('zeta', firsttps, lasttps, FILENAME = filename $ 555 , /TIMESTEP, /NOSTRUCT, CONT_NOFILL = CONT_NOFILL $ 556 , GRID = vargrid, /CALLITSELF, _EXTRA = ex) 562 ; look for all variables names 563 allvarnames = strarr(varcontient.nvars) 564 FOR i = 0, varcontient.nvars-1 DO BEGIN 565 tmp = ncdf_varinq( cdfid, i) 566 allvarnames[i] = tmp.name 567 ENDFOR 568 CASE 1 OF 569 keyword_set(hfilename): $ 570 hroms = read_ncdf('h', 0, 0, FILENAME = hfile $ 571 , /TIMESTEP, /NOSTRUCT, CONT_NOFILL = CONT_NOFILL $ 572 , GRID = vargrid, /CALLITSELF, _EXTRA = ex) 573 (where(allvarnames EQ 'h'))[0] NE -1: $ 574 hroms = read_ncdf('h', 0, 0, FILENAME = filename $ 575 , /TIMESTEP, /NOSTRUCT, CONT_NOFILL = CONT_NOFILL $ 576 , GRID = vargrid, /CALLITSELF, _EXTRA = ex) 577 ELSE:return, report('The variable h was not found in the file, please use the keyword HFILENAME to specify the name of a file containing h') 578 ENDCASE 579 CASE 1 OF 580 keyword_set(zetazero):zeta = fltarr(nx, ny, jpt) 581 keyword_set(zetafilename): $ 582 zeta = read_ncdf('zeta', firsttps, lasttps, FILENAME = zetafilename $ 583 , /TIMESTEP, /NOSTRUCT, CONT_NOFILL = CONT_NOFILL $ 584 , GRID = vargrid, /CALLITSELF, _EXTRA = ex) 585 (where(allvarnames EQ 'h'))[0] NE -1: $ 586 zeta = read_ncdf('zeta', firsttps, lasttps, FILENAME = filename $ 587 , /TIMESTEP, /NOSTRUCT, CONT_NOFILL = CONT_NOFILL $ 588 , GRID = vargrid, /CALLITSELF, _EXTRA = ex) 589 ELSE:return, report('The variable zeta was not found in the file, please use the keyword ZETAFILENAME to specify the name of a file containing zeta or use keyword ZETAZERO to define zeta to 0.') 590 ENDCASE 557 591 romszinfos = {h:temporary(hroms), zeta:temporary(zeta), theta_s:theta_s, theta_b:theta_b, hc:hc} 558 592 ENDIF ELSE romszinfos = {h:-1, zeta:-1, theta_s:-1, theta_b:-1, hc:-1}
Note: See TracChangeset
for help on using the changeset viewer.