SCALE-RM
scale_calendar.F90
Go to the documentation of this file.
1 !-------------------------------------------------------------------------------
11 !-------------------------------------------------------------------------------
12 #include "scalelib.h"
14  !-----------------------------------------------------------------------------
15  !
16  !++ used modules
17  !
18  use scale_precision
19  use scale_io
20  !-----------------------------------------------------------------------------
21  implicit none
22  private
23  !-----------------------------------------------------------------------------
24  !
25  !++ Public procedure
26  !
27  public :: calendar_setup
28  public :: calendar_getdayofyear
29  public :: calendar_date2daysec
30  public :: calendar_daysec2date
31  public :: calendar_ymd2absday
32  public :: calendar_hms2abssec
33  public :: calendar_adjust_daysec
34  public :: calendar_combine_daysec
35  public :: calendar_unit2sec
36  public :: calendar_sec2unit
37  public :: calendar_cfunits2sec
38  public :: calendar_date2char
39  public :: calendar_get_name
40 
41  !-----------------------------------------------------------------------------
42  !
43  !++ Public parameters & variables
44  !
45  integer, public, parameter :: i_year = 1
46  integer, public, parameter :: i_month = 2
47  integer, public, parameter :: i_day = 3
48  integer, public, parameter :: i_hour = 4
49  integer, public, parameter :: i_min = 5
50  integer, public, parameter :: i_sec = 6
51 
52  !-----------------------------------------------------------------------------
53  !
54  !++ Private procedure
55  !
56  private :: calendar_absday2ymd
57  private :: calendar_abssec2hms
58  private :: calendar_ymdhms2nd
59  private :: calendar_ymdhms2mjd
60  private :: checkleap
61 
62  !-----------------------------------------------------------------------------
63  !
64  !++ Private parameters & variables
65  !
66  logical, private :: calendar_360days = .false.
67  logical, private :: calendar_365days = .false.
68 
69  real(DP), private :: calendar_doi = 365.0_dp
70  real(DP), private :: calendar_hour = 24.0_dp
71  real(DP), private :: calendar_min = 60.0_dp
72  real(DP), private :: calendar_sec = 60.0_dp
73 
74  integer, private, parameter :: i_nonleapyear = 1
75  integer, private, parameter :: i_leapyear = 2
76  integer, private, parameter :: i_360days = 3
77  integer, private :: dayofmonth(12,3)
78  data dayofmonth / 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31, & ! non-leap year
79  31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31, & ! leap year
80  30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30 / ! 360 days
81 
82  logical, private :: debug = .false.
83 
84  !-----------------------------------------------------------------------------
85 contains
86  !-----------------------------------------------------------------------------
88  subroutine calendar_setup
89  use scale_prc, only: &
90  prc_abort
91  implicit none
92 
93  namelist / param_calendar / &
94  calendar_360days, &
95  calendar_365days, &
96  debug
97 
98  integer :: ierr
99  !---------------------------------------------------------------------------
100 
101  log_newline
102  log_info("CALENDAR_setup",*) 'Setup'
103 
104  !--- read namelist
105  rewind(io_fid_conf)
106  read(io_fid_conf,nml=param_calendar,iostat=ierr)
107  if( ierr < 0 ) then !--- missing
108  log_info("CALENDAR_setup",*) 'Not found namelist. Default used.'
109  elseif( ierr > 0 ) then !--- fatal error
110  log_error("CALENDAR_setup",*) 'Not appropriate names in namelist PARAM_CALENDAR. Check!'
111  call prc_abort
112  endif
113  log_nml(param_calendar)
114 
115  if ( calendar_360days ) then
116  calendar_doi = 360.0_dp
117  elseif( calendar_365days ) then
118  calendar_doi = 365.0_dp
119  endif
120 
121  log_newline
122  log_info("CALENDAR_setup",*) 'Calendar settings'
123  if ( calendar_360days ) then
124  log_info_cont(*) 'DayOfYear = 360 : ideal setting'
125  elseif( calendar_365days ) then
126  log_info_cont(*) 'DayOfYear = 365 : ideal setting'
127  else
128  log_info_cont(*) 'DayOfYear = 365 or 366 : Gregorian calendar'
129  endif
130 
131  return
132  end subroutine calendar_setup
133 
134  !-----------------------------------------------------------------------------
136  subroutine calendar_getdayofyear( &
137  DayOfYear, &
138  iyear )
139  implicit none
140 
141  real(DP), intent(out) :: DayOfYear ! # of day of year
142  integer, intent(in) :: iyear ! current year
143  !---------------------------------------------------------------------------
144 
145  dayofyear = calendar_doi
146  if( checkleap(iyear) ) dayofyear = calendar_doi + 1.0_dp
147 
148  return
149  end subroutine calendar_getdayofyear
150 
151  !-----------------------------------------------------------------------------
153  subroutine calendar_date2daysec( &
154  absday, &
155  abssec, &
156  ymdhms, &
157  subsec, &
158  offset_year )
159  implicit none
160 
161  integer, intent(out) :: absday
162  real(DP), intent(out) :: abssec
163  integer, intent(in) :: ymdhms(6)
164  real(DP), intent(in) :: subsec
165  integer, intent(in) :: offset_year
166  !---------------------------------------------------------------------------
167 
168  call calendar_ymd2absday( absday, & ! [OUT]
169  ymdhms(i_year), & ! [IN]
170  ymdhms(i_month), & ! [IN]
171  ymdhms(i_day), & ! [IN]
172  offset_year ) ! [IN]
173 
174  call calendar_hms2abssec( abssec, & ! [OUT]
175  ymdhms(i_hour), & ! [IN]
176  ymdhms(i_min), & ! [IN]
177  ymdhms(i_sec), & ! [IN]
178  subsec ) ! [IN]
179 
180  return
181  end subroutine calendar_date2daysec
182 
183  !-----------------------------------------------------------------------------
185  subroutine calendar_daysec2date( &
186  ymdhms, &
187  subsec, &
188  absday, &
189  abssec, &
190  offset_year )
191  implicit none
192 
193  integer, intent(out) :: ymdhms(6)
194  real(DP), intent(out) :: subsec
195  integer, intent(in) :: absday
196  real(DP), intent(in) :: abssec
197  integer, intent(in) :: offset_year
198  !---------------------------------------------------------------------------
199 
200  call calendar_absday2ymd( ymdhms(i_year), & ! [OUT]
201  ymdhms(i_month), & ! [OUT]
202  ymdhms(i_day), & ! [OUT]
203  absday, & ! [IN]
204  offset_year ) ! [IN]
205 
206  call calendar_abssec2hms( ymdhms(i_hour), & ! [OUT]
207  ymdhms(i_min), & ! [OUT]
208  ymdhms(i_sec), & ! [OUT]
209  subsec, & ! [OUT]
210  abssec ) ! [IN]
211 
212  return
213  end subroutine calendar_daysec2date
214 
215  !-----------------------------------------------------------------------------
217  subroutine calendar_ymd2absday( &
218  absday, &
219  gyear, &
220  gmonth, &
221  gday, &
222  oyear )
223  implicit none
224 
225  integer, intent(out) :: absday
226  integer, intent(in) :: gyear
227  integer, intent(in) :: gmonth
228  integer, intent(in) :: gday
229  integer, intent(in) :: oyear
230 
231  integer :: gyear_mod, gmonth_mod
232  integer :: yearday, monthday
233  integer :: m, ileap
234  !---------------------------------------------------------------------------
235 
236  gmonth_mod = mod( gmonth-1, 12 ) + 1
237  gyear_mod = gyear + ( gmonth-gmonth_mod ) / 12
238 
239  if ( calendar_360days .OR. calendar_365days ) then
240  yearday = int( calendar_doi * ( gyear_mod - oyear ) )
241  else
242  yearday = int( calendar_doi * ( gyear_mod - oyear ) ) &
243  + int( real(gyear_mod-1,kind=DP) / 4.0_DP ) &
244  - int( real(gyear_mod-1,kind=DP) / 100.0_dp ) &
245  + int( real(gyear_mod-1,kind=DP) / 400.0_dp ) &
246  - int( real(oyear -1,kind=DP) / 4.0_dp ) &
247  + int( real(oyear -1,kind=DP) / 100.0_dp ) &
248  - int( real(oyear -1,kind=DP) / 400.0_dp )
249  endif
250 
251  ileap = i_nonleapyear
252  if( checkleap(gyear_mod) ) ileap = i_leapyear
253  if( calendar_360days ) ileap = i_360days
254 
255  monthday = 0
256  do m = 1, gmonth_mod-1
257  monthday = monthday + dayofmonth(m,ileap)
258  enddo
259 
260  absday = yearday + monthday + gday - 1
261 
262  return
263  end subroutine calendar_ymd2absday
264 
265  !-----------------------------------------------------------------------------
267  subroutine calendar_absday2ymd( &
268  gyear, &
269  gmonth, &
270  gday, &
271  absday, &
272  oyear )
273  implicit none
274 
275  integer, intent(out) :: gyear
276  integer, intent(out) :: gmonth
277  integer, intent(out) :: gday
278  integer, intent(in) :: absday
279  integer, intent(in) :: oyear
280 
281  integer :: checkday
282  integer :: i, ileap
283  !---------------------------------------------------------------------------
284 
285  if ( calendar_360days ) then
286  gyear = int( real(absday,kind=DP) / 361.0_DP ) + oyear ! first guess
287  else
288  gyear = int( real(absday,kind=DP) / 366.0_DP ) + oyear ! first guess
289  endif
290 
291  do i = 1, 1000
292  call calendar_ymd2absday( checkday, gyear+1, 1, 1, oyear )
293  if( absday < checkday ) exit
294  gyear = gyear + 1
295  enddo
296 
297  ileap = i_nonleapyear
298  if( checkleap(gyear) ) ileap = i_leapyear
299  if( calendar_360days ) ileap = i_360days
300 
301  gmonth = 1
302  do i = 1, 1000
303  call calendar_ymd2absday( checkday, gyear, gmonth, dayofmonth(gmonth,ileap), oyear )
304  if( absday <= checkday ) exit
305  gmonth = gmonth + 1
306  enddo
307 
308  call calendar_ymd2absday( checkday, gyear, gmonth, 1, oyear )
309  gday = absday - checkday + 1
310 
311  return
312  end subroutine calendar_absday2ymd
313 
314  !-----------------------------------------------------------------------------
316  subroutine calendar_hms2abssec( &
317  abssec, &
318  hour, &
319  minute, &
320  second, &
321  subsec )
322  implicit none
323 
324  real(DP), intent(out) :: abssec
325  integer, intent(in) :: hour
326  integer, intent(in) :: minute
327  integer, intent(in) :: second
328  real(DP), intent(in) :: subsec
329  !---------------------------------------------------------------------------
330 
331  abssec = real(hour, kind=DP) * CALENDAR_MIN * CALENDAR_SEC &
332  + real(minute,kind=DP) * CALENDAR_SEC &
333  + real(second,kind=DP) &
334  + subsec
335 
336  return
337  end subroutine calendar_hms2abssec
338 
339  !-----------------------------------------------------------------------------
341  subroutine calendar_abssec2hms( &
342  hour, &
343  minute, &
344  second, &
345  subsec, &
346  abssec )
347  implicit none
348 
349  integer, intent(out) :: hour
350  integer, intent(out) :: minute
351  integer, intent(out) :: second
352  real(DP), intent(out) :: subsec
353  real(DP), intent(in) :: abssec
354 
355  real(DP) :: nsec, nmin, nhour, temp
356  !---------------------------------------------------------------------------
357 
358  nsec = real(int(abssec),kind=dp)
359  subsec = abssec - nsec
360 
361  temp = mod( nsec, calendar_sec )
362  second = int( temp )
363  nmin = ( nsec-temp ) / calendar_sec
364 
365  temp = mod( nmin, calendar_min )
366  minute = int( temp )
367  nhour = ( nmin-temp ) / calendar_min
368 
369  temp = mod( nhour, calendar_hour )
370  hour = int( temp )
371 
372  return
373  end subroutine calendar_abssec2hms
374 
375  !-----------------------------------------------------------------------------
377  subroutine calendar_adjust_daysec( &
378  absday, &
379  abssec )
380  implicit none
381 
382  integer, intent(inout) :: absday
383  real(DP), intent(inout) :: abssec
384 
385  integer :: addday
386  !---------------------------------------------------------------------------
387 
388  addday = int( abssec / ( calendar_hour * calendar_min * calendar_sec ) )
389 
390  absday = absday + addday
391 
392  abssec = abssec - real(addday,kind=DP) * CALENDAR_HOUR * CALENDAR_MIN * CALENDAR_SEC
393 
394  if ( abssec < 0.0_dp ) then
395  absday = absday - 1
396  abssec = abssec + calendar_hour * calendar_min * calendar_sec
397  endif
398 
399  return
400  end subroutine calendar_adjust_daysec
401 
402  !-----------------------------------------------------------------------------
404  function calendar_combine_daysec( absday, abssec ) result(daysec)
405  implicit none
406 
407  integer, intent(in) :: absday
408  real(DP), intent(in) :: abssec
409  real(DP) :: daysec
410  !---------------------------------------------------------------------------
411 
412  daysec = real(absday,kind=DP) * CALENDAR_SEC * CALENDAR_MIN * CALENDAR_HOUR &
413  + abssec
414 
415  return
416  end function calendar_combine_daysec
417 
418  !-----------------------------------------------------------------------------
420  subroutine calendar_unit2sec( &
421  second, &
422  value, &
423  unit )
424  use scale_prc, only: &
425  prc_abort
426  implicit none
427 
428  real(DP), intent(out) :: second
429  real(DP), intent(in) :: value
430  character(len=*), intent(in) :: unit
431  !---------------------------------------------------------------------------
432 
433  select case(unit)
434  case('MSEC')
435  second = value * 1.e-3_dp
436  case('SEC', 'seconds')
437  second = value
438  case('MIN')
439  second = value * calendar_sec
440  case('HOUR')
441  second = value * calendar_sec * calendar_min
442  case('DAY')
443  second = value * calendar_sec * calendar_min * calendar_hour
444  case default
445  log_error("CALENDAR_unit2sec",*) 'Unsupported UNIT: ', trim(unit), ', ', value
446  call prc_abort
447  endselect
448 
449  return
450  end subroutine calendar_unit2sec
451 
452  !-----------------------------------------------------------------------------
454  subroutine calendar_sec2unit( &
455  value, &
456  second, &
457  unit )
458  use scale_prc, only: &
459  prc_abort
460  implicit none
461 
462  real(DP), intent(out) :: value
463  real(DP), intent( in) :: second
464  character(len=*), intent( in) :: unit
465  !---------------------------------------------------------------------------
466 
467  select case(trim(unit))
468  case('MSEC', 'msec')
469  value = second / 1.0e-3_dp
470  case('SEC', 'seconds', 'sec', 's')
471  value = second
472  case('MIN', 'mins', 'min')
473  value = second / calendar_sec
474  case('HOUR', 'hours', 'hour', 'h')
475  value = second / (calendar_sec * calendar_min)
476  case('DAY', 'days', 'day')
477  value = second / (calendar_sec * calendar_min * calendar_hour)
478  case default
479  log_error("CALENDAR_sec2unit",*) 'Unsupported UNIT: ', trim(unit), ', ', value
480  call prc_abort
481  endselect
482 
483  end subroutine calendar_sec2unit
484 
485  !-----------------------------------------------------------------------------
487  function calendar_cfunits2sec( cftime, cfunits, offset_year, startdaysec ) result( sec )
488  use scale_prc, only: &
489  prc_abort
490  implicit none
491 
492  real(DP), intent(in) :: cftime
493  character(len=*), intent(in) :: cfunits
494  integer, intent(in) :: offset_year
495  real(DP), intent(in), optional :: startdaysec
496  real(DP) :: sec
497 
498  character(len=H_MID) :: tunit
499  character(len=H_MID) :: buf
500 
501  integer :: date(6)
502  integer :: day
503  real(DP) :: sec0
504 
505  integer :: l
506 
507  intrinsic index
508  !---------------------------------------------------------------------------
509 
510  l = index( cfunits, " since " )
511  if ( l > 1 ) then ! untis is under the CF convension
512  tunit = cfunits(1:l-1)
513  buf = cfunits(l+7:)
514 
515  l = index(buf,"-")
516  if ( l /= 5 ) then
517  log_error("CALENDAR_CFunits2sec",*) 'units for time is invalid (year)'
518  log_error_cont(*) trim(cfunits)
519  log_error_cont(*) trim(buf)
520  call prc_abort
521  end if
522  read(buf(1:4),*) date(1) ! year
523  buf = buf(6:)
524 
525  l = index(buf,"-")
526  if ( l /= 3 ) then
527  log_error("CALENDAR_CFunits2sec",*) 'units for time is invalid (month)'
528  log_error_cont(*) trim(cfunits)
529  log_error_cont(*) trim(buf)
530  call prc_abort
531  end if
532  read(buf(1:2),*) date(2) ! month
533  buf = buf(4:)
534 
535  l = index(buf," ")
536  if ( l /= 3 ) then
537  log_error("CALENDAR_CFunits2sec",*) 'units for time is invalid (day)'
538  log_error_cont(*) trim(cfunits)
539  log_error_cont(*) trim(buf)
540  call prc_abort
541  end if
542  read(buf(1:2),*) date(3) ! day
543  buf = buf(4:)
544 
545  l = index(buf,":")
546  if ( l /= 3 ) then
547  log_error("CALENDAR_CFunits2sec",*) 'units for time is invalid (hour)'
548  log_error_cont(*) trim(cfunits)
549  log_error_cont(*) trim(buf)
550  call prc_abort
551  end if
552  read(buf(1:2),*) date(4) ! hour
553  buf = buf(4:)
554 
555  l = index(buf,":")
556  if ( l /= 3 ) then
557  log_error("CALENDAR_CFunits2sec",*) 'units for time is invalid (min)'
558  log_error_cont(*) trim(cfunits)
559  log_error_cont(*) trim(buf)
560  call prc_abort
561  end if
562  read(buf(1:2),*) date(5) ! min
563  buf = buf(4:)
564 
565  if ( len_trim(buf) /= 2 ) then
566  log_error("CALENDAR_CFunits2sec",*) 'units for time is invalid (sec)'
567  log_error_cont(*) trim(cfunits)
568  log_error_cont(*) trim(buf)
569  log_error_cont(*) len_trim(buf)
570  call prc_abort
571  end if
572  read(buf(1:2),*) date(6) ! sec
573 
574  call calendar_date2daysec( day, & ! (out)
575  sec0, & ! (out)
576  date(:), & ! (in)
577  0.0_dp, & ! (in)
578  offset_year ) ! (in)
579 
580  sec0 = calendar_combine_daysec( day, sec0 )
581  else
582  tunit = cfunits
583  if ( present(startdaysec) ) then
584  sec0 = startdaysec
585  else
586  sec0 = 0.0_dp
587  end if
588  end if
589 
590  call calendar_unit2sec( sec, cftime, tunit )
591 
592  sec = sec0 + sec
593 
594  return
595  end function calendar_cfunits2sec
596 
597  !-----------------------------------------------------------------------------
599  subroutine calendar_date2char( &
600  chardate, &
601  ymdhms, &
602  subsec )
603  implicit none
604 
605  character(len=27), intent(out) :: chardate
606  integer, intent(in) :: ymdhms(6)
607  real(DP), intent(in) :: subsec
608  !---------------------------------------------------------------------------
609 
610  write(chardate,'(I4.4,A1,I2.2,A1,I2.2,A1,I2.2,A1,I2.2,A1,I2.2,A2,F6.3)') &
611  ymdhms(1),'/',ymdhms(2),'/',ymdhms(3),' ', &
612  ymdhms(4),':',ymdhms(5),':',ymdhms(6),' +', &
613  subsec
614 
615  return
616  end subroutine calendar_date2char
617 
618  !-----------------------------------------------------------------------------
621  function checkleap( iyear )
622  implicit none
623 
624  integer, intent(in) :: iyear
625  logical :: checkleap
626 
627  integer :: check4, check100, check400
628  !---------------------------------------------------------------------------
629 
630  check4 = mod(iyear,4 )
631  check100 = mod(iyear,100)
632  check400 = mod(iyear,400)
633 
634  checkleap = .false.
635  if( check4 == 0 ) checkleap = .true.
636  if( check100 == 0 ) checkleap = .false.
637  if( check400 == 0 ) checkleap = .true.
638 
639  if( calendar_360days ) checkleap = .false.
640  if( calendar_365days ) checkleap = .false.
641 
642  end function checkleap
643 
644  !-----------------------------------------------------------------------------
646  subroutine calendar_ymdhms2nd( &
647  nd, &
648  ymdhms, &
649  oyear )
650  implicit none
651 
652  real(DP), intent(out) :: nd
653  integer, intent(in) :: ymdhms(6)
654  integer, intent(in) :: oyear
655 
656  integer :: absday, absday_jan1
657  !---------------------------------------------------------------------------
658 
659  call calendar_ymd2absday( absday, & ! [OUT]
660  ymdhms(i_year), & ! [IN]
661  ymdhms(i_month), & ! [IN]
662  ymdhms(i_day), & ! [IN]
663  oyear ) ! [IN]
664 
665  call calendar_ymd2absday( absday_jan1, & ! [OUT]
666  ymdhms(i_year), & ! [IN]
667  1, & ! [IN]
668  1, & ! [IN]
669  oyear ) ! [IN]
670 
671  nd = absday - absday_jan1 + 1.0_dp
672 
673  return
674  end subroutine calendar_ymdhms2nd
675 
676  !-----------------------------------------------------------------------------
678  subroutine calendar_ymdhms2mjd( &
679  mjd, &
680  ymdhms, &
681  oyear )
682  implicit none
683 
684  real(DP), intent(out) :: mjd
685  integer, intent(in) :: ymdhms(6)
686  integer, intent(in) :: oyear
687 
688  integer :: y, m, mjd_day
689  !---------------------------------------------------------------------------
690 
691  if ( ymdhms(i_month) == 1 &
692  .OR. ymdhms(i_month) == 2 ) then
693  y = ymdhms(i_year) - 1
694  m = ymdhms(i_month) + 2
695  else
696  y = ymdhms(i_year)
697  m = ymdhms(i_month)
698  endif
699 
700  mjd_day = int( 365.25_dp * y ) & ! year
701  + int( y/400.0_dp ) - int( y/100.0_dp ) & ! leap year
702  + int( 30.59_dp * m-2 ) & ! month
703  + ymdhms(i_day) & ! day
704  + 678912 ! constant
705 
706  mjd = real(mjd_day,kind=DP) & ! day
707  + ymdhms(i_hour) / 24.0_DP & ! hour
708  + ymdhms(i_min) / 1440.0_DP & ! min
709  + ymdhms(i_sec) / 86400.0_DP ! sec
710 
711  return
712  end subroutine calendar_ymdhms2mjd
713 
714  subroutine calendar_get_name(name)
715  character(len=*), intent(out) :: name
716 
717  if ( calendar_360days ) then
718  name = "360_day"
719  elseif( calendar_365days ) then
720  name = "365_day"
721  else
722  name = "gregorian"
723  endif
724 
725  return
726  end subroutine calendar_get_name
727 
728 end module scale_calendar
integer, parameter, public i_month
[index] month
subroutine, public calendar_unit2sec(second, value, unit)
Convert several units to second.
integer, parameter, public i_year
[index] year
real(dp) function, public calendar_combine_daysec(absday, abssec)
Combine day and second.
subroutine, public calendar_ymd2absday(absday, gyear, gmonth, gday, oyear)
Convert from gregorian date to absolute day, DAY 0 is AD1/1/1.
subroutine, public calendar_date2char(chardate, ymdhms, subsec)
Convert from gregorian date to absolute day/second.
integer, public io_fid_conf
Config file ID.
Definition: scale_io.F90:55
subroutine, public calendar_adjust_daysec(absday, abssec)
Adjust day and second.
subroutine, public calendar_setup
Setup.
subroutine, public calendar_get_name(name)
real(dp) function, public calendar_cfunits2sec(cftime, cfunits, offset_year, startdaysec)
Convert time in units of the CF convention to second.
integer, parameter, public i_min
[index] minute
module PROCESS
Definition: scale_prc.F90:11
subroutine, public calendar_sec2unit(value, second, unit)
Convert several second to specified unit.
integer, parameter, public i_sec
[index] second
subroutine, public prc_abort
Abort Process.
Definition: scale_prc.F90:338
integer, parameter, public i_hour
[index] hour
integer, parameter, public i_day
[index] day
subroutine, public calendar_daysec2date(ymdhms, subsec, absday, abssec, offset_year)
Convert from gregorian date to absolute day/second.
module PRECISION
module CALENDAR
subroutine, public calendar_getdayofyear(DayOfYear, iyear)
Get day of year.
subroutine, public calendar_hms2abssec(abssec, hour, minute, second, subsec)
Hour, minute, second, subsecond -> absolute second.
module STDIO
Definition: scale_io.F90:10
integer, parameter, public dp
subroutine, public calendar_date2daysec(absday, abssec, ymdhms, subsec, offset_year)
Convert from gregorian date to absolute day/second.