Changeset 12
- Timestamp:
- 12/12/06 14:48:59 (17 years ago)
- Location:
- trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/divfred.pro
r2 r12 44 44 ; EXAMPLE: 45 45 ; 46 ; MODIFICATION HISTORY:Guillaume Roullet (grlod @ipsl.jussieu.fr)46 ; MODIFICATION HISTORY:Guillaume Roullet (grlod\@ipsl.jussieu.fr) 47 47 ; Creation : printemps 1998 48 ; Sebastien Masson (smasson @lodyc.jussieu.fr)48 ; Sebastien Masson (smasson\@lodyc.jussieu.fr) 49 49 ; adaptation pour marcher avec un domaine reduit 50 50 ; 12/1/2000 -
trunk/grad.pro
r2 r12 25 25 ; EXAMPLE: 26 26 ; 27 ; MODIFICATION HISTORY:Sebastien Masson (smasson @lodyc.jussieu.fr)27 ; MODIFICATION HISTORY:Sebastien Masson (smasson\@lodyc.jussieu.fr) 28 28 ; 29 29 ;- -
trunk/rseries_ncdf.pro
r11 r12 1 ;------------------------------------------------------------2 ;------------------------------------------------------------3 1 ;------------------------------------------------------------ 4 2 ;+ 5 ; NAME: rseries_ncdf 6 ; 7 ; PURPOSE: reading timeseries writing on many files. 8 ; 9 ; CATEGORY: upper read_ncdf 10 ; 11 ; CALLING SEQUENCE: res = rseries_ncdf(var, date1, date2[, exp[, freq]]) 12 ; 13 ; INPUTS: 14 ; var: a scalar string; the name of the variable to be read 15 ; 16 ; date1: a saclar giving the first date of the time 17 ; series. Date format is ymmdd, yymmdd, yyymmdd, yyyymmdd, 18 ; yyyyymmdd, yyyyyymmdd. 19 ; 20 ; date2: same as date2 21 ; 22 ; exp: a scalar string; the name of the experiment. If exp is 23 ; undefined, exp = varexp. 24 ; 25 ; 26 ; freq: a scalar string; the averaging frequency. if freq is 27 ; undefined, freq = '5d' 28 ; 29 ; KEYWORD PARAMETERS: 30 ; 31 ; CENTURY: and interger giving the true century of the 32 ; calendar. for example if filename is 33 ; AA5_5d_920101_921231* and the calendar variable in the file 34 ; is 19920101 to 19921231 then CENTURY=19 35 ; 36 ; /NOSTRUCT: Set this keyword to return an array instead of a 37 ; structure. 38 ; 39 ; NDAYSPM: developpe par eric, ca veut dire: nombre de jours par mois! 40 ; par defaut c''est 30, sinon le specifier en donnant 41 ; une valeur a ndayspm 42 ; pour passer a un calendrier avec un nombre de jours constant par 43 ; mois. Utilise en particulier ds julday et caldat 44 ; 45 ; OUTPUTS: 46 ; 47 ; a structure: with the folowing Structure Tags: 48 ; arr:the array output 49 ; grid: the array grid 50 ; units: the array units 51 ; experiment: the name of the experiment 52 ; name: the name of the variable 53 ; 54 ; COMMON BLOCKS:common.pro 55 ; 56 ; SIDE EFFECTS: 57 ; 58 ; Update the time and jpt common variables. Time is the 59 ; calendar in IDL julian days. 60 ; 61 ; 62 ; RESTRICTIONS: 63 ; 64 ; 1) The file must contain an unlimited dimension, and the 65 ; variable to be read must contain this unlimited dimension. 66 ; 2) The file must contain a one dimension variable which 67 ; dimension is the unlimited dimension. This variable is the 68 ; calendar. 69 ; 3) This variable calendar must have an attribut called "units" 70 ; which must have a format similar to 71 ; "seconds since 0001-01-01 00:00:00" 72 ; "hours since 0001-01-01 00:00:00" 73 ; "days since 1979-01-01 00:00:00" 74 ; "months since 1979-01-01 00:00:00" 75 ; "years since 1979-01-01 00:00:00" 76 ; 4) The calendar must be the Gregorian calendar 77 ; 5) The name of the file must begining by 78 ; exp_freq_datefirst_datelast_* 79 ; 6) The maximum gap between 2 consecutive files must be one 80 ; day. 81 ; 82 ; 83 ; EXAMPLE:res = rseries_ncdf('sozotaux',920501,930410,'AA5','5d') 84 ; 85 ; MODIFICATION HISTORY:Sebastien Masson (smasson@lodyc.jussieu.fr) 86 ; Apr 23 2001 3 ; @file_comments 4 ; reading timeseries writing on many files 5 ; 6 ; @categories 7 ; Reading 8 ; 9 ; @param var {in} {type=string} 10 ; the name of the variable to be read 11 ; 12 ; @param date1 {in} {type=scalar} 13 ; give the first date of the time series. 14 ; Date format is ymmdd, yymmdd, yyymmdd, yyyymmdd, yyyyymmdd, yyyyyymmdd. 15 ; 16 ; @param date2 {in} {type=scalar} 17 ; give the last date of the time series. 18 ; Date format is ymmdd, yymmdd, yyymmdd, yyyymmdd, yyyyymmdd, yyyyyymmdd. 19 ; 20 ; @param expin {in} {type=string} {default=varexp} 21 ; the name of the experiment. 22 ; 23 ; @param freqin {in} {type=string} {default='5d'} 24 ; the averaging frequency. 25 ; 26 ; @keyword CENTURY {type=integer} 27 ; give the true century of the calendar. 28 ; for example if filename is AA5_5d_920101_921231* and the calendar variable 29 ; in the file is 19920101 to 19921231 then CENTURY=19 30 ; 31 ; @keyword NOSTRUCT {default=1} 32 ; Set this keyword to return an array instead of a structure. 33 ; 34 ; @keyword GRIDTYPE {type=string} 35 ; name of the grid to be read 'grid_T' ++'gridT' 36 ; 37 ; @keyword _EXTRA 38 ; Used to pass read_ncdf keywords 39 ; 40 ; @returns 41 ; a structure with the following Structure Tags: 42 ; arr:the array output 43 ; grid: the array grid 44 ; units: the array units 45 ; experiment: the name of the experiment 46 ; name: the name of the variable 47 ; 48 ; @uses 49 ; common.pro 50 ; 51 ; @restrictions 52 ; Update the time and jpt common variables. 53 ; Time is the calendar in IDL julian days. 54 ; 1) The file must contain an unlimited dimension, and the 55 ; variable to be read must contain this unlimited dimension. 56 ; 2) The file must contain a one dimension variable which 57 ; dimension is the unlimited dimension. This variable is the 58 ; calendar. 59 ; 3) This variable calendar must have an attribut called "units" 60 ; which must have a format similar to 61 ; "seconds since 0001-01-01 00:00:00" 62 ; "hours since 0001-01-01 00:00:00" 63 ; "days since 1979-01-01 00:00:00" 64 ; "months since 1979-01-01 00:00:00" 65 ; "years since 1979-01-01 00:00:00" 66 ; 4) The calendar must be the Gregorian calendar 67 ; 5) The name of the file must begining by 68 ; exp_freq_datefirst_datelast_* 69 ; 6) The maximum gap between 2 consecutive files must be one day. 70 ; 71 ; @examples 72 ; IDL> res = rseries_ncdf('sozotaux',920501,930410,'AA5','5d') 73 ; 74 ; for ORCA2 outputs 75 ; IDL> iodir='/usr/work/sur/fvi/OPA/ORCA2/' 76 ; IDL> res= rseries_ncdf('votemper',010101,061231,'ESS','5d') 77 ; IDL> help,res,/structure 78 ; 79 ;** Structure <310ebc0>, 5 tags, length=1800, data length=1800, refs=1: 80 ; ARR FLOAT Array[1, 1, 1, 438] 81 ; GRID STRING 'T' 82 ; UNITS STRING 'C' 83 ; EXPERIMENT STRING 'ESS_5d_060101_061231_grid_T.nc' 84 ; NAME STRING 'votemper' 85 ; 86 ; @history 87 ; Sebastien Masson (smasson\@lodyc.jussieu.fr) Apr 23 2001 88 ; 89 ; @todo 90 ; adaptation to Drakkar terminologie 91 ; ORCA2 terminology of output files 92 ; <i>experience</i>_5d_<i>yymmdd</i>_<i>yymmdd</i>_<i>grid</i>.nc 93 ; with experience in 'ESS' 94 ; with grid in 'grid_T' 95 ; 96 ; ORCA025 terminology of output files 97 ; /u/rech/cli/rcli002/ORCA025/ORCA025-<i>experience_drakkar<i>-S/<i>year_drakkar</i>/ORCA025-<i>experience_drakkar</i>-y<i>year_drakkar</i>n<i>mois</i>d<i>jour</i>_<i>grid</i>.nc 98 ; with experience_drakkar in 'G70', 99 ; with grid in 'gridT' 100 ; 101 ; @version 102 ; $Id$ 87 103 ;- 88 104 ;------------------------------------------------------------ 89 105 ;------------------------------------------------------------ 90 106 ;------------------------------------------------------------ 91 FUNCTION rseries_ncdf, var, date1, date2, expin, freqin, CENTURY = century, NOSTRUCT = nostruct, GRIDTYPE = gridtype, _ extra= ex107 FUNCTION rseries_ncdf, var, date1, date2, expin, freqin, CENTURY = century, NOSTRUCT = nostruct, GRIDTYPE = gridtype, _EXTRA = ex 92 108 @common 93 109 ; name of the file: exp_freq_datefirst_datelast_* … … 118 134 datefirst = lonarr(npos) 119 135 datelast = lonarr(npos) 120 sepshift = n_elements(str_sep(exp, sep))-1 136 sepshift = n_elements(str_sep(exp, sep))-1 121 137 for i = 0, npos-1 do BEGIN 122 138 separate = str_sep(possiblenames[i], sep) … … 130 146 'y':div = 10000 131 147 ELSE:div = 1 132 ENDCASE 148 ENDCASE 133 149 goodfile = where(datefirst le date1/div and datelast GE date1/div) 134 150 if goodfile[0] EQ -1 then return, report('filename :'+iodir+exp+sep+freq+'*'+gridtype+'.nc'+' not found with the dates containing '+strtrim(date1, 1)) … … 230 246 'y':div = 10000*datelast+360+(5+leapyr(datelast+century))*(key_caltype EQ 'greg') 231 247 ELSE:div = 1 232 ENDCASE 248 ENDCASE 233 249 if date2 GT datelast THEN BEGIN 234 250 ; if we need to read more than one file, … … 270 286 ENDELSE 271 287 ENDCASE 272 endif ELSE BEGIN 288 endif ELSE BEGIN 273 289 res = read_ncdf(var, date1+century*1000000L, date2+century*1000000L $ 274 290 , filename = filename, /nostruct, _extra = ex)
Note: See TracChangeset
for help on using the changeset viewer.