source: trunk/SRC/Obsolete/nlec.pro @ 97

Last change on this file since 97 was 97, checked in by pinsard, 18 years ago

start to modify headers of Obsolete *.pro files for better idldoc output

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