WAVEWATCH III  beta 0.0.1
w3timemd.F90 File Reference

Go to the source code of this file.

Modules

module  w3timemd
 

Functions/Subroutines

subroutine w3timemd::tick21 (TIME, DTIME)
 
integer function iymd21 (NYMD, M)
 
real function w3timemd::dsec21 (TIME1, TIME2)
 
integer function mymd21 (NYMD)
 
real function w3timemd::tdiff (T1, T2)
 
subroutine w3timemd::stme21 (TIME, DTME21)
 
integer function w3timemd::julday (id, mm, iyyy)
 
subroutine w3timemd::caldat (julian, id, mm, iyyy)
 
real(kind=8) function w3timemd::time2hours (TIME)
 
subroutine w3timemd::prinit
 
subroutine w3timemd::prtime (PTIME)
 
subroutine w3timemd::t2d (TIME, DAT, IERR)
 
subroutine w3timemd::d2t (DAT, TIME, IERR)
 
subroutine w3timemd::d2j (DAT, JULIAN, IERR)
 
subroutine w3timemd::j2d (JULIAN, DAT, IERR)
 
double precision function w3timemd::tsub (T1, T2)
 
double precision function w3timemd::tsubsec (T1, T2)
 
subroutine w3timemd::u2d (UNITS, DAT, IERR)
 
subroutine w3timemd::t2iso (TIME, ISODT)
 

Variables

character, public w3timemd::caltype
 

Function/Subroutine Documentation

◆ iymd21()

integer function tick21::iymd21 ( integer, intent(in)  NYMD,
integer, intent(in)  M 
)

Definition at line 198 of file w3timemd.F90.

198  !/
199  !/ +-----------------------------------+
200  !/ | WAVEWATCH III NOAA/NCEP |
201  !/ | H. L. Tolman |
202  !/ | FORTRAN 90 |
203  !/ | Last update : 18-Jun-2020 |
204  !/ +-----------------------------------+
205  !/ Based on INCYMD of the GLA GCM.
206  !/
207  !/ 18-Oct-1998 : Final FORTRAN 77 ( version 1.18 )
208  !/ 29-Nov-1999 : Upgrade to FORTRAN 90 ( version 2.00 )
209  !/ 10-Jan-2017 : Add NOLEAP option, 365 day calendar ( version 6.00 )
210  !/ 18-Jun-2020 : Add 360-day calendar option ( version 7.08 )
211  !/
212  ! 1. Purpose :
213  !
214  ! Increment date in YYYYMMDD format by +/- 1 day.
215  !
216  ! 3. Parameters :
217  !
218  ! Parameter list
219  ! ----------------------------------------------------------------
220  ! NYMD Int. I Old date in YYMMDD format.
221  ! M Int. I +/- 1 (Day adjustment)
222  ! ----------------------------------------------------------------
223  !
224  ! 4. Subroutines used :
225  !
226  ! Name Type Module Description
227  ! ----------------------------------------------------------------
228  ! STRACE Subr. W3SERVMD Subroutine tracing.
229  ! ----------------------------------------------------------------
230  !
231  ! 5. Called by :
232  !
233  ! Any subroutine.
234  !
235  ! 8. Structure :
236  !
237  ! See source code.
238  !
239  ! 9. Switches :
240  !
241  ! !/S Enable subroutine tracing using STRACE.
242  !
243  ! 10. Source code :
244  !
245  !/ ------------------------------------------------------------------- /
246  !/
247  IMPLICIT NONE
248  !/
249  !/ ------------------------------------------------------------------- /
250  !/ Parameter list
251  !/
252  INTEGER, INTENT(IN) :: NYMD, M
253  !/
254  !/ ------------------------------------------------------------------- /
255  !/ Local parameters
256  !/
257  INTEGER :: NY, NM, ND
258  INTEGER, SAVE :: NDPM(12)
259 #ifdef W3_S
260  INTEGER, SAVE :: IENT = 0
261 #endif
262  LOGICAL :: LEAP
263  !/
264  !/ ------------------------------------------------------------------- /
265  !/
266 #ifdef W3_S
267  CALL strace (ient, 'IYMD21')
268 #endif
269  !
270  ! Declare the number of days in month depending on calendar
271  !
272  IF (trim(caltype) .EQ. '360_day' ) THEN
273  ndpm=(/ 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30 /)
274  ELSE
275  ndpm=(/ 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 /)
276  END IF
277  !
278  ! "Unpack" and increment date :
279  !
280  ny = nymd / 10000
281  nm = mod(nymd,10000) / 100
282  nm = min( 12 , max(1,nm) )
283  nd = mod(nymd,100) + m
284  ! Add override for simulations with no leap years
285  IF (trim(caltype) .EQ. 'standard' ) THEN
286  leap = mod(ny,400).EQ.0 .OR. &
287  ( mod(ny,4).EQ.0 .AND. mod(ny,100).NE.0 )
288  ELSE
289  leap = .false.
290  END IF
291  !
292  ! M = -1, change month if necessary :
293  !
294  IF (nd.EQ.0) THEN
295  nm = nm - 1
296  IF (nm.EQ.0) THEN
297  nm = 12
298  ny = ny - 1
299  ENDIF
300  nd = ndpm(nm)
301  IF (nm.EQ.2 .AND. leap) nd = 29
302  END IF
303  !
304  ! M = 1, leap year
305  !
306  IF (nd.EQ.29 .AND. nm.EQ.2 .AND. leap) GO TO 20
307  !
308  ! next month
309  !
310  IF (nd.GT.ndpm(nm)) THEN
311  nd = 1
312  nm = nm + 1
313  IF (nm.GT.12) THEN
314  nm = 1
315  ny = ny + 1
316  ENDIF
317  END IF
318  !
319 20 CONTINUE
320  iymd21 = ny*10000 + nm*100 + nd
321  !
322  RETURN
323  !/
324  !/ End of IYMD21 ----------------------------------------------------- /
325  !/

References w3timemd::caltype, and w3servmd::strace().

Referenced by w3timemd::tick21().

◆ mymd21()

integer function dsec21::mymd21 ( integer, intent(in)  NYMD)

Definition at line 460 of file w3timemd.F90.

460  !/
461  !/ +-----------------------------------+
462  !/ | WAVEWATCH III NOAA/NCEP |
463  !/ | H. L. Tolman |
464  !/ | FORTRAN 90 |
465  !/ | Last update : 18-Jun-2020 |
466  !/ +-----------------------------------+
467  !/ Based on MODYMD of the GLA GCM.
468  !/
469  !/ 19-Oct-1998 : Final FORTRAN 77 ( version 1.18 )
470  !/ 29-Nov-1999 : Upgrade to FORTRAN 90 ( version 2.00 )
471  !/ 10-Jan-2017 : Add NOLEAP option, 365 day calendar ( version 6.01 )
472  !/ 18-Jun-2020 : Add 360-day calendar support ( version 7.08 )
473  !/
474  ! 1. Purpose :
475  !
476  ! Convert date in YYMMDD format to julian date.
477  !
478  ! 3. Parameters :
479  !
480  ! Parameter list
481  ! ----------------------------------------------------------------
482  ! NYMD Int. I Date in YYMMDD format.
483  ! ----------------------------------------------------------------
484  !
485  ! 4. Subroutines used :
486  !
487  ! Name Type Module Description
488  ! ----------------------------------------------------------------
489  ! STRACE Subr. W3SERVMD Subroutine tracing.
490  ! ----------------------------------------------------------------
491  !
492  ! 5. Called by :
493  !
494  ! Any subroutine.
495  !
496  ! 8. Structure :
497  !
498  ! See source code.
499  !
500  ! 9. Switches :
501  !
502  ! !/S Enable subroutine tracing using STRACE.
503  !
504  ! 10. Source code :
505  !
506  !/ ------------------------------------------------------------------- /
507  !/
508  IMPLICIT NONE
509  !/
510  !/ ------------------------------------------------------------------- /
511  !/ Parameter list
512  !/
513  INTEGER, INTENT(IN) :: NYMD
514  !/
515  !/ ------------------------------------------------------------------- /
516  !/ Local parameters
517  !/
518  INTEGER :: NY, NM, ND
519  INTEGER, SAVE :: NDPM(12)
520 #ifdef W3_S
521  INTEGER, SAVE :: IENT = 0
522 #endif
523  LOGICAL :: LEAP
524  !/
525  !/ ------------------------------------------------------------------- /
526  !/
527 #ifdef W3_S
528  CALL strace (ient, 'MYMD21')
529 #endif
530  !
531  ! Declare the number of days in month depending on calendar
532  !
533  IF (trim(caltype) .EQ. '360_day' ) THEN
534  ndpm=(/ 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30 /)
535  ELSE
536  ndpm=(/ 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 /)
537  END IF
538  !
539  ! "Unpack" and increment date :
540  !
541  ny = nymd / 10000
542  nm = mod(nymd,10000) / 100
543  nd = mod(nymd,100)
544  !Allow override for NoLeap simulations
545  IF (trim(caltype) .EQ. 'standard' ) THEN
546  leap = mod(ny,400).EQ.0 .OR. &
547  ( mod(ny,4).EQ.0 .AND. mod(ny,100).NE.0 )
548  ELSE
549  leap=.false.
550  ENDIF
551  !
552  ! Loop over months :
553  !
554  IF (nm.GT.2 .AND. leap) nd = nd + 1
555  !
556 40 CONTINUE
557  IF (nm.LE.1) GO TO 60
558  nm = nm - 1
559  nd = nd + ndpm(nm)
560  GO TO 40
561  !
562 60 CONTINUE
563  mymd21 = nd
564  !
565  RETURN
566  !/
567  !/ End of MYMD21 ----------------------------------------------------- /
568  !/

References w3timemd::caltype, and w3servmd::strace().

Referenced by w3timemd::dsec21().

mymd21
integer function mymd21(NYMD)
Definition: w3timemd.F90:460
iymd21
integer function iymd21(NYMD, M)
Definition: w3timemd.F90:198
w3servmd::strace
subroutine strace(IENT, SNAME)
Definition: w3servmd.F90:148