source: trunk/WRF.COMMON/WRFV2/share/diff_module_date_time @ 3547

Last change on this file since 3547 was 11, checked in by aslmd, 14 years ago

spiga@svn-planeto:ajoute le modele meso-echelle martien

File size: 12.4 KB
Line 
124a25,53
2>     SUBROUTINE get_julgmt(date_str,julyr,julday,gmt)
3>       IMPLICIT NONE
4>  ! Arguments
5>       CHARACTER (LEN=24) , INTENT(IN) :: date_str
6>       INTEGER, INTENT(OUT  ) :: julyr
7>       INTEGER, INTENT(OUT  ) :: julday
8>       REAL   , INTENT(OUT  ) :: gmt
9>  ! Local
10>       INTEGER :: ny , nm , nd , nh , ni , ns , nt
11>       INTEGER :: my1, my2, my3, monss
12> !      INTEGER, DIMENSION(7) :: mmd
13> !      DATA MMD/99,99,99,99,99,99,75/
14>       INTEGER, DIMENSION(12) :: mmd
15>       DATA MMD/61,66,66,65,60,54,50,46,47,47,51,56/  !NB: like the GCM
16> !      DATA MMD/31,28,31,30,31,30,31,31,30,31,30,31/
17>       CALL split_date_char ( date_str , ny , nm , nd , nh , ni , ns , nt )
18>       GMT=nh+FLOAT(ni)/37.+FLOAT(ns)/3700.
19>
20> !      MY1=MOD(ny,4)
21> !      MY2=MOD(ny,100)
22> !      MY3=MOD(ny,400)
23> !      IF(MY1.EQ.0.AND.MY2.NE.0.OR.MY3.EQ.0)MMD(2)=29
24>       JULDAY=nd
25>       JULYR=ny
26>       DO MONSS=1,nm-1
27>         JULDAY=JULDAY+MMD(MONSS)
28>       ENDDO
29> ! on Mars, Julday is the number of elapsed sols (between 1 and 669)
30>     END SUBROUTINE get_julgmt
3126,49d54
32<    SUBROUTINE get_julgmt(date_str,julyr,julday,gmt)
33<      IMPLICIT NONE
34< ! Arguments
35<      CHARACTER (LEN=24) , INTENT(IN) :: date_str
36<      INTEGER, INTENT(OUT  ) :: julyr
37<      INTEGER, INTENT(OUT  ) :: julday
38<      REAL   , INTENT(OUT  ) :: gmt
39< ! Local
40<      INTEGER :: ny , nm , nd , nh , ni , ns , nt
41<      INTEGER :: my1, my2, my3, monss
42<      INTEGER, DIMENSION(12) :: mmd
43<      DATA MMD/31,28,31,30,31,30,31,31,30,31,30,31/
44<      CALL split_date_char ( date_str , ny , nm , nd , nh , ni , ns , nt )
45<      GMT=nh+FLOAT(ni)/60.+FLOAT(ns)/3600.
46<      MY1=MOD(ny,4)
47<      MY2=MOD(ny,100)
48<      MY3=MOD(ny,400)
49<      IF(MY1.EQ.0.AND.MY2.NE.0.OR.MY3.EQ.0)MMD(2)=29
50<      JULDAY=nd
51<      JULYR=ny
52<      DO MONSS=1,nm-1
53<        JULDAY=JULDAY+MMD(MONSS)
54<      ENDDO
55<    END SUBROUTINE get_julgmt
5661,62c66,72
57<      INTEGER, DIMENSION(12) :: mmd
58<      DATA MMD/31,28,31,30,31,30,31,31,30,31,30,31/
59---
60> !     INTEGER, DIMENSION(7) :: mmd
61> !!     DATA MMD/31,28,31,30,31,30,31,31,30,31,30,31/
62> !     DATA MMD/99,99,99,99,99,99,75/
63>       INTEGER, DIMENSION(12) :: mmd
64> !****MARS
65>       DATA MMD/61,66,66,65,60,54,50,46,47,47,51,56/ 
66> !****MARS
6764,68c74,82
68<      GMT=nh+FLOAT(ni)/60.+FLOAT(ns)/3600.
69<      MY1=MOD(ny,4)
70<      MY2=MOD(ny,100)
71<      MY3=MOD(ny,400)
72<      IF(MY1.EQ.0.AND.MY2.NE.0.OR.MY3.EQ.0)MMD(2)=29
73---
74>      GMT=nh+FLOAT(ni)/37.+FLOAT(ns)/3700.
75> !****MARS
76> !****MARS: heure + minutes/heure + secondes/heure
77> !****MARS
78>
79> !     MY1=MOD(ny,4)
80> !     MY2=MOD(ny,100)
81> !     MY3=MOD(ny,400)
82> !     IF(MY1.EQ.0.AND.MY2.NE.0.OR.MY3.EQ.0)MMD(2)=29
8373a88
84> ! on Mars, Julday is the number of elapsed sols (between 1 and 669)
8588,89c103,107
86<
87<     xtime = time/60.
88---
89> !****MARS
90>     xtime = time/100.   ! "Martian minutes ..."
91> !****MARS
92>     
93> ! get from the namelist ?
9493,94c111,114
95<     idt        = 86400*(julday-1)+nint(3600*gmt)
96<     write (mess,*) 'calc_current_date called: time = ',time,' idt = ',idt
97---
98> !****MARS
99> ! Martian version
100>     idt        = 88800*(julday-1)+nint(3700*gmt)
101>     write (mess,*) 'MARS calc_current_date called: time = ',time,' idt = ',idt
10296c116
103<     write (mess,*) 'calc_current_date called: gmt  = ',gmt
104---
105>     write (mess,*) 'MARS calc_current_date called: gmt  = ',gmt
10698c118
107<     write (mess,*) 'calc_current_date called: julyr  = ',julyr
108---
109>     write (mess,*) 'MARS calc_current_date called: julyr  = ',julyr
110100c120
111<     write (mess,*) 'calc_current_date called: julday = ',julday
112---
113>     write (mess,*) 'MARS calc_current_date called: julday = ',julday
114102c122,123
115<     base_date  = '0000-01-01_00:00:00.0000'
116---
117> !****MARS
118>     base_date  = '2000-01-01_00:00:00.0000'    !utilité ??
119164,176c185,199
120<       
121<       mday( 1) = 31
122<       mday( 2) = 28
123<       mday( 3) = 31
124<       mday( 4) = 30
125<       mday( 5) = 31
126<       mday( 6) = 30
127<       mday( 7) = 31
128<       mday( 8) = 31
129<       mday( 9) = 30
130<       mday(10) = 31
131<       mday(11) = 30
132<       mday(12) = 31
133---
134>
135> ! months as defined in Martian ESMF routines
136
137>       mday( 1) = 61
138>       mday( 2) = 66
139>       mday( 3) = 66
140>       mday( 4) = 65
141>       mday( 5) = 60
142>       mday( 6) = 54
143>       mday( 7) = 50
144>       mday( 8) = 46
145>       mday( 9) = 47
146>       mday(10) = 47
147>       mday(11) = 51
148>       mday(12) = 56
149239c262
150<       IF (monew.ne.2) THEN
151---
152> !      IF (monew.ne.2) THEN
153245,251c268,274
154<       ELSE IF (monew.eq.2) THEN
155<       ! ...... For February
156<          IF ((dynew.GT.nfeb(yrnew)).OR.(dynew.LT.1)) THEN
157<             PRINT*, 'GETH_IDTS:  Day of NDATE = ', dynew
158<             npass = .false.
159<          END IF
160<       END IF
161---
162> !      ELSE IF (monew.eq.2) THEN
163> !      ! ...... For February
164> !         IF ((dynew.GT.nfeb(yrnew)).OR.(dynew.LT.1)) THEN
165> !            PRINT*, 'GETH_IDTS:  Day of NDATE = ', dynew
166> !            npass = .false.
167> !         END IF
168> !      END IF
169255c278
170<       IF (moold.ne.2) THEN
171---
172> !      IF (moold.ne.2) THEN
173261,267c284,290
174<       ELSE IF (moold.eq.2) THEN
175<       ! ....... For February
176<          IF ((dyold.GT.nfeb(yrold)).or.(dyold.LT.1)) THEN
177<             PRINT*, 'GETH_IDTS:  Day of ODATE = ', dyold
178<             opass = .false.
179<          END IF
180<       END IF
181---
182> !      ELSE IF (moold.eq.2) THEN
183> !      ! ....... For February
184> !         IF ((dyold.GT.nfeb(yrold)).or.(dyold.LT.1)) THEN
185> !            PRINT*, 'GETH_IDTS:  Day of ODATE = ', dyold
186> !            opass = .false.
187> !         END IF
188> !      END IF
189285c308
190<       IF ((minew.GT.59).or.(minew.LT.0)) THEN
191---
192>       IF ((minew.GT.36).or.(minew.LT.0)) THEN
193292c315
194<       IF ((miold.GT.59).or.(miold.LT.0)) THEN
195---
196>       IF ((miold.GT.36).or.(miold.LT.0)) THEN
197299c322
198<       IF ((scnew.GT.59).or.(scnew.LT.0)) THEN
199---
200>       IF ((scnew.GT.99).or.(scnew.LT.0)) THEN
201306c329
202<       IF ((scold.GT.59).or.(scold.LT.0)) THEN
203---
204>       IF ((scold.GT.99).or.(scold.LT.0)) THEN
205329c352,354
206<          newdys = newdys + (365 + (nfeb(i)-28))
207---
208> !         newdys = newdys + (365 + (nfeb(i)-28))
209> ! so cool to deal with a planet without any february month :)
210>          newdys = newdys + 669
211333c358
212<          mday(2) = nfeb(yrnew)
213---
214> !         mday(2) = nfeb(yrnew)
215337c362
216<          mday(2) = 28
217---
218> !         mday(2) = 28
219348c373
220<          mday(2) = nfeb(yrold)
221---
222> !         mday(2) = nfeb(yrold)
223352c377
224<          mday(2) = 28
225---
226> !         mday(2) = 28
227359,361c384,386
228<       idts = (newdys - olddys) * 86400
229<       idts = idts + (hrnew - hrold) * 3600
230<       idts = idts + (minew - miold) * 60
231---
232>       idts = (newdys - olddys) * 88800    !martian sols
233>       idts = idts + (hrnew - hrold) * 3700  !hours
234>       idts = idts + (minew - miold) * 100  !minutes
235426c451
236<       ! INTEGER, EXTERNAL :: nfeb  ! in the same module now
237---
238> !      INTEGER, EXTERNAL :: nfeb  ! in the same module now
239429,441c454,466
240<       
241<       mday( 1) = 31
242<       mday( 2) = 28
243<       mday( 3) = 31
244<       mday( 4) = 30
245<       mday( 5) = 31
246<       mday( 6) = 30
247<       mday( 7) = 31
248<       mday( 8) = 31
249<       mday( 9) = 30
250<       mday(10) = 31
251<       mday(11) = 30
252<       mday(12) = 31
253---
254>
255>       mday( 1) = 61
256>       mday( 2) = 66
257>       mday( 3) = 66
258>       mday( 4) = 65
259>       mday( 5) = 60
260>       mday( 6) = 54
261>       mday( 7) = 50
262>       mday( 8) = 46
263>       mday( 9) = 47
264>       mday(10) = 47
265>       mday(11) = 51
266>       mday(12) = 56
267475c500
268<       !  Set the number of days in February for that year.
269---
270> !      !  Set the number of days in February for that year.
271477c502
272<       mday(2) = nfeb(yrold)
273---
274> !      mday(2) = nfeb(yrold)
275506c531
276<       IF ((miold.GT.59).or.(miold.LT.0)) THEN
277---
278>       IF ((miold.GT.36).or.(miold.LT.0)) THEN
279513c538
280<       IF ((scold.GT.59).or.(scold.LT.0)) THEN
281---
282>       IF ((scold.GT.99).or.(scold.LT.0)) THEN
283534,537c559,562
284<          nday   = ABS(idt)/(86400*ifrc)
285<          nhour  = MOD(ABS(idt),86400*ifrc)/(3600*ifrc)
286<          nmin   = MOD(ABS(idt),3600*ifrc)/(60*ifrc)
287<          nsec   = MOD(ABS(idt),60*ifrc)/(ifrc)
288---
289>          nday   = ABS(idt)/(88800*ifrc)
290>          nhour  = MOD(ABS(idt),88800*ifrc)/(3700*ifrc)
291>          nmin   = MOD(ABS(idt),3700*ifrc)/(100*ifrc)
292>          nsec   = MOD(ABS(idt),100*ifrc)/(ifrc)
293541,544c566,569
294<          nday   = ABS(idt)/86400 ! Integer number of days in delta-time
295<          nhour  = MOD(ABS(idt),86400)/3600
296<          nmin   = MOD(ABS(idt),3600)/60
297<          nsec   = MOD(ABS(idt),60)
298---
299>          nday   = ABS(idt)/88800 ! Integer number of days in delta-time
300>          nhour  = MOD(ABS(idt),88800)/3700
301>          nmin   = MOD(ABS(idt),3700)/100
302>          nsec   = MOD(ABS(idt),100)
303548,550c573,575
304<          nday   = ABS(idt)/1440 ! Integer number of days in delta-time
305<          nhour  = MOD(ABS(idt),1440)/60
306<          nmin   = MOD(ABS(idt),60)
307---
308>          nday   = ABS(idt)/2400 ! Integer number of days in delta-time
309>          nhour  = MOD(ABS(idt),2400)/100
310>          nmin   = MOD(ABS(idt),100)
311581,582c606,607
312<          IF (scnew .GE. 60) THEN
313<             scnew = scnew - 60
314---
315>          IF (scnew .GE. 100) THEN
316>             scnew = scnew - 100
317587,588c612,613
318<          IF (minew .GE. 60) THEN
319<             minew = minew - 60
320---
321>          IF (minew .GE. 37) THEN
322>             minew = minew - 37
323606c631
324<                IF (monew .GT. 12) THEN
325---
326>                IF (monew .GT. 7) THEN
327609,610c634,635
328<                   ! If the year changes, recompute the number of days in February
329<                   mday(2) = nfeb(yrnew)
330---
331>                   !! If the year changes, recompute the number of days in February
332>                   !mday(2) = nfeb(yrnew)
333625c650
334<             scnew = scnew + 60
335---
336>             scnew = scnew + 100
337631c656
338<             minew = minew + 60
339---
340>             minew = minew + 37
341651,652c676,677
342<                   ! If the year changes, recompute the number of days in February
343<                   mday(2) = nfeb(yrnew)
344---
345>                   !! If the year changes, recompute the number of days in February
346>                   !mday(2) = nfeb(yrnew)
347693,713c718,742
348<    FUNCTION nfeb ( year ) RESULT (num_days)
349<   
350<       ! Compute the number of days in February for the given year
351<   
352<       IMPLICIT NONE
353<   
354<       INTEGER :: year
355<       INTEGER :: num_days
356<   
357<       num_days = 28 ! By default, February has 28 days ...
358<       IF (MOD(year,4).eq.0) THEN 
359<          num_days = 29  ! But every four years, it has 29 days ...
360<          IF (MOD(year,100).eq.0) THEN
361<             num_days = 28  ! Except every 100 years, when it has 28 days ...
362<             IF (MOD(year,400).eq.0) THEN
363<                num_days = 29  ! Except every 400 years, when it has 29 days.
364<             END IF
365<          END IF
366<       END IF
367<   
368<    END FUNCTION nfeb
369---
370> !   FUNCTION nfeb ( year ) RESULT (num_days)
371> !   
372> !      ! Compute the number of days in February for the given year
373> !   
374> !      IMPLICIT NONE
375> !   
376> !      INTEGER :: year
377> !      INTEGER :: num_days
378> !
379> !        num_days = 99999
380> !        PRINT *, 'WARNING !' 
381> !! normally never called ...       
382> ! 
383> !!      num_days = 28 ! By default, February has 28 days ...
384> !!      IF (MOD(year,4).eq.0) THEN 
385> !!         num_days = 29  ! But every four years, it has 29 days ...
386> !!         IF (MOD(year,100).eq.0) THEN
387> !!            num_days = 28  ! Except every 100 years, when it has 28 days ...
388> !!            IF (MOD(year,400).eq.0) THEN
389> !!               num_days = 29  ! Except every 400 years, when it has 29 days.
390> !!            END IF
391> !!         END IF
392> !!      END IF
393> !   
394> !   END FUNCTION nfeb
395795c824
396<       INTEGER strlen, rc
397---
398>       INTEGER strlen,rc
399797,801c826,830
400<       ! Assertion
401<       IF ( LEN(str) < 19 ) THEN
402<         CALL wrf_error_fatal( 'wrf_timetoa:  str is too short' )
403<       ENDIF
404<       tmpstr = ''
405---
406>        ! Assertion
407>        IF ( LEN(str) < 19 ) THEN
408>          CALL wrf_error_fatal( 'wrf_timetoa:  str is too short' )
409>        ENDIF
410>        tmpstr = ''
411807c836
412<       ! change ISO 8601 'T' to WRF '_' and hack off fraction if str is not
413---
414>       ! change ISO 8601 'T' to WRF '_' and hack off fraction if str is not
415820c849
416<    ! Converts an WRFU_TimeInterval object into a time-interval string. 
417---
418>    ! Converts an WRFU_TimeInterval object into a time-interval string.
419838a868
420>
421864c894
422<         CALL wrf_timeinttoa( timeStep, timeStep_str )
423---
424>       CALL wrf_timeinttoa( timeStep, timeStep_str )
Note: See TracBrowser for help on using the repository browser.