source: trunk/CALENDRIER/calendriertotem.pro @ 2

Last change on this file since 2 was 2, checked in by opalod, 22 years ago

Initial revision

  • Property svn:eol-style set to native
  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 2.8 KB
Line 
1;------------------------------------------------------------
2;------------------------------------------------------------
3;------------------------------------------------------------
4;+
5; NAME: calendriertotem
6;
7; PURPOSE: exemple de fonction calculant un calendrier. Il s''agit ici
8; du calendrier utiliser pour le run totem/ecmwf, c.a.d. un calendrier
9; qui va de 1979 a 1993 dont le pas est de 5 jour et qui ds lequel
10; chaque 1ere sortie d''une nouvelle annee est le 5 janvier (si le mot
11; cle mensuel n''est pas active)
12;
13; CATEGORY: calendrier
14;
15; CALLING SEQUENCE:res=calendriertotem()
16;
17; INPUTS:
18;
19; KEYWORD PARAMETERS:
20;       YYYYMMDD: pour que le format des jours fournis par le
21;       calendrier soit du style 19991019. c'est le format par
22;       defaut.
23;
24;       JULIAN_DAY: pour que le calendrier soit exprime en jour julien
25;       d''IDL.
26;
27;       MENSUEL: pour obtenir un calendier mensuel plutot qu''a 5
28;       jours.
29;
30;       YBEGIN: annee de debut codee sur 2 chiffres
31;
32;       YEND annee de fin codee sur 2 chiffres
33;
34; OUTPUTS: un vecteur de longinteger contenant l''ensemble des dates.
35;
36; COMMON BLOCKS:
37;
38; SIDE EFFECTS:
39;
40; RESTRICTIONS:
41;
42; EXAMPLE:
43;
44; MODIFICATION HISTORY:Sebastien Masson (smasson@lodyc.jussieu.fr)
45;                      ??/??/1999
46;-
47;------------------------------------------------------------
48;------------------------------------------------------------
49;------------------------------------------------------------
50FUNCTION calendriertotem, YYYYMMDD = yyyymmdd, JULIAN_DAY = julian_day, MENSUEL = mensuel, ybegin = ybegin, yend = yend
51; cheking for yyyymmdd and julian_day keywords
52   julian_day = keyword_set(julian_day)*(1-keyword_set(yyyymmdd))
53   yyyymmdd = keyword_set(yyyymmdd)*(1-keyword_set(julian_day))+(keyword_set(yyyymmdd) EQ julian_day)
54;
55   if NOT keyword_set(yend) then yend = 93
56   if NOT keyword_set(ybegin) then ybegin = 79
57   nyear = yend-ybegin+1
58;
59   if keyword_set(mensuel) then begin
60      res = lonarr(12*nyear)
61      for an = 0, nyear-1 do BEGIN
62         for sor = 0, 11 do BEGIN
63            if keyword_set(julian_day) then res[0+an*12+sor] = julday(sor+1, 15, 1900+ybegin+an) $
64            ELSE BEGIN
65               caldat, julday(sor+1, 15, 1900+ybegin+an), month, day, year
66               if day EQ 15 then day = 0
67               res[0+an*12+sor] = 10000L*year+100L*month+day
68            ENDELSE
69         endfor
70      ENDFOR
71      return, res
72   endif
73;
74   res = lonarr(73*nyear)
75   for an = 0, nyear-1 do BEGIN
76      if keyword_set(julian_day) then $
77       res[0+an*73:0+(an+1)*73-1] = julday(1, 5, 1900+ybegin+an)+5L*lindgen(73) $
78      ELSE BEGIN
79         for sor = 0, 72 do begin
80            caldat, julday(1, 5+sor*5, 1900+ybegin+an), month, day, year
81            res[0+an*73+sor] = 10000L*year+100L*month+day
82         endfor
83      ENDELSE
84   endfor
85
86   return, res
87end
Note: See TracBrowser for help on using the repository browser.