[2] | 1 | ;------------------------------------------------------------ |
---|
| 2 | ;------------------------------------------------------------ |
---|
| 3 | ;------------------------------------------------------------ |
---|
| 4 | ;+ |
---|
[97] | 5 | ; @file_comments you better use date2jul |
---|
| 6 | ; @obsolete |
---|
[2] | 7 | ; |
---|
[97] | 8 | ; @file_comments gives julian date equivalent of a date in vairmer |
---|
[2] | 9 | ; ( yymmdd or yyyymmdd ) format |
---|
| 10 | ; sets month, day and year to the corresp values |
---|
| 11 | ; |
---|
[97] | 12 | ; @categories calendar |
---|
[2] | 13 | ; |
---|
[97] | 14 | ; @param vvdate {in} date de la forme yymmdd ou yyyymmdd |
---|
[2] | 15 | ; |
---|
[97] | 16 | ; @uses common.pro vraidate |
---|
[2] | 17 | ; |
---|
[97] | 18 | ; @returns date en jour julien |
---|
[2] | 19 | ; l'annee 0 n'existant pas, qd year est nulle on calcule le |
---|
| 20 | ; jour julien de l'annee -1. |
---|
| 21 | ; COMPATIBLE AVEC L'AN 2000 !!!: une date de la forme yymmdd est |
---|
| 22 | ; donvertit sous la forme yyyymmdd a l''aide de vraidate. |
---|
| 23 | ; Attention, les variables globales year, month day sont attribuees |
---|
| 24 | ; |
---|
[97] | 25 | ; @examples |
---|
| 26 | ; IDL> date = juldate(930124) |
---|
| 27 | ; |
---|
| 28 | ; @history Jerome Vialard (jv\@lodyc.jussieu.fr) |
---|
| 29 | ; 2/7/98 |
---|
[2] | 30 | ;- |
---|
| 31 | ;------------------------------------------------------------ |
---|
| 32 | ;------------------------------------------------------------ |
---|
| 33 | ;------------------------------------------------------------ |
---|
| 34 | function juldate, vvdate, _EXTRA = ex |
---|
[114] | 35 | ; |
---|
| 36 | compile_opt idl2, strictarrsubs, obsolete |
---|
| 37 | ; |
---|
[2] | 38 | vdate = vvdate |
---|
| 39 | vdate = vraidate(vdate, _EXTRA = ex) |
---|
| 40 | @common |
---|
| 41 | ;------------------------------------------------------------ |
---|
| 42 | year=vdate/10000 |
---|
| 43 | month=vdate/100 - year*100 |
---|
| 44 | day=abs(vdate - year*10000 - month*100) |
---|
| 45 | month = abs(month) |
---|
| 46 | ; |
---|
| 47 | mm = month & dd = day & yy = year |
---|
| 48 | ;------------------------------------------------------------ |
---|
| 49 | ndate = n_elements(vdate) |
---|
| 50 | if total(mm EQ 0) EQ ndate then mm[*] = 6 |
---|
| 51 | if total(dd EQ 0) EQ ndate then dd[*] = 15 |
---|
| 52 | if total(yy EQ 0) EQ ndate THEN yy[*] = -1 |
---|
| 53 | ;------------------------------------------------------------ |
---|
| 54 | return, julday(mm,dd,yy, _EXTRA = ex) |
---|
| 55 | ;------------------------------------------------------------ |
---|
| 56 | return, -1 |
---|
| 57 | end |
---|
| 58 | ;------------------------------------------------------------ |
---|