;+ ; ; @file_comments ; lit les fichiers Net-Cdf de l'experience TOTEM/ECMWF qui sont sur ; maia: /u/rech/eee/reee217/TOTEM/REF/OUTPUTS ; ; @obsolete ; ; @param name {in}{required} ; nom du tableau contenant le champ que l'on veut (le ; trouver avec ncdflec,fichier,/var ; ; @param debut {in} ; nombres de 6 ou 8 chiffres (anneemoisjour, par ex:19980507) ; ; @param fin {in} ; nombres de 6 ou 8 chiffres (anneemoisjour, par ex:19980507) ; ; @param nomexperience {in}{optional} ; trois lettres designant le nom de l'experience ; ; @keyword BOITE ; boite sur laquelle integrer (par defaut tt le domaine) ; ; @keyword DIREC ; 'x' 'y' 'z' 'xy' 'xz' 'yz' 'xyz' directions selon lesquelles ; effectuer les moyennes (si rien n'est donne on n'effectue pas de moyenne) ; ; @keyword GRILLE ; impose la grille a laquelle est rapporte le champ. rq permet ; d'aller plus vite ds la lecture ; ; @keyword TOUT ; oblige a lire le tableau entier en non pas celui reduit a domdef ; ; @keyword STRUCTURE ; ; @keyword SEUILMIN ; ; @keyword SEUILMAX ; ; @keyword NAN ; ; @keyword _EXTRA ; Used to pass keywords ; ; @uses ; common ; vraidate ; juldate ; nlec5j ; nlecserie ; ; @history ; Sebastien Masson (smasson\@lodyc.jussieu.fr) ; 14/8/98 ; ; @version ; $Id$ ; ;- FUNCTION nlec, name, debut, fin, nomexperience $ , BOITE=boite, DIREC=direc, GRILLE=grille, TOUT=tout $ , STRUCTURE=structure, SEUILMIN=seuilmin, SEUILMAX=seuilmax $ , NAN=nan $ , _EXTRA=ex ; ;------------------------------------------------------------ ;REF.07.790101.grid.T.nc ;REF.07.790101.grid.U.nc ;REF.07.790101.grid.V.nc ;REF.07.790101.grid.W.nc ;------------------------------------------------------------ compile_opt idl2, strictarrsubs, obsolete ; @common ;------------------------------------------------------------ tempsun = systime(1) ; pour key_performance nom=strlowcase(name) ;------------------------------------------------------------ ; specification de la date et de l'experience ;------------------------------------------------------------ case n_params() of 1:BEGIN year=year+1900*(year ne 0 and year ne -1 and year lt 100) date = day+100*month+10000*year end 2:BEGIN if size(debut, /tname) EQ 'STRING' then begin prefix = strupcase(debut) year=year+1900*(year ne 0 and year ne -1 and year lt 100) date = day+100*month+10000*year ENDIF ELSE BEGIN date = debut rien=juldate(date) ENDELSE end 3:begin date = debut rien=juldate(date) if size(fin, /tname) EQ 'STRING' then begin prefix = strupcase(fin) ENDIF ELSE BEGIN date2=vraidate(fin) year2=date2/10000 month2=date2/100 - year2*100 day2=date2 - year2*10000 - month2*100 ENDELSE end 4:BEGIN date = debut rien=juldate(date) if size(nomexperience, /tname) EQ 'STRING' then begin prefix = strupcase(nomexperience) date2 = fin ENDIF ELSE BEGIN prefix = strupcase(fin) date2 = nomexperience ENDELSE date2=vraidate(date2) year2=date2/10000 month2=date2/100 - year2*100 day2=date2 - year2*10000 - month2*100 end endcase date = long(date) if n_elements(date2) NE 0 then date2 = long(date2) if n_elements(date2) NE 0 then if date2 eq date then tempvar = SIZE(TEMPORARY(date2)) ;------------------------------------------------------------ ; verification de la coherence des dates ;------------------------------------------------------------ if n_elements(date2) ne 0 then begin if (day EQ 0 AND day2 NE 0) OR (month EQ 0 AND month2 NE 0) OR $ (year EQ 0 AND year2 NE 0) or (day2 EQ 0 AND day NE 0) OR $ (month2 EQ 0 AND month NE 0) OR (year2 EQ 0 AND year NE 0) then $ return, report('verifier la coherence des dates') if date2 le date then return, report('date2 doit etre posterieure a date') endif ;------------------------------------------------------------ ; case sur le type de fichiers que l'on veut lire. ; determination ds chaque cas de numsortie et nbretps ;------------------------------------------------------------ if day NE 0 then begin ; SORTIES A 5 JOURS ;------------------------------------------------------------ ; numsortie ;------------------------------------------------------------ testjour: numsortie=((1+julday(month,day,year)-julday(1,1,year))/5.)[0] if numsortie ne floor(numsortie) then begin if n_elements(date2) ne 0 then begin caldat,julday(month,day+1,year),month,day,year goto, testjour endif return, -1 ENDIF numsortie = long(numsortie) ;------------------------------------------------------------ ; determination du nombre de pas de tps a extraire pour la serie temporelle ; entiere: nbretps ;------------------------------------------------------------ if n_elements(date2) ne 0 then begin testjour2: numsortie2=(1+julday(month2,day2,year2)-julday(1,1,year2))/5. if numsortie2 ne floor(numsortie2) then begin caldat,julday(month2,day2-1,year2),month2,day2,year2 goto, testjour2 endif if year eq year2 then nbretps=numsortie2-numsortie+1 else $ nbretps=(73-numsortie+1)+(year2-year-1)*73+numsortie2 numsortie2 = long(numsortie2) endif else nbretps=1 nbretps = long(nbretps) ;------------------------------------------------------------ ; si on fait une serie temporelle on cherche a lire plutot un fichier ; contenant deja une serie temporelle par contre pour une sortie ; unique on cherche d'abord a lire un fichier contenant toutes les variables. ;------------------------------------------------------------ IF n_elements(date2) ne 0 THEN BEGIN serie: IF n_elements(dejaserie) eq 1 then return, -1 datejul = 5*numsortie-1+julday(1, 1, year) if n_elements(date2) ne 0 then date2jul = 5*numsortie2-1+julday(1, 1, year2) $ ELSE date2jul = datejul res = nlecserie(nom, datejul, date2jul,BOITE=boite,GRILLE=grille,TOUT=tout, _EXTRA = ex) IF res[0] EQ -1 THEN BEGIN dejaserie = 1 GOTO, passerie ENDIF ENDIF ELSE BEGIN passerie: IF n_elements(dejapasserie) eq 1 then return, -1 res = nlec5j( nom, numsortie , nbretps,BOITE=boite,GRILLE=grille,TOUT=tout, _EXTRA = ex) IF res[0] EQ -1 THEN BEGIN dejapasserie = 1 GOTO, serie ENDIF endelse ENDIF ELSE BEGIN CASE 1 of month NE 0 AND year NE 0:BEGIN ; SORTIES MENSUELLES numsortie79 = (year-1979)*12+month if n_elements(date2) ne 0 then nbretps = month2-month+1+12*(year2-year) $ ELSE nbretps = 1 res = nlecmois(nom,numsortie79,nbretps ,BOITE=boite,GRILLE=grille,TOUT=tout, _EXTRA = ex) end month EQ 0 AND year NE 0:BEGIN ; SORTIES ANNUELLES numsortie79 = (year-1978) if n_elements(date2) ne 0 then nbretps = year2-year+1 $ ELSE nbretps = 1 res = nlecan(nom,numsortie79,nbretps ,BOITE=boite,GRILLE=grille,TOUT=tout, _EXTRA = ex) end month NE 0 AND year EQ 0:BEGIN ; SORTIES SAISONNIERES numsortie79 = month if n_elements(date2) ne 0 then nbretps = month2-month+1 $ ELSE nbretps = 1 res = nlecsaison(nom,numsortie79,nbretps ,BOITE=boite,GRILLE=grille,TOUT=tout, _EXTRA = ex) end month EQ 0 AND year EQ 0:BEGIN ; SORTIES CLIMATOLOGIQUE numsortie79 = 13 nbretps = 1 res = nlecsaison(nom,numsortie79,nbretps ,BOITE=boite,GRILLE=grille,TOUT=tout, _EXTRA = ex) end endcase endelse ;------------------------------------------------------------ ; seuil ;------------------------------------------------------------ if n_elements(seuilmin) NE 0 then BEGIN if n_elements(valmask) EQ 0 then valmask = 1e20 terre = where(res GT valmask/10.) res = seuilmin > res if terre[0] NE -1 then res[terre] = valmask undefine, terre endif if n_elements(seuilmax) NE 0 then begin if n_elements(valmask) EQ 0 then valmask = 1e20 terre = where(res GT valmask/10.) res = res < seuilmax if terre[0] NE -1 then res[terre] = valmask undefine, terre endif ;------------------------------------------------------------ ; points a mettre a nan ;------------------------------------------------------------ if n_elements(nan) NE 0 then BEGIN if n_elements(valmask) EQ 0 then valmask = 1e20 if abs(valmask) LT 1e6 then terre = where(abs(res) GT abs(valmask)/10.) $ ELSE terre = where(res EQ valmask) if abs(nan) LT 1e6 then notan = where(res EQ nan) $ ELSE notan = where(abs(res) GT abs(nan)) if notan[0] NE -1 then res[notan] = !values.f_nan notan = notan[0] NE -1 if terre[0] NE -1 then res[terre] = valmask undefine, terre endif ;------------------------------------------------------------ ; ajustement de niveau pour les tableau 2d simples ;------------------------------------------------------------ if jpt EQ 1 then begin taille = size(res) IF taille[0] EQ 2 THEN niveau = 1 endif ;------------------------------------------------------------ ; moyenne eventuelle ;------------------------------------------------------------ IF keyword_set(direc) THEN BEGIN IF jpt EQ 1 THEN res = moyenne(res,direc,BOITE=boite, nan = notan) $ ELSE res = grossemoyenne(res,direc,BOITE=boite, nan = notan) ENDIF ;------------------------------------------------------------ ; mise en placer des parametres pour le trace... ;------------------------------------------------------------ ; if keyword_set(boite) then legende_pltt = boite ELSE legende_pltt = [lon1, lon2, lat1, lat2] ;------------------------------------------------------------ ; IF n_elements(res) NE 1 THEN res = reform(res,/over) IF NOT keyword_set(direc) THEN domdef, lon1, lon2, lat1, lat2, prof1, prof2, _extra = ex, grille = vargrid $ ELSE if direc eq 't' then domdef, lon1, lon2, lat1, lat2, prof1, prof2, _extra = ex, grille = vargrid ;------------------------------------------------------------ if keyword_set(structure) then res = {tab:res, grille:vargrid, unite:varunit, experience:varexp, nom:varname} ;------------------------------------------------------------ if keyword_set(key_performance) THEN print, 'temps nlec', systime(1)-tempsun time = time-2l return,res ;------------------------------------------------------------ ;------------------------------------------------------------ end