source: trunk/procs/def_time_origin.pro @ 12

Last change on this file since 12 was 2, checked in by post_it, 17 years ago

Initial import from ~/POST_IT/

File size: 1.9 KB
Line 
1FUNCTION def_time_origin, timeave, date1
2
3;
4; compute date format : 0010-JAN-01 00:00:00
5; date1 code [yy..yyy][mm][dd]-[sssss] if <n>s
6;            [yy..yyy][mm][dd] if <n>d
7;            [yy..yyy][mm]     if <n>m
8;            [yy..yyy]         if <n>y
9
10   len1 = strlen(date1)
11
12   mean_type = strmid(timeave, strlen(timeave)-1,1)
13   CASE mean_type OF
14      'y':BEGIN                 ; year case
15         year1 = long(date1)
16         time_origin = string(FORMAT = '(I4)', year1)+'-JAN-01 00:00:00'
17      END
18      'm': BEGIN                ; month case
19         CASE strmid(timeave, strlen(timeave)-2,1) OF
20            'm': BEGIN          ; mean month     
21               month1 = long(strmid(date1, 0, 2))
22               time_origin = '0000-JAN-01 00:00:00'
23            END
24            ELSE: BEGIN         ; month / year     
25               month1 = long(strmid(date1, len1-2, 2))
26               year1  = long(strmid(date1, 0, len1-2))
27               time_origin = string(FORMAT = '(I4.4)', year1)+'-'+trans_month(month1)+'-01 00:00:00'
28            END
29         ENDCASE
30      END
31      'd': BEGIN                ; day case
32         day1   = strmid(date1, len1-2, 2)
33         month1 = long(strmid(date1, len1-4, 2))
34         year1  = long(strmid(date1, 0, len1-4))
35         time_origin = string(FORMAT = '(I4)', year1)+'-'+trans_month(month1)+'-'+day1+' 00:00:00'
36      END
37      's': BEGIN                ; seconds case
38         sec1   = long(strmid(date1, len1-5, 5))
39         day1   = long(strmid(date1, len1-8, 2))
40         month1 = long(strmid(date1, len1-10, 2))
41         year1  = long(strmid(date1, 0, len1-10))
42         print, '   **** def_time_origin not ready for timeave = ', timeave
43      END
44      ELSE: BEGIN
45         print, '   **** def_time_origin not ready for timeave = ', timeave
46         count = -1
47         time = 0
48      END
49   ENDCASE
50
51   return, time_origin
52
53END
Note: See TracBrowser for help on using the repository browser.