[2] | 1 | ;------------------------------------------------------------ |
---|
| 2 | ;------------------------------------------------------------ |
---|
| 3 | ;------------------------------------------------------------ |
---|
| 4 | ;+ |
---|
[97] | 5 | ; @file_comments lit les fichiers Net-Cdf de l'experience TOTEM/ECMWF qui sont sur |
---|
[2] | 6 | ; maia: /u/rech/eee/reee217/TOTEM/REF/OUTPUTS |
---|
[97] | 7 | ; @obsolete |
---|
[2] | 8 | ; |
---|
[97] | 9 | ; @param name {in}{required} nom du tableau contenant le champ que l'on veut (le |
---|
[2] | 10 | ; trouver avec ncdflec,fichier,/var |
---|
| 11 | ; |
---|
[97] | 12 | ; @param debut {in} nombres de 6 ou 8 chiffres (anneemoisjour, par ex:19980507) |
---|
| 13 | ; @param fin {in} nombres de 6 ou 8 chiffres (anneemoisjour, par ex:19980507) |
---|
| 14 | ; @param nomexperience {in}{optional} trois lettres designant le nom de l'experience |
---|
[2] | 15 | ; |
---|
| 16 | ; |
---|
[97] | 17 | ; @keyword BOITE boite sur laquelle integrer (par defaut tt le domaine) |
---|
[2] | 18 | ; |
---|
[97] | 19 | ; @keyword DIREC: 'x' 'y' 'z' 'xy' 'xz' 'yz' 'xyz' directions selon lesquelles |
---|
[2] | 20 | ; effectuer les moyennes (si rien n'est donne on n'effectue pas de moyenne) |
---|
| 21 | ; |
---|
[97] | 22 | ; @keyword GRILLE impose la grille a laquelle est rapporte le champ. rq permet |
---|
[2] | 23 | ; d'aller plus vite ds la lecture |
---|
| 24 | ; |
---|
[97] | 25 | ; @keyword /TOUT oblige a lire le tableau entier en non pas celui reduit a domdef |
---|
[2] | 26 | ; |
---|
[97] | 27 | ; @uses common.pro vraidate juldate nlec5j nlecserie |
---|
[2] | 28 | ; |
---|
[97] | 29 | ; @history Sebastien Masson (smasson\@lodyc.jussieu.fr) |
---|
| 30 | ; 14/8/98 |
---|
[2] | 31 | ;- |
---|
| 32 | ;------------------------------------------------------------ |
---|
| 33 | ;REF.07.790101.grid.T.nc |
---|
| 34 | ;REF.07.790101.grid.U.nc |
---|
| 35 | ;REF.07.790101.grid.V.nc |
---|
| 36 | ;REF.07.790101.grid.W.nc |
---|
| 37 | ;------------------------------------------------------------ |
---|
| 38 | ;------------------------------------------------------------ |
---|
| 39 | function nlec,name,debut,fin,nomexperience,BOITE=boite,DIREC=direc,GRILLE=grille,TOUT=tout $ |
---|
| 40 | , STRUCTURE = structure, SEUILMIN = seuilmin, SEUILMAX = seuilmax, NAN = nan $ |
---|
| 41 | , _EXTRA = ex |
---|
[114] | 42 | ; |
---|
| 43 | compile_opt idl2, strictarrsubs, obsolete |
---|
| 44 | ; |
---|
[2] | 45 | @common |
---|
| 46 | ;------------------------------------------------------------ |
---|
| 47 | tempsun = systime(1) ; pour key_performance |
---|
| 48 | nom=strlowcase(name) |
---|
| 49 | ;------------------------------------------------------------ |
---|
| 50 | ; specification de la date et de l'experience |
---|
| 51 | ;------------------------------------------------------------ |
---|
| 52 | case n_params() of |
---|
| 53 | 1:BEGIN |
---|
| 54 | year=year+1900*(year ne 0 and year ne -1 and year lt 100) |
---|
| 55 | date = day+100*month+10000*year |
---|
| 56 | end |
---|
| 57 | 2:BEGIN |
---|
| 58 | if size(debut, /tname) EQ 'STRING' then begin |
---|
| 59 | prefix = strupcase(debut) |
---|
| 60 | year=year+1900*(year ne 0 and year ne -1 and year lt 100) |
---|
| 61 | date = day+100*month+10000*year |
---|
| 62 | ENDIF ELSE BEGIN |
---|
| 63 | date = debut |
---|
| 64 | rien=juldate(date) |
---|
| 65 | ENDELSE |
---|
| 66 | end |
---|
| 67 | 3:begin |
---|
| 68 | date = debut |
---|
| 69 | rien=juldate(date) |
---|
| 70 | if size(fin, /tname) EQ 'STRING' then begin |
---|
| 71 | prefix = strupcase(fin) |
---|
| 72 | ENDIF ELSE BEGIN |
---|
| 73 | date2=vraidate(fin) |
---|
| 74 | year2=date2/10000 |
---|
| 75 | month2=date2/100 - year2*100 |
---|
| 76 | day2=date2 - year2*10000 - month2*100 |
---|
| 77 | ENDELSE |
---|
| 78 | end |
---|
| 79 | 4:BEGIN |
---|
| 80 | date = debut |
---|
| 81 | rien=juldate(date) |
---|
| 82 | if size(nomexperience, /tname) EQ 'STRING' then begin |
---|
| 83 | prefix = strupcase(nomexperience) |
---|
| 84 | date2 = fin |
---|
| 85 | ENDIF ELSE BEGIN |
---|
| 86 | prefix = strupcase(fin) |
---|
| 87 | date2 = nomexperience |
---|
| 88 | ENDELSE |
---|
| 89 | date2=vraidate(date2) |
---|
| 90 | year2=date2/10000 |
---|
| 91 | month2=date2/100 - year2*100 |
---|
| 92 | day2=date2 - year2*10000 - month2*100 |
---|
| 93 | end |
---|
| 94 | endcase |
---|
| 95 | date = long(date) |
---|
| 96 | if n_elements(date2) NE 0 then date2 = long(date2) |
---|
| 97 | if n_elements(date2) NE 0 then if date2 eq date then tempvar = SIZE(TEMPORARY(date2)) |
---|
| 98 | ;------------------------------------------------------------ |
---|
| 99 | ; verification de la coherence des dates |
---|
| 100 | ;------------------------------------------------------------ |
---|
| 101 | if n_elements(date2) ne 0 then begin |
---|
| 102 | if (day EQ 0 AND day2 NE 0) OR (month EQ 0 AND month2 NE 0) OR $ |
---|
| 103 | (year EQ 0 AND year2 NE 0) or (day2 EQ 0 AND day NE 0) OR $ |
---|
| 104 | (month2 EQ 0 AND month NE 0) OR (year2 EQ 0 AND year NE 0) then $ |
---|
| 105 | return, report('verifier la coherence des dates') |
---|
| 106 | if date2 le date then return, report('date2 doit etre posterieure a date') |
---|
| 107 | endif |
---|
| 108 | ;------------------------------------------------------------ |
---|
| 109 | ; case sur le type de fichiers que l'on veut lire. |
---|
| 110 | ; determination ds chaque cas de numsortie et nbretps |
---|
| 111 | ;------------------------------------------------------------ |
---|
| 112 | if day NE 0 then begin ; SORTIES A 5 JOURS |
---|
| 113 | ;------------------------------------------------------------ |
---|
| 114 | ; numsortie |
---|
| 115 | ;------------------------------------------------------------ |
---|
| 116 | testjour: |
---|
[44] | 117 | numsortie=((1+julday(month,day,year)-julday(1,1,year))/5.)[0] |
---|
[2] | 118 | if numsortie ne floor(numsortie) then begin |
---|
| 119 | if n_elements(date2) ne 0 then begin |
---|
| 120 | caldat,julday(month,day+1,year),month,day,year |
---|
| 121 | goto, testjour |
---|
| 122 | endif |
---|
| 123 | return, -1 |
---|
| 124 | ENDIF |
---|
| 125 | numsortie = long(numsortie) |
---|
| 126 | ;------------------------------------------------------------ |
---|
| 127 | ; determination du nombre de pas de tps a extraire pour la serie temporelle |
---|
| 128 | ; entiere: nbretps |
---|
| 129 | ;------------------------------------------------------------ |
---|
| 130 | if n_elements(date2) ne 0 then begin |
---|
| 131 | testjour2: |
---|
| 132 | numsortie2=(1+julday(month2,day2,year2)-julday(1,1,year2))/5. |
---|
| 133 | if numsortie2 ne floor(numsortie2) then begin |
---|
| 134 | caldat,julday(month2,day2-1,year2),month2,day2,year2 |
---|
| 135 | goto, testjour2 |
---|
| 136 | endif |
---|
| 137 | if year eq year2 then nbretps=numsortie2-numsortie+1 else $ |
---|
| 138 | nbretps=(73-numsortie+1)+(year2-year-1)*73+numsortie2 |
---|
| 139 | numsortie2 = long(numsortie2) |
---|
| 140 | endif else nbretps=1 |
---|
| 141 | nbretps = long(nbretps) |
---|
| 142 | ;------------------------------------------------------------ |
---|
| 143 | ; si on fait une serie temporelle on cherche a lire plutot un fichier |
---|
| 144 | ; contenant deja une serie temporelle par contre pour une sortie |
---|
| 145 | ; unique on cherche d'abord a lire un fichier contenant toutes les variables. |
---|
| 146 | ;------------------------------------------------------------ |
---|
| 147 | IF n_elements(date2) ne 0 THEN BEGIN |
---|
| 148 | serie: |
---|
| 149 | IF n_elements(dejaserie) eq 1 then return, -1 |
---|
| 150 | datejul = 5*numsortie-1+julday(1, 1, year) |
---|
| 151 | if n_elements(date2) ne 0 then date2jul = 5*numsortie2-1+julday(1, 1, year2) $ |
---|
| 152 | ELSE date2jul = datejul |
---|
| 153 | res = nlecserie(nom, datejul, date2jul,BOITE=boite,GRILLE=grille,TOUT=tout, _EXTRA = ex) |
---|
| 154 | IF res[0] EQ -1 THEN BEGIN |
---|
| 155 | dejaserie = 1 |
---|
| 156 | GOTO, passerie |
---|
| 157 | ENDIF |
---|
| 158 | ENDIF ELSE BEGIN |
---|
| 159 | passerie: |
---|
| 160 | IF n_elements(dejapasserie) eq 1 then return, -1 |
---|
| 161 | res = nlec5j( nom, numsortie , nbretps,BOITE=boite,GRILLE=grille,TOUT=tout, _EXTRA = ex) |
---|
| 162 | IF res[0] EQ -1 THEN BEGIN |
---|
| 163 | dejapasserie = 1 |
---|
| 164 | GOTO, serie |
---|
| 165 | ENDIF |
---|
| 166 | endelse |
---|
| 167 | ENDIF ELSE BEGIN |
---|
| 168 | CASE 1 of |
---|
| 169 | month NE 0 AND year NE 0:BEGIN ; SORTIES MENSUELLES |
---|
| 170 | numsortie79 = (year-1979)*12+month |
---|
| 171 | if n_elements(date2) ne 0 then nbretps = month2-month+1+12*(year2-year) $ |
---|
| 172 | ELSE nbretps = 1 |
---|
| 173 | res = nlecmois(nom,numsortie79,nbretps ,BOITE=boite,GRILLE=grille,TOUT=tout, _EXTRA = ex) |
---|
| 174 | end |
---|
| 175 | month EQ 0 AND year NE 0:BEGIN ; SORTIES ANNUELLES |
---|
| 176 | numsortie79 = (year-1978) |
---|
| 177 | if n_elements(date2) ne 0 then nbretps = year2-year+1 $ |
---|
| 178 | ELSE nbretps = 1 |
---|
| 179 | res = nlecan(nom,numsortie79,nbretps ,BOITE=boite,GRILLE=grille,TOUT=tout, _EXTRA = ex) |
---|
| 180 | end |
---|
| 181 | month NE 0 AND year EQ 0:BEGIN ; SORTIES SAISONNIERES |
---|
| 182 | numsortie79 = month |
---|
| 183 | if n_elements(date2) ne 0 then nbretps = month2-month+1 $ |
---|
| 184 | ELSE nbretps = 1 |
---|
| 185 | res = nlecsaison(nom,numsortie79,nbretps ,BOITE=boite,GRILLE=grille,TOUT=tout, _EXTRA = ex) |
---|
| 186 | end |
---|
| 187 | month EQ 0 AND year EQ 0:BEGIN ; SORTIES CLIMATOLOGIQUE |
---|
| 188 | numsortie79 = 13 |
---|
| 189 | nbretps = 1 |
---|
| 190 | res = nlecsaison(nom,numsortie79,nbretps ,BOITE=boite,GRILLE=grille,TOUT=tout, _EXTRA = ex) |
---|
| 191 | end |
---|
| 192 | endcase |
---|
| 193 | endelse |
---|
| 194 | ;------------------------------------------------------------ |
---|
| 195 | ; seuil |
---|
| 196 | ;------------------------------------------------------------ |
---|
| 197 | if n_elements(seuilmin) NE 0 then BEGIN |
---|
| 198 | if n_elements(valmask) EQ 0 then valmask = 1e20 |
---|
| 199 | terre = where(res GT valmask/10.) |
---|
| 200 | res = seuilmin > res |
---|
| 201 | if terre[0] NE -1 then res[terre] = valmask |
---|
| 202 | undefine, terre |
---|
| 203 | endif |
---|
| 204 | if n_elements(seuilmax) NE 0 then begin |
---|
| 205 | if n_elements(valmask) EQ 0 then valmask = 1e20 |
---|
| 206 | terre = where(res GT valmask/10.) |
---|
| 207 | res = res < seuilmax |
---|
| 208 | if terre[0] NE -1 then res[terre] = valmask |
---|
| 209 | undefine, terre |
---|
| 210 | endif |
---|
| 211 | ;------------------------------------------------------------ |
---|
| 212 | ; points a metre a nan |
---|
| 213 | ;------------------------------------------------------------ |
---|
| 214 | if n_elements(nan) NE 0 then BEGIN |
---|
| 215 | if n_elements(valmask) EQ 0 then valmask = 1e20 |
---|
| 216 | if abs(valmask) LT 1e6 then terre = where(abs(res) GT abs(valmask)/10.) $ |
---|
| 217 | ELSE terre = where(res EQ valmask) |
---|
| 218 | if abs(nan) LT 1e6 then notan = where(res EQ nan) $ |
---|
| 219 | ELSE notan = where(abs(res) GT abs(nan)) |
---|
| 220 | if notan[0] NE -1 then res[notan] = !values.f_nan |
---|
| 221 | notan = notan[0] NE -1 |
---|
| 222 | if terre[0] NE -1 then res[terre] = valmask |
---|
| 223 | undefine, terre |
---|
| 224 | endif |
---|
| 225 | ;------------------------------------------------------------ |
---|
| 226 | ; ajustement de niveau pour les tableau 2d simples |
---|
| 227 | ;------------------------------------------------------------ |
---|
| 228 | if jpt EQ 1 then begin |
---|
| 229 | taille = size(res) |
---|
| 230 | IF taille[0] EQ 2 THEN niveau = 1 |
---|
| 231 | endif |
---|
| 232 | ;------------------------------------------------------------ |
---|
| 233 | ; moyenne eventuelle |
---|
| 234 | ;------------------------------------------------------------ |
---|
| 235 | IF keyword_set(direc) THEN BEGIN |
---|
| 236 | IF jpt EQ 1 THEN res = moyenne(res,direc,BOITE=boite, nan = notan) $ |
---|
| 237 | ELSE res = grossemoyenne(res,direc,BOITE=boite, nan = notan) |
---|
| 238 | ENDIF |
---|
| 239 | ;------------------------------------------------------------ |
---|
| 240 | ; mise en placer des parametres pour le trace... |
---|
| 241 | ;------------------------------------------------------------ |
---|
| 242 | ; if keyword_set(boite) then legende_pltt = boite ELSE legende_pltt = [lon1, lon2, lat1, lat2] |
---|
| 243 | ;------------------------------------------------------------ |
---|
| 244 | ; IF n_elements(res) NE 1 THEN res = reform(res,/over) |
---|
| 245 | IF NOT keyword_set(direc) THEN domdef, lon1, lon2, lat1, lat2, prof1, prof2, _extra = ex, grille = vargrid $ |
---|
| 246 | ELSE if direc eq 't' then domdef, lon1, lon2, lat1, lat2, prof1, prof2, _extra = ex, grille = vargrid |
---|
| 247 | ;------------------------------------------------------------ |
---|
| 248 | if keyword_set(structure) then res = {tab:res, grille:vargrid, unite:varunit, experience:varexp, nom:varname} |
---|
| 249 | ;------------------------------------------------------------ |
---|
| 250 | if keyword_set(key_performance) THEN print, 'temps nlec', systime(1)-tempsun |
---|
[44] | 251 | time = time-2l |
---|
[2] | 252 | return,res |
---|
| 253 | ;------------------------------------------------------------ |
---|
| 254 | ;------------------------------------------------------------ |
---|
| 255 | end |
---|
| 256 | |
---|
| 257 | |
---|
| 258 | |
---|
| 259 | |
---|
| 260 | |
---|
| 261 | |
---|
| 262 | |
---|
| 263 | |
---|
| 264 | |
---|
| 265 | |
---|
| 266 | |
---|
| 267 | |
---|
| 268 | |
---|
| 269 | |
---|