Index: /trunk/Calendar/date2jul.pro
===================================================================
--- /trunk/Calendar/date2jul.pro	(revision 9)
+++ /trunk/Calendar/date2jul.pro	(revision 9)
@@ -0,0 +1,53 @@
+;------------------------------------------------------------
+;------------------------------------------------------------
+;------------------------------------------------------------
+;+
+; NAME: date2jul
+;
+; PURPOSE: gives julian day equivalent of a date in yyyymmdd format 
+;
+; CATEGORY: calendar
+;
+; CALLING SEQUENCE: jday = juldate(19930124)
+;
+; INPUTS: date in yyyymmdd format
+;
+; KEYWORD PARAMETERS:
+;
+;       /GRADS: if  1 <= year <= 49 --> year = 2000 + year
+;               if 50 <= year <= 99 --> year = 1900 + year
+;
+; OUTPUTS:date en jour julien
+;
+; COMMON BLOCKS: none
+;
+; SIDE EFFECTS: ?
+;
+; RESTRICTIONS: ?
+;
+; EXAMPLE:
+;
+;    IDL> print, date2jul(19931205) EQ julday(12,5,1993) 
+;       1
+;    IDL> print, date2jul(931205,/grads) EQ julday(12,5,1993) 
+;       1
+;
+; MODIFICATION HISTORY: Sebastien Masson (smasson@lodyc.jussieu.fr)
+;                       June 2005
+;-
+;------------------------------------------------------------
+;------------------------------------------------------------
+;------------------------------------------------------------
+function date2jul, date, GRADS = grads
+;------------------------------------------------------------
+   year = long(date) / 10000
+   month = long(date/100) MOD 100
+   day = long(date) MOD 100
+;------------------------------------------------------------
+   if keyword_set(grads) then year = year $
+     + 1900 * (year GE 50 AND year LE 99) $
+     + 2000 * (year GE  1 AND year LE 49)
+;------------------------------------------------------------
+   return, julday(month, day, year)
+end
+
Index: /trunk/Calendar/date2string.pro
===================================================================
--- /trunk/Calendar/date2string.pro	(revision 9)
+++ /trunk/Calendar/date2string.pro	(revision 9)
@@ -0,0 +1,49 @@
+;------------------------------------------------------------
+;------------------------------------------------------------
+;------------------------------------------------------------
+;+
+; NAME: date2string
+;
+; PURPOSE: create a nice and readable format to print a date
+;
+; CATEGORY: calendar/string
+;
+; CALLING SEQUENCE: nice_date = date2string(yyyymmdd)
+; 
+; INPUTS: yyyymmdd the date in the format 
+;         yearyearyearyearmonthmonthdayday
+;
+; KEYWORD PARAMETERS:those of string fonction to specify the
+;                    format of the month (the C format)
+;
+; OUTPUTS: a string containing the date in a easy readable format
+;
+; COMMON BLOCKS:none
+;
+; SIDE EFFECTS:?
+;
+; RESTRICTIONS:?
+;
+; EXAMPLE:
+;
+;    IDL> print, date2string(19900123)
+;    Jan 23, 1990
+;    IDL> print, date2string(19900123, format = '(C(CMOA))')
+;    JAN 23, 1990
+;
+; MODIFICATION HISTORY:Sebastien Masson (smasson@lodyc.jussieu.fr)
+; Creation ???
+; update/review June 2005 Sebastien Masson.
+;-
+;------------------------------------------------------------
+;------------------------------------------------------------
+;------------------------------------------------------------
+FUNCTION date2string, yyyymmdd, _EXTRA = ex
+;
+   sday = strtrim(long(yyyymmdd) MOD 100, 1)
+   smonth = strtrim((long(yyyymmdd)/100) MOD 100, 2)
+   syear = strtrim(long(yyyymmdd)/10000, 2)
+   res = string(format = '(C(CMoa))', 31*(fix(smonth)-1), _EXTRA = ex) $
+         + ' ' + sday + ', ' + syear
+   return, res
+end
Index: /trunk/Calendar/daysinmonth.pro
===================================================================
--- /trunk/Calendar/daysinmonth.pro	(revision 9)
+++ /trunk/Calendar/daysinmonth.pro	(revision 9)
@@ -0,0 +1,67 @@
+;------------------------------------------------------------
+;------------------------------------------------------------
+;------------------------------------------------------------
+;+
+; NAME:daysinmonth
+;
+; PURPOSE:give the nomber of days in a specefic month
+;
+; CATEGORY: calandar
+;
+; CALLING SEQUENCE: ndays = daysinmonth([month[, year]])
+;
+; INPUTS (optionnal): month and year. Year is used only if the
+;      common variable key_caltype = 'greg'. In that case, month
+;      and year must have the same number of elements. if not
+;      provided, we take month and year from "time" common variable.
+;
+; KEYWORD PARAMETERS:
+;
+; OUTPUTS:
+;
+; COMMON BLOCKS: cm_4cal
+;        
+; SIDE EFFECTS: return -1 in case of error
+;
+; RESTRICTIONS:
+;
+; EXAMPLE:
+;
+; MODIFICATION HISTORY: Sebastien Masson (smasson@lodyc.jussieu.fr)
+;			2/7/98
+; update/review/english/new commons: June 2005 Sebastien Masson.
+;-
+;------------------------------------------------------------
+;------------------------------------------------------------
+;------------------------------------------------------------
+function daysinmonth, month, year
+;------------------------------------------------------------
+; include commons
+@cm_4cal
+IF NOT keyword_set(key_forgetold) THEN BEGIN
+@updatenew
+ENDIF
+;------------------------------------------------------------
+  IF n_elements(key_caltype) EQ 0 THEN key_caltype = 'greg'
+  CASE key_caltype OF
+    '360d': if n_elements(month) GT 1 THEN $
+        return, replicate(30, n_elements(month)) ELSE return, 30
+    'noleap':BEGIN
+      days_in_mth = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
+      IF n_elements(month) EQ 0 THEN caldat, time, month
+      return, days_in_mth[month-1]
+    END
+    'greg':BEGIN
+      CASE n_params() OF
+        0:caldat, time, month, day, year
+        2:IF n_elements(month) NE n_elements(year) THEN $
+          return, report('month and year must have the same number of elements')
+        ELSE:return, report('daysinmonth accept 0 or 2 input parameters')
+      ENDCASE
+      days_in_mth = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
+      return, days_in_mth[month-1] + leapyr(year)*(month EQ 2)
+    END 
+    ELSE:return, report('only 3 types of calendar are accepted: greg, 360d and noleap')
+  ENDCASE
+
+END 
Index: /trunk/Calendar/jul2date.pro
===================================================================
--- /trunk/Calendar/jul2date.pro	(revision 9)
+++ /trunk/Calendar/jul2date.pro	(revision 9)
@@ -0,0 +1,39 @@
+;------------------------------------------------------------
+;------------------------------------------------------------
+;------------------------------------------------------------
+;+
+; NAME: jul2date
+;
+; PURPOSE: gives yyyymmdd date equivalent of a julian day
+;
+; CATEGORY: calendar
+;
+; CALLING SEQUENCE: date = jul2date(jday)
+;
+; INPUTS:jday: julian day
+;
+; KEYWORD PARAMETERS: None
+;
+; OUTPUTS: date in yyyymmdd format
+;
+; COMMON BLOCKS: None
+;
+; SIDE EFFECTS:
+;
+; RESTRICTIONS:
+;
+; EXAMPLE:
+;
+;    IDL> print, jul2date(julday(12,23,1999))
+;        19991223
+;
+; MODIFICATION HISTORY: Sebastien Masson (smasson@lodyc.jussieu.fr)
+;                       June 2005
+;-
+;------------------------------------------------------------
+;------------------------------------------------------------
+;------------------------------------------------------------
+function jul2date, jday
+  caldat, jday, month, day, year
+  return, 10000L*year+100L*month+day
+end
Index: /trunk/Calendar/leapyr.pro
===================================================================
--- /trunk/Calendar/leapyr.pro	(revision 9)
+++ /trunk/Calendar/leapyr.pro	(revision 9)
@@ -0,0 +1,53 @@
+;-----------------------------------------------------------------
+function leapyr, year
+;+
+; NAME:			leapyr
+;
+; PURPOSE:		determine whether the input year is a leap year or not
+;			Very useful for finding number of days in a year.
+;			eg. NUM_DAYS_IN_YR = 365 + leapyr(year)
+;
+; CATEGORY:		Utility
+;
+; CALLING SEQUENCE:	result = leapyr(year)
+;
+; INPUTS:		year	= test if year is a leap year 
+;
+; OUTPUTS:		result 	= 0 then not a leap year
+;				= 1 then year is a leap year
+;
+; COMMON BLOCKS: cm_4cal
+;
+; SIDE EFFECTS:
+;	none.
+; MODIFICATION HISTORY:
+;
+;	Originally Written by: Trevor Harris, Physics Dept., University of Adelaide,
+;		20/09/88
+;
+;       November 2004: correction for century years... S. Masson;
+;
+;       Every year divisible by 4 is a leap year. 
+;       But every year divisible by 100 is NOT a leap year 
+;       Unless the year is also divisible by 400, then it is still a
+;       leap year.
+;       This means that year 1800, 1900, 2100, 2200, 2300 and 2500 are
+;       NOT leap years, while year 2000 and 2400 are leap years. 
+;       + supress the automatic change 89 -> 1989
+;
+;       June 2005 update for new commons, Sebastien Masson.
+;
+;-
+;------------------------------------------------------------
+; include commons
+@cm_4cal
+;------------------------------------------------------------	
+  yr = long(year)
+  IF n_elements(key_caltype) EQ 0 THEN key_caltype = 'greg'
+;
+  IF key_caltype NE 'greg' THEN BEGIN 
+    sd = size(yr, /dimensions)
+    IF sd[0] EQ 0 THEN return, 0b ELSE return, bytarr(size(yr, /dimensions))
+  ENDIF ELSE return, (yr MOD 4 EQ 0)*((yr MOD 100 NE 0) + (yr MOD 400 EQ 0))
+
+end
Index: /trunk/Calendar/monthname.pro
===================================================================
--- /trunk/Calendar/monthname.pro	(revision 9)
+++ /trunk/Calendar/monthname.pro	(revision 9)
@@ -0,0 +1,36 @@
+;------------------------------------------------------------
+;------------------------------------------------------------
+;------------------------------------------------------------
+;+
+; NAME:monthname
+;
+; PURPOSE:gives the name of a month
+;
+; CATEGORY:
+;
+; CALLING SEQUENCE:name=monthname(number)
+; 
+; INPUTS: number, the month number (from 1 to 12)
+;
+; KEYWORD PARAMETERS:those of string fonction to specify the
+;                    format of the month (the C format)
+;
+; OUTPUTS: an integer, the month's name
+;
+; COMMON BLOCKS:None
+;
+; SIDE EFFECTS:
+;
+; RESTRICTIONS:
+;
+; EXAMPLE:
+;
+; MODIFICATION HISTORY:Sebastien Masson (smasson@lodyc.jussieu.fr)
+;                      1 October 2001
+;-
+;------------------------------------------------------------
+;------------------------------------------------------------
+;------------------------------------------------------------
+FUNCTION monthname,  mm1, _extra = ex
+   return, string(format='(C(CMoA0))',31*(mm1-1), _extra = ex)
+end
Index: /trunk/Obsolete/jourdsmois.pro
===================================================================
--- /trunk/Obsolete/jourdsmois.pro	(revision 9)
+++ /trunk/Obsolete/jourdsmois.pro	(revision 9)
@@ -0,0 +1,24 @@
+;------------------------------------------------------------
+;------------------------------------------------------------
+;------------------------------------------------------------
+;+
+; NAME:jourdsmois
+;
+; PURPOSE:
+;       obsolete, used daysinmonth instead...
+;
+; MODIFICATION HISTORY: Sebastien Masson (smasson@lodyc.jussieu.fr)
+;-
+; June 2005: Sebastien Masson, english version
+;------------------------------------------------------------
+;------------------------------------------------------------
+;------------------------------------------------------------
+function jourdsmois, mois, annee
+
+case n_params() OF
+  0:return, daysinmonth()
+  1:return, daysinmonth(mois)
+  2:return, daysinmonth(mois, annee)
+endcase
+
+end
Index: /trunk/Obsolete/juldate.pro
===================================================================
--- /trunk/Obsolete/juldate.pro	(revision 9)
+++ /trunk/Obsolete/juldate.pro	(revision 9)
@@ -0,0 +1,65 @@
+;------------------------------------------------------------
+;------------------------------------------------------------
+;------------------------------------------------------------
+;+
+; NAME: juldate
+;
+;       OBSOLETE: you better use date2jul
+;
+; PURPOSE:  gives julian date equivalent of a date in vairmer 
+;           ( yymmdd or yyyymmdd ) format 
+;           sets month, day and year to the corresp values
+;
+; CATEGORY: bidouilles dates
+;
+; CALLING SEQUENCE:  date = juldate(930124)
+;
+; INPUTS:date de la forme yymmdd ou yyyymmdd
+;
+; KEYWORD PARAMETERS:
+;
+;       /VRAIDATE: pour ne pas transformer l''annnee 01 en 1901 
+;       /GRADS: if  1 le year le 49 then year = 2000+year
+;               if 50 le year le 99 then year = 1900+year
+;
+; OUTPUTS:date en jour julien
+;
+; COMONTHON BLOCKS:
+;	common.pro	vraidate
+;
+; SIDE EFFECTS:
+;   l'annee 0 n'existant pas, qd year est nulle on calcule le
+;     jour julien de l'annee -1.
+;   COMPATIBLE AVEC L'AN 2000 !!!: une date de la forme yymmdd est
+;    donvertit sous la forme yyyymmdd a l''aide de vraidate.
+;   Attention, les variables globales year, month day sont attribuees
+;
+; MODIFICATION HISTORY: Jerome Vialard  (jv@lodyc.jussieu.fr)
+;			2/7/98
+;-
+;------------------------------------------------------------
+;------------------------------------------------------------
+;------------------------------------------------------------
+function juldate, vvdate, _EXTRA = ex
+vdate = vvdate
+vdate = vraidate(vdate, _EXTRA = ex)
+@common
+;------------------------------------------------------------
+   year=vdate/10000
+   month=vdate/100 - year*100
+   day=abs(vdate - year*10000 - month*100)
+   month = abs(month)
+;
+   mm = month & dd = day & yy = year
+;------------------------------------------------------------
+   ndate = n_elements(vdate) 
+   if total(mm EQ 0) EQ ndate then mm[*] = 6
+   if total(dd EQ 0) EQ ndate then dd[*] = 15
+   if total(yy EQ 0) EQ ndate THEN yy[*] = -1
+;------------------------------------------------------------
+   return, julday(mm,dd,yy, _EXTRA = ex)
+;------------------------------------------------------------
+   return, -1
+end
+;------------------------------------------------------------
+
Index: /trunk/Obsolete/vairdate.pro
===================================================================
--- /trunk/Obsolete/vairdate.pro	(revision 9)
+++ /trunk/Obsolete/vairdate.pro	(revision 9)
@@ -0,0 +1,72 @@
+;------------------------------------------------------------
+;------------------------------------------------------------
+;------------------------------------------------------------
+;+
+; NAME: vairdate
+;
+;       OBSOLETE: you better use jul2date
+;
+; PURPOSE:  gives vairmer date equivalent of a date in julian format
+;           sets month, day and year to the corresp values
+;
+; CATEGORY:
+;
+; CALLING SEQUENCE:  vdate = vairdate(1755087)
+;
+; INPUTS:jdate=date en jours juliens
+;
+; KEYWORD PARAMETERS:
+;
+;    MENSUEL: a activer si on veut pour  que les dates dont le jour est
+;    15 deviennent avec un jour egale a 0. par ex:
+;    19990115   ->   19990100
+;
+;    ANNUEL: a activer si on veut pour  que les dates dont le mois est
+;    6 et dont le jour est 1 deviennent avec un mois et jour egale a
+;    0. par ex:
+;    19990601   ->   19990000
+;
+; OUTPUTS:vdate=date vairmer
+;	  plus year, month et day
+;
+; COMMON BLOCKS:
+;	common.pro
+;
+; SIDE EFFECTS:
+;
+; RESTRICTIONS:
+;
+; EXAMPLE:
+;
+; MODIFICATION HISTORY: Jerome Vialard  (jv@lodyc.jussieu.fr)
+;			2/7/98
+;                13/9/1999, Sebastien Masson (smasson@lodyc.jussieu.fr)
+;                       ANNUEL,MENSUEL,_EXTRA et possibilite
+;                       d''utiliser vairdate avec des scalaire ou des
+;                       tableaux
+;-
+;------------------------------------------------------------
+;------------------------------------------------------------
+;------------------------------------------------------------
+function vairdate, jdate,  ANNUEL = annuel, MENSUEL = mensuel, _EXTRA = ex
+@common
+;------------------------------------------------------------
+   caldat, jdate, month, day, year, _EXTRA = ex
+   index = where(year eq -1)
+   if index[0] NE -1 then year[index] = 0
+   if keyword_set(mensuel) THEN BEGIN 
+      index = where(day EQ 15)
+      if index[0] NE -1 then day[index] = 0
+   endif
+   if keyword_set(annuel) THEN BEGIN 
+      index = where(day EQ 1 AND month EQ 6)
+      if index[0] NE -1 then BEGIN 
+         day[index] = 0
+         month[index] = 0
+      endif
+   endif
+;------------------------------------------------------------
+   return, 10000L*year+100L*month+day
+;------------------------------------------------------------
+end
+;------------------------------------------------------------
Index: /trunk/Obsolete/vraidate.pro
===================================================================
--- /trunk/Obsolete/vraidate.pro	(revision 9)
+++ /trunk/Obsolete/vraidate.pro	(revision 9)
@@ -0,0 +1,41 @@
+;------------------------------------------------------------
+;------------------------------------------------------------
+;------------------------------------------------------------
+;+
+; NAME:vraidate
+;
+; PURPOSE:donne la date en long
+;
+; CATEGORY:
+;
+; CALLING SEQUENCE:res=vraidate(date)
+;
+; INPUTS:date:une date du type yyyymmdd
+;
+; KEYWORD PARAMETERS:
+;
+;       /GRADS: if  1 le year le 49 then year = 2000+year
+;               if 50 le year le 99 then year = 1900+year
+;
+; OUTPUTS:une date vairmer du type yyyymmdd
+;
+; SIDE EFFECTS:si year est nulle ou egale a -1 ne change rien
+;
+; EXAMPLE:vraidate(980703) donne 19980703 qui est un long
+;
+; MODIFICATION HISTORY: Sebastien Masson (smasson@lodyc.jussieu.fr)
+;			3/7/98
+; remove automatic change from year 1 to 1901... Aug 2004
+;-
+;------------------------------------------------------------
+;------------------------------------------------------------
+;------------------------------------------------------------
+function vraidate, date, GRADS = grads, _EXTRA = ex
+;------------------------------------------------------------
+  IF NOT keyword_set(GRADS) THEN return, long(date)
+;
+  date = long(date)
+  annee = date/10000
+  return, date+19000000L*(annee GE 50 and date lt 1000000)+20000000L*(annee LT 50 and date lt 1000000)
+;------------------------------------------------------------
+end
Index: /trunk/ToBeReviewed/CALENDRIER/caldat.pro
===================================================================
--- /trunk/ToBeReviewed/CALENDRIER/caldat.pro	(revision 9)
+++ /trunk/ToBeReviewed/CALENDRIER/caldat.pro	(revision 9)
@@ -0,0 +1,187 @@
+; $Id$
+;
+; Copyright (c) 1992-2003, Research Systems, Inc.  All rights reserved.
+;	Unauthorized reproduction prohibited.
+;
+
+;+
+; NAME:
+;	CALDAT
+;
+; PURPOSE:
+;	Return the calendar date and time given julian date.
+;	This is the inverse of the function JULDAY.
+; CATEGORY:
+;	Misc.
+;
+; CALLING SEQUENCE:
+;	CALDAT, Julian, Month, Day, Year, Hour, Minute, Second
+;	See also: julday, the inverse of this function.
+;
+; INPUTS:
+;	JULIAN contains the Julian Day Number (which begins at noon) of the
+;	specified calendar date.  It should be a long integer.
+; OUTPUTS:
+;	(Trailing parameters may be omitted if not required.)
+;	MONTH:	Number of the desired month (1 = January, ..., 12 = December).
+;
+;	DAY:	Number of day of the month.
+;
+;	YEAR:	Number of the desired year.
+;
+;	HOUR:	Hour of the day
+;	Minute: Minute of the day
+;	Second: Second (and fractions) of the day.
+;
+; KEYWORD PARAMETERS:
+;
+;       NDAYSPM: for using a calendar with fixed number of days per
+;                months. defaut value of NDAYSPM=30
+;
+; COMMON BLOCKS: cm_4cal
+;
+; SIDE EFFECTS:
+;	None.
+;
+; RESTRICTIONS:
+;	Accuracy using IEEE double precision numbers is approximately
+;	1/10000th of a second.
+;
+; MODIFICATION HISTORY:
+;	Translated from "Numerical Recipies in C", by William H. Press,
+;	Brian P. Flannery, Saul A. Teukolsky, and William T. Vetterling.
+;	Cambridge University Press, 1988 (second printing).
+;
+;	DMS, July 1992.
+;	DMS, April 1996, Added HOUR, MINUTE and SECOND keyword
+;	AB, 7 December 1997, Generalized to handle array input.
+;
+;       Eric Guilyardi, June 1999
+;       Added key_work ndayspm for fixed number of days per months
+;
+;	AB, 3 January 2000, Make seconds output as DOUBLE in array output.
+;-
+;
+pro CALDAT, julian, month, day, year, hour, minute, second, NDAYSPM = ndayspm
+;------------------------------------------------------------
+@cm_4cal
+;------------------------------------------------------------
+  COMPILE_OPT idl2
+
+  ON_ERROR, 2                   ; Return to caller if errors
+
+  IF n_elements(key_caltype) EQ 0 THEN key_caltype = 'greg'
+  if keyword_set(ndayspm) then key_caltype = '360d'
+  CASE key_caltype OF
+    'greg':BEGIN
+
+      nParam = N_PARAMS()
+      IF (nParam LT 1) THEN MESSAGE, 'Incorrect number of arguments.'
+
+      min_julian = -1095
+      max_julian = 1827933925
+      minn = MIN(julian, MAX = maxx)
+      IF (minn LT min_julian) OR (maxx GT max_julian) THEN MESSAGE, $
+        'Value of Julian date is out of allowed range.'
+
+      igreg = 2299161L                   ;Beginning of Gregorian calendar
+      julLong = FLOOR(julian + 0.5d)     ;Better be long
+      minJul = MIN(julLong)
+
+      IF (minJul GE igreg) THEN BEGIN ; all are Gregorian
+        jalpha = LONG(((julLong - 1867216L) - 0.25d) / 36524.25d)
+        ja = julLong + 1L + jalpha - long(0.25d * jalpha)
+      ENDIF ELSE BEGIN
+        ja = julLong
+        gregChange = WHERE(julLong ge igreg, ngreg)
+        IF (ngreg GT 0) THEN BEGIN
+          jalpha = long(((julLong[gregChange] - 1867216L) - 0.25d) / 36524.25d)
+          ja[gregChange] = julLong[gregChange] + 1L + jalpha - long(0.25d * jalpha)
+        ENDIF
+      ENDELSE
+      jalpha = -1               ; clear memory
+
+      jb = TEMPORARY(ja) + 1524L
+      jc = long(6680d + ((jb-2439870L)-122.1d0)/365.25d)
+      jd = long(365d * jc + (0.25d * jc))
+      je = long((jb - jd) / 30.6001d)
+
+      day = TEMPORARY(jb) - TEMPORARY(jd) - long(30.6001d * je)
+      month = TEMPORARY(je) - 1L
+      month = ((TEMPORARY(month) - 1L) MOD 12L) + 1L
+      year = TEMPORARY(jc) - 4715L
+      year = TEMPORARY(year) - (month GT 2)
+      year = year - (year LE 0)
+
+; see if we need to do hours, minutes, seconds
+      IF (nParam GT 4) THEN BEGIN
+        fraction = julian + 0.5d - TEMPORARY(julLong)
+        hour = floor(fraction * 24d)
+        fraction = TEMPORARY(fraction) - hour/24d
+        minute = floor(fraction*1440d)
+        second = (TEMPORARY(fraction) - minute/1440d) * 86400d
+      ENDIF
+
+; if julian is an array, reform all output to correct dimensions
+      IF (SIZE(julian, /N_DIMENSION) GT 0) THEN BEGIN
+        dimensions = SIZE(julian, /DIMENSION)
+        month = REFORM(month, dimensions)
+        day = REFORM(day, dimensions)
+        year = REFORM(year, dimensions)
+        IF (nParam GT 4) THEN BEGIN
+          hour = REFORM(hour, dimensions)
+          minute = REFORM(minute, dimensions)
+          second = REFORM(second, dimensions)
+        ENDIF
+      ENDIF
+
+    END 
+    '360d':BEGIN
+
+      jul = long(julian)
+      f = (jul - floor(jul))
+      IF total(f NE 0.0) GT 0 THEN BEGIN ;Get hours, minutes, seconds.
+        hour = floor(f*24.)
+        f = f - hour / 24.d
+        minute = floor(f*1440)
+        second = (f - minute/1440.d0) * 86400.0d0
+      ENDIF ELSE BEGIN
+        hour = replicate(0L,  n_elements(julian))
+        minute = replicate(0L,  n_elements(julian))
+        second = replicate(0L,  n_elements(julian))
+      ENDELSE
+
+      IF keyword_set(ndayspm) THEN BEGIN
+        IF ndayspm EQ 1 THEN ndayspm = 30
+      ENDIF ELSE ndayspm = 30
+
+      ndayspm = long(ndayspm)
+      Z = floor(julian)
+      year = z/(12*ndayspm)+1
+      month = (z-(12*ndayspm)*(year-1))/ndayspm+1
+      day = z-(12*ndayspm)*(year-1)-ndayspm*(month-1)
+      WHILE total(day LT 1) GT 0 DO BEGIN
+        tochange = where(day LT 1)
+        month[tochange] = month[tochange]-1
+        day[tochange] = day[tochange]+ndayspm
+      ENDWHILE
+      WHILE total(month LT 1) GT 0 DO BEGIN
+        tochange = where(month LT 1)
+        year[tochange] = year[tochange]-1
+        month[tochange] = month[tochange]+12
+      ENDWHILE
+; year 0 does not exist...
+      neg = where(year LT 0)
+      IF neg[0] NE -1 THEN year[neg] = year[neg]-1
+    END 
+    'noleap':BEGIN
+    END 
+    ELSE:BEGIN
+      ng = report('only 3 types of calendar are accepted: greg, 360d and noleap')
+      return
+    END
+  ENDCASE
+;
+  return
+
+END
Index: /trunk/ToBeReviewed/CALENDRIER/def_month.pro
===================================================================
--- /trunk/ToBeReviewed/CALENDRIER/def_month.pro	(revision 9)
+++ /trunk/ToBeReviewed/CALENDRIER/def_month.pro	(revision 9)
@@ -0,0 +1,37 @@
+FUNCTION def_month, timave, date
+;
+; translate month number in string
+;
+   IF strpos(date, '_') GT -1 THEN date = strmid(date, 0, strpos(date, '_'))
+   CASE strmid(timave, 0, 2) OF 
+      '1m': BEGIN
+         CASE strmid(date, strlen(date)-2, 2) OF 
+            '01': mn = 'January'
+            '02': mn = 'February'
+            '03': mn = 'March'
+            '04': mn = 'April'
+            '05': mn = 'May'
+            '06': mn = 'June'
+            '07': mn = 'July'
+            '08': mn = 'August'
+            '09': mn = 'September'
+            '10': mn = 'October'
+            '11': mn = 'November'
+            '12': mn = 'December'
+            ELSE: mn = '???'
+         ENDCASE 
+      END 
+      '3m': BEGIN
+         CASE strmid(date, strlen(date)-2, 2) OF 
+            '01': mn = 'DJF'
+            '02': mn = 'MMA'
+            '03': mn = 'JJA'
+            '04': mn = 'SON'
+            ELSE: mn = '???'
+         ENDCASE 
+      END 
+      ELSE:
+   ENDCASE  
+
+   return, mn
+END 
Index: /trunk/ToBeReviewed/CALENDRIER/julday.pro
===================================================================
--- /trunk/ToBeReviewed/CALENDRIER/julday.pro	(revision 9)
+++ /trunk/ToBeReviewed/CALENDRIER/julday.pro	(revision 9)
@@ -0,0 +1,258 @@
+; $Id$
+;
+; Copyright (c) 1988-2003, Research Systems, Inc.  All rights reserved.
+;	Unauthorized reproduction prohibited.
+
+;+
+; NAME:
+;	JULDAY
+;
+; PURPOSE:
+;	Calculate the Julian Day Number for a given month, day, and year.
+;	This is the inverse of the library function CALDAT.
+;	See also caldat, the inverse of this function.
+;
+; CATEGORY:
+;	Misc.
+;
+; CALLING SEQUENCE:
+;	Result = JULDAY([[[[Month, Day, Year], Hour], Minute], Second])
+;
+; INPUTS:
+;	MONTH:	Number of the desired month (1 = January, ..., 12 = December).
+;
+;	DAY:	Number of day of the month.
+;
+;	YEAR:	Number of the desired year.Year parameters must be valid
+;               values from the civil calendar.  Years B.C.E. are represented
+;               as negative integers.  Years in the common era are represented
+;               as positive integers.  In particular, note that there is no
+;               year 0 in the civil calendar.  1 B.C.E. (-1) is followed by
+;               1 C.E. (1).
+;
+;	HOUR:	Number of the hour of the day.
+;
+;	MINUTE:	Number of the minute of the hour.
+;
+;	SECOND:	Number of the second of the minute.
+;
+;   Note: Month, Day, Year, Hour, Minute, and Second can all be arrays.
+;         The Result will have the same dimensions as the smallest array, or
+;         will be a scalar if all arguments are scalars.
+;
+; OPTIONAL INPUT PARAMETERS:
+;	Hour, Minute, Second = optional time of day.
+;
+; KEYWORD PARAMETERS:
+;
+;       NDAYSPM: for using a calendar with fixed number of days per
+;                months. defaut value of NDAYSPM=30
+;
+; OUTPUTS:
+;	JULDAY returns the Julian Day Number (which begins at noon) of the
+;	specified calendar date.  If Hour, Minute, and Second are not specified,
+;	then the result will be a long integer, otherwise the result is a
+;	double precision floating point number.
+;
+; COMMON BLOCKS: cm_4cal
+;
+; SIDE EFFECTS:
+;	None.
+;
+; RESTRICTIONS:
+;	Accuracy using IEEE double precision numbers is approximately
+;   1/10000th of a second, with higher accuracy for smaller (earlier)
+;   Julian dates.
+;
+; MODIFICATION HISTORY:
+;	Translated from "Numerical Recipies in C", by William H. Press,
+;	Brian P. Flannery, Saul A. Teukolsky, and William T. Vetterling.
+;	Cambridge University Press, 1988 (second printing).
+;
+;	AB, September, 1988
+;	DMS, April, 1995, Added time of day.
+;
+;       Eric Guilyardi, June 1999
+;       Added key_work ndayspm for fixed number of days per months
+;       + change to accept year 0
+;
+;       Sebastien Masson, Aug. 2003
+;       fix bug for negative and large values of month values
+;       eg. julday(349,1,1970)
+;
+;   CT, April 2000, Now accepts vectors or scalars.
+;-
+;
+function JULDAY, MONTH, DAY, YEAR, Hour, Minute, Second, NDAYSPM = ndayspm
+;------------------------------------------------------------
+@cm_4cal
+;------------------------------------------------------------
+
+  COMPILE_OPT idl2
+
+  ON_ERROR, 2                   ; Return to caller if errors
+
+  IF n_elements(key_caltype) EQ 0 THEN key_caltype = 'greg'
+  if keyword_set(ndayspm) then key_caltype = '360d'
+;
+  CASE key_caltype OF
+    'greg':BEGIN
+
+
+; Gregorian Calander was adopted on Oct. 15, 1582
+; skipping from Oct. 4, 1582 to Oct. 15, 1582
+      GREG = 2299171L           ; incorrect Julian day for Oct. 25, 1582
+
+; Process the input, if all are missing, use todays date.
+      NP = n_params()
+      IF (np EQ 0) THEN RETURN, SYSTIME(/JULIAN)
+      IF (np LT 3) THEN MESSAGE, 'Incorrect number of arguments.'
+
+; Find the dimensions of the Result:
+;  1. Find all of the input arguments that are arrays (ignore scalars)
+;  2. Out of the arrays, find the smallest number of elements
+;  3. Find the dimensions of the smallest array
+
+; Step 1: find all array arguments
+      nDims = [SIZE(month, /N_DIMENSIONS), SIZE(day, /N_DIMENSIONS), $
+               SIZE(year, /N_DIMENSIONS), SIZE(hour, /N_DIMENSIONS), $
+               SIZE(minute, /N_DIMENSIONS), SIZE(second, /N_DIMENSIONS)]
+      arrays = WHERE(nDims GE 1)
+
+      nJulian = 1L              ; assume everything is a scalar
+      IF (arrays[0] GE 0) THEN BEGIN
+                                ; Step 2: find the smallest number of elements
+        nElement = [N_ELEMENTS(month), N_ELEMENTS(day), $
+                    N_ELEMENTS(year), N_ELEMENTS(hour), $
+                    N_ELEMENTS(minute), N_ELEMENTS(second)]
+        nJulian = MIN(nElement[arrays], whichVar)
+                                ; step 3: find dimensions of the smallest array
+        CASE arrays[whichVar] OF
+          0: julianDims = SIZE(month, /DIMENSIONS)
+          1: julianDims = SIZE(day, /DIMENSIONS)
+          2: julianDims = SIZE(year, /DIMENSIONS)
+          3: julianDims = SIZE(hour, /DIMENSIONS)
+          4: julianDims = SIZE(minute, /DIMENSIONS)
+          5: julianDims = SIZE(second, /DIMENSIONS)
+        ENDCASE
+      ENDIF
+
+      d_Second = 0d             ; defaults
+      d_Minute = 0d
+      d_Hour = 0d
+; convert all Arguments to appropriate array size & type
+      SWITCH np OF              ; use switch so we fall thru all arguments...
+        6: d_Second = (SIZE(second, /N_DIMENSIONS) GT 0) ? $
+                      second[0:nJulian-1] : second
+        5: d_Minute = (SIZE(minute, /N_DIMENSIONS) GT 0) ? $
+                      minute[0:nJulian-1] : minute
+        4: d_Hour = (SIZE(hour, /N_DIMENSIONS) GT 0) ? $
+                    hour[0:nJulian-1] : hour
+        3: BEGIN                ; convert m,d,y to type LONG
+          L_MONTH = (SIZE(month, /N_DIMENSIONS) GT 0) ? $
+                    LONG(month[0:nJulian-1]) : LONG(month)
+          L_DAY = (SIZE(day, /N_DIMENSIONS) GT 0) ? $
+                  LONG(day[0:nJulian-1]) : LONG(day)
+          L_YEAR = (SIZE(year, /N_DIMENSIONS) GT 0) ? $
+                   LONG(year[0:nJulian-1]) : LONG(year)
+        END
+      ENDSWITCH
+
+
+      min_calendar = -4716
+      max_calendar = 5000000
+      minn = MIN(l_year, MAX = maxx)
+      IF (minn LT min_calendar) OR (maxx GT max_calendar) THEN MESSAGE, $
+        'Value of Julian date is out of allowed range.'
+; change to accept year 0
+; if (MAX(L_YEAR eq 0) NE 0) then message, $
+; 	'There is no year zero in the civil calendar.'
+;
+; by seb Aug 2003
+      tochange = where(L_MONTH LT 0)
+      IF tochange[0] NE -1 THEN BEGIN
+        L_YEAR[tochange] = L_YEAR[tochange]+L_MONTH[tochange]/12-1
+        L_MONTH[tochange] =  12 + L_MONTH[tochange] MOD 12
+      ENDIF
+      tochange = where(L_MONTH GT 12)
+      IF tochange[0] NE -1 THEN BEGIN
+        L_YEAR[tochange] = L_YEAR[tochange]+L_MONTH[tochange]/12
+        L_MONTH[tochange] =  L_MONTH[tochange] MOD 12
+      ENDIF
+; by seb Aug 2003 - end
+;
+;
+      bc = (L_YEAR LT 0)
+      L_YEAR = TEMPORARY(L_YEAR) + TEMPORARY(bc)
+      inJanFeb = (L_MONTH LE 2)
+      JY = L_YEAR - inJanFeb
+      JM = L_MONTH + (1b + 12b*TEMPORARY(inJanFeb))
+
+
+      JUL = floor(365.25d * JY) + floor(30.6001d*TEMPORARY(JM)) + L_DAY + 1720995L
+
+
+; Test whether to change to Gregorian Calandar.
+      IF (MIN(JUL) GE GREG) THEN BEGIN ; change all dates
+        JA = long(0.01d * TEMPORARY(JY))
+        JUL = TEMPORARY(JUL) + 2L - JA + long(0.25d * JA)
+      ENDIF ELSE BEGIN
+        gregChange = WHERE(JUL ge GREG, ngreg)
+        IF (ngreg GT 0) THEN BEGIN
+          JA = long(0.01d * JY[gregChange])
+          JUL[gregChange] = JUL[gregChange] + 2L - JA + long(0.25d * JA)
+        ENDIF
+      ENDELSE
+
+
+; hour,minute,second?
+      IF (np GT 3) THEN BEGIN   ; yes, compute the fractional Julian date
+; Add a small offset so we get the hours, minutes, & seconds back correctly
+; if we convert the Julian dates back. This offset is proportional to the
+; Julian date, so small dates (a long, long time ago) will be "more" accurate.
+        eps = (MACHAR(/DOUBLE)).eps
+        eps = eps*ABS(jul) > eps
+; For Hours, divide by 24, then subtract 0.5, in case we have unsigned ints.
+        jul = TEMPORARY(JUL) + ( (TEMPORARY(d_Hour)/24d - 0.5d) + $
+                                 TEMPORARY(d_Minute)/1440d + TEMPORARY(d_Second)/86400d + eps )
+      ENDIF
+
+; check to see if we need to reform vector to array of correct dimensions
+      IF (N_ELEMENTS(julianDims) GT 1) THEN $
+        JUL = REFORM(TEMPORARY(JUL), julianDims)
+
+      RETURN, jul
+
+    END 
+    '360d':BEGIN
+;
+; Fixed number of days per month (default=30) :
+;
+      IF keyword_set(ndayspm) THEN BEGIN
+        IF ndayspm EQ 1 THEN ndayspm = 30
+      ENDIF ELSE ndayspm = 30
+
+      L_MONTH = LONG(MONTH)
+      L_DAY = LONG(DAY)
+      L_YEAR = LONG(YEAR)
+
+      neg = where(L_YEAR LT 0)
+      IF neg[0] NE -1 THEN L_YEAR[neg] =  L_YEAR[neg]+1
+
+      JUL = ((L_YEAR-1)*12 + (L_MONTH-1))* ndayspm + L_DAY 
+      if n_elements(Hour) + n_elements(Minute) + n_elements(Second) eq 0 then $
+        return, JUL
+      if n_elements(Hour) eq 0 then Hour = 0
+      if n_elements(Minute) eq 0 then Minute = 0
+      if n_elements(Second) eq 0 then Second = 0
+      
+      IF Hour+Minute+Second EQ 0 THEN return, JUL ELSE $
+        return, JUL + (Hour / 24.0d0) + (Minute/1440.0d0) + (Second / 86400.0d0)
+
+    END 
+    'noleap':BEGIN
+    END 
+    ELSE:return, report('only 3 types of calendar are accepted: greg, 360d and noleap')
+  ENDCASE
+
+END
