SCALE-RM
Functions/Subroutines | Variables
scale_calendar Module Reference

module CALENDAR More...

Functions/Subroutines

subroutine, public calendar_setup
 Setup. More...
 
subroutine, public calendar_getdayofyear (DayOfYear, iyear)
 Get day of year. More...
 
subroutine, public calendar_date2daysec (absday, abssec, ymdhms, subsec, offset_year)
 Convert from gregorian date to absolute day/second. More...
 
subroutine, public calendar_daysec2date (ymdhms, subsec, absday, abssec, offset_year)
 Convert from gregorian date to absolute day/second. More...
 
subroutine, public calendar_ymd2absday (absday, gyear, gmonth, gday, oyear)
 Convert from gregorian date to absolute day, DAY 0 is AD1/1/1. More...
 
subroutine, public calendar_hms2abssec (abssec, hour, minute, second, subsec)
 Hour, minute, second, subsecond -> absolute second. More...
 
subroutine, public calendar_adjust_daysec (absday, abssec)
 Adjust day and second. More...
 
real(dp) function, public calendar_combine_daysec (absday, abssec)
 Combine day and second. More...
 
subroutine, public calendar_unit2sec (second, value, unit)
 Convert several units to second. More...
 
subroutine, public calendar_sec2unit (value, second, unit)
 Convert several second to specified unit. More...
 
real(dp) function, public calendar_cfunits2sec (cftime, cfunits, offset_year, startdaysec)
 Convert time in units of the CF convention to second. More...
 
subroutine, public calendar_date2char (chardate, ymdhms, subsec)
 Convert from gregorian date to absolute day/second. More...
 
subroutine, public calendar_get_name (name)
 

Variables

integer, parameter, public i_year = 1
 [index] year More...
 
integer, parameter, public i_month = 2
 [index] month More...
 
integer, parameter, public i_day = 3
 [index] day More...
 
integer, parameter, public i_hour = 4
 [index] hour More...
 
integer, parameter, public i_min = 5
 [index] minute More...
 
integer, parameter, public i_sec = 6
 [index] second More...
 
real(dp), public calendar_doi = 365.0_DP
 days of year More...
 
real(dp), public calendar_hour = 24.0_DP
 hours of day More...
 
real(dp), public calendar_min = 60.0_DP
 minutes of hour More...
 
real(dp), public calendar_sec = 60.0_DP
 seconds of minute More...
 

Detailed Description

module CALENDAR

Description
gregorian calendar module this module is available in gregorian calendar date
Author
Team SCALE
NAMELIST
  • PARAM_CALENDAR
    nametypedefault valuecomment
    CALENDAR_360DAYS logical .false.
    CALENDAR_365DAYS logical .false.
    CALENDAR_HOUR real(DP) 24.0_DP hours of day
    CALENDAR_MIN real(DP) 60.0_DP minutes of hour
    CALENDAR_SEC real(DP) 60.0_DP seconds of minute
    CALENDAR_USER_DEFINED integer, dimension(12)
    DEBUG logical .false.

History Output
No history output

Function/Subroutine Documentation

◆ calendar_setup()

subroutine, public scale_calendar::calendar_setup

Setup.

Definition at line 95 of file scale_calendar.F90.

95  use scale_prc, only: &
96  prc_abort
97  implicit none
98 
99  namelist / param_calendar / &
100  calendar_360days, &
101  calendar_365days, &
102  calendar_hour, &
103  calendar_min, &
104  calendar_sec, &
105  calendar_user_defined, &
106  debug
107 
108  integer :: ierr, i
109  !---------------------------------------------------------------------------
110 
111  log_newline
112  log_info("CALENDAR_setup",*) 'Setup'
113 
114  calendar_user_defined(:) = 0
115 
116  !--- read namelist
117  rewind(io_fid_conf)
118  read(io_fid_conf,nml=param_calendar,iostat=ierr)
119  if( ierr < 0 ) then !--- missing
120  log_info("CALENDAR_setup",*) 'Not found namelist. Default used.'
121  elseif( ierr > 0 ) then !--- fatal error
122  log_error("CALENDAR_setup",*) 'Not appropriate names in namelist PARAM_CALENDAR. Check!'
123  call prc_abort
124  endif
125  log_nml(param_calendar)
126 
127  log_newline
128  log_info("CALENDAR_setup",*) 'Calendar settings'
129  if ( maxval(calendar_user_defined) > 0 ) then
130  dayofmonth(:,i_user) = calendar_user_defined(:)
131  calendar_doi = sum(calendar_user_defined)
132  calendar_user = .true.
133  log_info_cont(*) 'DayOfYear = ', int(calendar_doi), ' : user defined calendar'
134  do i = 1, 12
135  if ( calendar_user_defined(i) > 0 ) then
136  log_info_cont(*) 'month #', i, ': ', calendar_user_defined(i), "days"
137  else
138  calendar_month = i - 1
139  exit
140  endif
141  enddo
142  elseif( calendar_360days ) then
143  calendar_doi = 360.0_dp
144  log_info_cont(*) 'DayOfYear = 360 : ideal setting'
145  elseif( calendar_365days ) then
146  calendar_doi = 365.0_dp
147  log_info_cont(*) 'DayOfYear = 365 : ideal setting'
148  else
149  log_info_cont(*) 'DayOfYear = 365 or 366 : Gregorian calendar'
150  endif
151 
152  if (int(calendar_sec) /= calendar_sec .or. int(calendar_sec) == 0 ) then
153  log_error("CALENDAR_setup",*) 'CALENDAR_SEC must be a natural number!'
154  call abort
155  elseif (int(calendar_min) /= calendar_min .or. int(calendar_min) == 0 ) then
156  log_error("CALENDAR_setup",*) 'CALENDAR_MIN must be a natural number!'
157  call abort
158  elseif (int(calendar_hour) /= calendar_hour .or. int(calendar_hour) == 0 ) then
159  log_error("CALENDAR_setup",*) 'CALENDAR_HOUR must be a natural number!'
160  call abort
161  endif
162 
163 
164  return

References calendar_doi, calendar_hour, calendar_min, calendar_sec, scale_io::io_fid_conf, and scale_prc::prc_abort().

Referenced by mod_rm_driver::rm_driver(), and mod_rm_prep::rm_prep().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ calendar_getdayofyear()

subroutine, public scale_calendar::calendar_getdayofyear ( real(dp), intent(out)  DayOfYear,
integer, intent(in)  iyear 
)

Get day of year.

Definition at line 172 of file scale_calendar.F90.

172  implicit none
173 
174  real(DP), intent(out) :: DayOfYear ! # of day of year
175  integer, intent(in) :: iyear ! current year
176  !---------------------------------------------------------------------------
177 
178  dayofyear = calendar_doi
179  if( checkleap(iyear) ) dayofyear = calendar_doi + 1.0_dp
180 
181  return

References calendar_doi.

◆ calendar_date2daysec()

subroutine, public scale_calendar::calendar_date2daysec ( integer, intent(out)  absday,
real(dp), intent(out)  abssec,
integer, dimension(6), intent(in)  ymdhms,
real(dp), intent(in)  subsec,
integer, intent(in)  offset_year 
)

Convert from gregorian date to absolute day/second.

Parameters
[out]absdayabsolute day
[out]abssecabsolute second
[in]ymdhmsdate
[in]subsecsubsecond
[in]offset_yearoffset year

Definition at line 192 of file scale_calendar.F90.

192  implicit none
193 
194  integer, intent(out) :: absday
195  real(DP), intent(out) :: abssec
196  integer, intent(in) :: ymdhms(6)
197  real(DP), intent(in) :: subsec
198  integer, intent(in) :: offset_year
199  integer :: ileap
200  logical :: date_error = .false.
201  !---------------------------------------------------------------------------
202 
203  ! check date
204  if ( ymdhms(i_month) < 1 .or. calendar_month < ymdhms(i_month) ) then
205  log_error("CALENDAR_date2daysec",*) 'Inputted month does not match to the calendar.'
206  date_error = .true.
207  endif
208 
209  ileap = i_nonleapyear
210  if( checkleap(ymdhms(i_year)+offset_year) ) ileap = i_leapyear
211  if( calendar_360days ) ileap = i_360days
212  if( calendar_user ) ileap = i_user
213 
214  if ( ymdhms(i_day ) < 1 .or. dayofmonth(ymdhms(i_month),ileap) < ymdhms(i_day) ) then
215  log_error("CALENDAR_date2daysec",*) 'Inputted day does not match to the calendar.'
216  date_error = .true.
217  endif
218  if ( ymdhms(i_hour) < 0 .or. (int(calendar_hour)-1) < ymdhms(i_hour) ) then
219  log_error("CALENDAR_date2daysec",*) 'Inputted hour does not match to the calendar.'
220  date_error = .true.
221  endif
222  if ( ymdhms(i_min ) < 0 .or. (int(calendar_min )-1) < ymdhms(i_min ) ) then
223  log_error("CALENDAR_date2daysec",*) 'Inputted minute does not match to the calendar.'
224  date_error = .true.
225  endif
226  if ( ymdhms(i_sec ) < 0 .or. (int(calendar_sec )-1) < ymdhms(i_sec ) ) then
227  log_error("CALENDAR_date2daysec",*) 'Inputted second does not match to the calendar.'
228  date_error = .true.
229  endif
230  if( date_error ) call abort
231 
232  call calendar_ymd2absday( absday, & ! [OUT]
233  ymdhms(i_year), & ! [IN]
234  ymdhms(i_month), & ! [IN]
235  ymdhms(i_day), & ! [IN]
236  offset_year ) ! [IN]
237 
238  call calendar_hms2abssec( abssec, & ! [OUT]
239  ymdhms(i_hour), & ! [IN]
240  ymdhms(i_min), & ! [IN]
241  ymdhms(i_sec), & ! [IN]
242  subsec ) ! [IN]
243 
244  return

References calendar_hms2abssec(), calendar_hour, calendar_min, calendar_sec, calendar_ymd2absday(), i_day, i_hour, i_min, i_month, i_sec, and i_year.

Referenced by mod_admin_time::admin_time_setup(), scale_atmos_phy_rd_profile::atmos_phy_rd_profile_finalize(), scale_atmos_phy_rd_profile::atmos_phy_rd_profile_read(), scale_atmos_solarins::atmos_solarins_setup(), calendar_cfunits2sec(), scale_file_external_input::file_external_input_query(), scale_file_external_input::file_external_input_regist_file(), and scale_letkf::letkf_add_inflation_setup().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ calendar_daysec2date()

subroutine, public scale_calendar::calendar_daysec2date ( integer, dimension(6), intent(out)  ymdhms,
real(dp), intent(out)  subsec,
integer, intent(in)  absday,
real(dp), intent(in)  abssec,
integer, intent(in)  offset_year 
)

Convert from gregorian date to absolute day/second.

Parameters
[out]ymdhmsdate
[out]subsecsubsecond
[in]absdayabsolute day
[in]abssecabsolute second
[in]offset_yearoffset year

Definition at line 255 of file scale_calendar.F90.

255  implicit none
256 
257  integer, intent(out) :: ymdhms(6)
258  real(DP), intent(out) :: subsec
259  integer, intent(in) :: absday
260  real(DP), intent(in) :: abssec
261  integer, intent(in) :: offset_year
262  !---------------------------------------------------------------------------
263 
264  call calendar_absday2ymd( ymdhms(i_year), & ! [OUT]
265  ymdhms(i_month), & ! [OUT]
266  ymdhms(i_day), & ! [OUT]
267  absday, & ! [IN]
268  offset_year ) ! [IN]
269 
270  call calendar_abssec2hms( ymdhms(i_hour), & ! [OUT]
271  ymdhms(i_min), & ! [OUT]
272  ymdhms(i_sec), & ! [OUT]
273  subsec, & ! [OUT]
274  abssec ) ! [IN]
275 
276  return

References i_day, i_hour, i_min, i_month, i_sec, and i_year.

Referenced by mod_admin_time::admin_time_advance(), mod_admin_time::admin_time_setup(), scale_atmos_solarins::atmos_solarins_setup(), scale_file_external_input::file_external_input_query(), scale_file_external_input::file_external_input_regist_file(), and scale_letkf::letkf_add_inflation_setup().

Here is the caller graph for this function:

◆ calendar_ymd2absday()

subroutine, public scale_calendar::calendar_ymd2absday ( integer, intent(out)  absday,
integer, intent(in)  gyear,
integer, intent(in)  gmonth,
integer, intent(in)  gday,
integer, intent(in)  oyear 
)

Convert from gregorian date to absolute day, DAY 0 is AD1/1/1.

Parameters
[out]absdayabsolute day
[in]gyearyear
[in]gmonthmonth
[in]gdayday
[in]oyearoffset year

Definition at line 287 of file scale_calendar.F90.

287  implicit none
288 
289  integer, intent(out) :: absday
290  integer, intent(in) :: gyear
291  integer, intent(in) :: gmonth
292  integer, intent(in) :: gday
293  integer, intent(in) :: oyear
294 
295  integer :: gyear_mod, gmonth_mod
296  integer :: yearday, monthday
297  integer :: m, ileap
298  !---------------------------------------------------------------------------
299 
300  gmonth_mod = mod( gmonth-1, calendar_month ) + 1
301  gyear_mod = gyear + ( gmonth-gmonth_mod ) / calendar_month
302 
303  if ( calendar_360days .OR. calendar_365days .or. calendar_user) then
304  yearday = int( calendar_doi * ( gyear_mod - oyear ) )
305  else
306  yearday = int( calendar_doi * ( gyear_mod - oyear ) ) &
307  + int( real(gyear_mod-1,kind=dp) / 4.0_dp ) &
308  - int( real(gyear_mod-1,kind=dp) / 100.0_dp ) &
309  + int( real(gyear_mod-1,kind=dp) / 400.0_dp ) &
310  - int( real(oyear -1,kind=dp) / 4.0_dp ) &
311  + int( real(oyear -1,kind=dp) / 100.0_dp ) &
312  - int( real(oyear -1,kind=dp) / 400.0_dp )
313  endif
314 
315  ileap = i_nonleapyear
316  if( checkleap(gyear_mod) ) ileap = i_leapyear
317  if( calendar_360days ) ileap = i_360days
318  if( calendar_user ) ileap = i_user
319 
320  monthday = 0
321  do m = 1, gmonth_mod-1
322  monthday = monthday + dayofmonth(m,ileap)
323  enddo
324 
325  absday = yearday + monthday + gday - 1
326 
327  return

References calendar_doi, and scale_precision::dp.

Referenced by scale_atmos_solarins::atmos_solarins_ecliptic_longitude(), calendar_date2char(), and calendar_date2daysec().

Here is the caller graph for this function:

◆ calendar_hms2abssec()

subroutine, public scale_calendar::calendar_hms2abssec ( real(dp), intent(out)  abssec,
integer, intent(in)  hour,
integer, intent(in)  minute,
integer, intent(in)  second,
real(dp), intent(in)  subsec 
)

Hour, minute, second, subsecond -> absolute second.

Parameters
[out]abssecabsolute second
[in]subsecsubsecond

Definition at line 384 of file scale_calendar.F90.

384  implicit none
385 
386  real(DP), intent(out) :: abssec
387  integer, intent(in) :: hour
388  integer, intent(in) :: minute
389  integer, intent(in) :: second
390  real(DP), intent(in) :: subsec
391  !---------------------------------------------------------------------------
392 
393  abssec = real(hour, kind=dp) * calendar_min * calendar_sec &
394  + real(minute,kind=dp) * calendar_sec &
395  + real(second,kind=dp) &
396  + subsec
397 
398  return

References calendar_hour, calendar_min, calendar_sec, and scale_precision::dp.

Referenced by scale_atmos_solarins::atmos_solarins_ecliptic_longitude(), and calendar_date2daysec().

Here is the caller graph for this function:

◆ calendar_adjust_daysec()

subroutine, public scale_calendar::calendar_adjust_daysec ( integer, intent(inout)  absday,
real(dp), intent(inout)  abssec 
)

Adjust day and second.

Parameters
[in,out]absdayabsolute day
[in,out]abssecabsolute second

Definition at line 442 of file scale_calendar.F90.

442  implicit none
443 
444  integer, intent(inout) :: absday
445  real(DP), intent(inout) :: abssec
446 
447  integer :: addday
448  !---------------------------------------------------------------------------
449 
450  addday = int( abssec / ( calendar_hour * calendar_min * calendar_sec ) )
451 
452  absday = absday + addday
453 
454  abssec = abssec - real(addday,kind=dp) * calendar_hour * calendar_min * calendar_sec
455 
456  if ( abssec < 0.0_dp ) then
457  absday = absday - 1
458  abssec = abssec + calendar_hour * calendar_min * calendar_sec
459  endif
460 
461  return

References calendar_hour, calendar_min, calendar_sec, and scale_precision::dp.

Referenced by mod_admin_time::admin_time_advance(), mod_admin_time::admin_time_setup(), scale_file_external_input::file_external_input_query(), scale_file_external_input::file_external_input_regist_file(), and scale_letkf::letkf_add_inflation_setup().

Here is the caller graph for this function:

◆ calendar_combine_daysec()

real(dp) function, public scale_calendar::calendar_combine_daysec ( integer, intent(in)  absday,
real(dp), intent(in)  abssec 
)

Combine day and second.

Parameters
[in]absdayabsolute day
[in]abssecabsolute second
Returns
absolute day.second

Definition at line 467 of file scale_calendar.F90.

467  implicit none
468 
469  integer, intent(in) :: absday
470  real(DP), intent(in) :: abssec
471  real(DP) :: daysec
472  !---------------------------------------------------------------------------
473 
474  daysec = real(absday,kind=dp) * calendar_sec * calendar_min * calendar_hour &
475  + abssec
476 
477  return

References calendar_hour, calendar_min, calendar_sec, and scale_precision::dp.

Referenced by mod_admin_time::admin_time_advance(), mod_admin_time::admin_time_setup(), calendar_cfunits2sec(), scale_file_external_input::file_external_input_query(), and scale_file_external_input::file_external_input_regist_file().

Here is the caller graph for this function:

◆ calendar_unit2sec()

subroutine, public scale_calendar::calendar_unit2sec ( real(dp), intent(out)  second,
real(dp), intent(in)  value,
character(len=*), intent(in)  unit 
)

Convert several units to second.

Parameters
[in]unitvariable unit

Definition at line 486 of file scale_calendar.F90.

486  use scale_prc, only: &
487  prc_abort
488  implicit none
489 
490  real(DP), intent(out) :: second
491  real(DP), intent(in) :: value
492  character(len=*), intent(in) :: unit
493  !---------------------------------------------------------------------------
494 
495  select case(unit)
496  case('MSEC')
497  second = value * 1.e-3_dp
498  case('SEC', 'seconds')
499  second = value
500  case('MIN')
501  second = value * calendar_sec
502  case('HOUR')
503  second = value * calendar_sec * calendar_min
504  case('DAY')
505  second = value * calendar_sec * calendar_min * calendar_hour
506  case default
507  log_error("CALENDAR_unit2sec",*) 'Unsupported UNIT: ', trim(unit), ', ', value
508  call prc_abort
509  endselect
510 
511  return

References calendar_hour, calendar_min, calendar_sec, and scale_prc::prc_abort().

Referenced by mod_admin_time::admin_time_setup(), calendar_cfunits2sec(), scale_file_history::file_history_setup(), scale_land_dyn_bucket::land_dyn_bucket_setup(), scale_ocean_dyn_slab::ocean_dyn_slab_setup(), and scale_ocean_phy_ice_simple::ocean_phy_ice_setup().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ calendar_sec2unit()

subroutine, public scale_calendar::calendar_sec2unit ( real(dp), intent(out)  value,
real(dp), intent(in)  second,
character(len=*), intent(in)  unit 
)

Convert several second to specified unit.

Definition at line 520 of file scale_calendar.F90.

520  use scale_prc, only: &
521  prc_abort
522  implicit none
523 
524  real(DP), intent(out) :: value
525  real(DP), intent( in) :: second
526  character(len=*), intent( in) :: unit
527  !---------------------------------------------------------------------------
528 
529  select case(trim(unit))
530  case('MSEC', 'msec')
531  value = second / 1.0e-3_dp
532  case('SEC', 'seconds', 'sec', 's')
533  value = second
534  case('MIN', 'mins', 'min')
535  value = second / calendar_sec
536  case('HOUR', 'hours', 'hour', 'h')
537  value = second / (calendar_sec * calendar_min)
538  case('DAY', 'days', 'day')
539  value = second / (calendar_sec * calendar_min * calendar_hour)
540  case default
541  log_error("CALENDAR_sec2unit",*) 'Unsupported UNIT: ', trim(unit), ', ', value
542  call prc_abort
543  endselect
544 

References calendar_hour, calendar_min, calendar_sec, and scale_prc::prc_abort().

Referenced by scale_file_history::file_history_set_attribute_double().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ calendar_cfunits2sec()

real(dp) function, public scale_calendar::calendar_cfunits2sec ( real(dp), intent(in)  cftime,
character(len=*), intent(in)  cfunits,
integer, intent(in)  offset_year,
real(dp), intent(in), optional  startdaysec 
)

Convert time in units of the CF convention to second.

Definition at line 550 of file scale_calendar.F90.

550  use scale_prc, only: &
551  prc_abort
552  implicit none
553 
554  real(DP), intent(in) :: cftime
555  character(len=*), intent(in) :: cfunits
556  integer, intent(in) :: offset_year
557  real(DP), intent(in), optional :: startdaysec
558  real(DP) :: sec
559 
560  character(len=H_MID) :: tunit
561  character(len=H_MID) :: buf
562 
563  integer :: date(6)
564  integer :: day
565  real(DP) :: sec0
566 
567  integer :: l
568 
569  intrinsic index
570  !---------------------------------------------------------------------------
571 
572  l = index( cfunits, " since " )
573  if ( l > 1 ) then ! untis is under the CF convension
574  tunit = cfunits(1:l-1)
575  buf = cfunits(l+7:)
576 
577  l = index(buf,"-")
578  if ( l /= 5 ) then
579  log_error("CALENDAR_CFunits2sec",*) 'units for time is invalid (year)'
580  log_error_cont(*) trim(cfunits)
581  log_error_cont(*) trim(buf)
582  call prc_abort
583  end if
584  read(buf(1:4),*) date(1) ! year
585  buf = buf(6:)
586 
587  l = index(buf,"-")
588  if ( l /= 3 ) then
589  log_error("CALENDAR_CFunits2sec",*) 'units for time is invalid (month)'
590  log_error_cont(*) trim(cfunits)
591  log_error_cont(*) trim(buf)
592  call prc_abort
593  end if
594  read(buf(1:2),*) date(2) ! month
595  buf = buf(4:)
596 
597  l = index(buf," ")
598  if ( l /= 3 ) then
599  log_error("CALENDAR_CFunits2sec",*) 'units for time is invalid (day)'
600  log_error_cont(*) trim(cfunits)
601  log_error_cont(*) trim(buf)
602  call prc_abort
603  end if
604  read(buf(1:2),*) date(3) ! day
605  buf = buf(4:)
606 
607  l = index(buf,":")
608  if ( l /= 3 ) then
609  log_error("CALENDAR_CFunits2sec",*) 'units for time is invalid (hour)'
610  log_error_cont(*) trim(cfunits)
611  log_error_cont(*) trim(buf)
612  call prc_abort
613  end if
614  read(buf(1:2),*) date(4) ! hour
615  buf = buf(4:)
616 
617  l = index(buf,":")
618  if ( l /= 3 ) then
619  log_error("CALENDAR_CFunits2sec",*) 'units for time is invalid (min)'
620  log_error_cont(*) trim(cfunits)
621  log_error_cont(*) trim(buf)
622  call prc_abort
623  end if
624  read(buf(1:2),*) date(5) ! min
625  buf = buf(4:)
626 
627  if ( len_trim(buf) /= 2 ) then
628  log_error("CALENDAR_CFunits2sec",*) 'units for time is invalid (sec)'
629  log_error_cont(*) trim(cfunits)
630  log_error_cont(*) trim(buf)
631  log_error_cont(*) len_trim(buf)
632  call prc_abort
633  end if
634  read(buf(1:2),*) date(6) ! sec
635 
636  call calendar_date2daysec( day, & ! (out)
637  sec0, & ! (out)
638  date(:), & ! (in)
639  0.0_dp, & ! (in)
640  offset_year ) ! (in)
641 
642  sec0 = calendar_combine_daysec( day, sec0 )
643  else
644  tunit = cfunits
645  if ( present(startdaysec) ) then
646  sec0 = startdaysec
647  else
648  sec0 = 0.0_dp
649  end if
650  end if
651 
652  call calendar_unit2sec( sec, cftime, tunit )
653 
654  sec = sec0 + sec
655 
656  return

References calendar_combine_daysec(), calendar_date2daysec(), calendar_unit2sec(), and scale_prc::prc_abort().

Referenced by mod_admin_time::admin_time_setup(), scale_file_external_input::file_external_input_query(), and scale_file_external_input::file_external_input_regist_file().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ calendar_date2char()

subroutine, public scale_calendar::calendar_date2char ( character(len=27), intent(out)  chardate,
integer, dimension(6), intent(in)  ymdhms,
real(dp), intent(in)  subsec 
)

Convert from gregorian date to absolute day/second.

Parameters
[out]chardateformatted date character
[in]ymdhmsdate
[in]subsecsubsecond

Definition at line 665 of file scale_calendar.F90.

665  implicit none
666 
667  character(len=27), intent(out) :: chardate
668  integer, intent(in) :: ymdhms(6)
669  real(DP), intent(in) :: subsec
670 
671  character(len=4) :: seclen
672  character(len=4) :: minlen
673  character(len=4) :: hourlen
674  character(len=4) :: daylen
675  character(len=4) :: monthlen
676 
677 
678  !---------------------------------------------------------------------------
679  if ( calendar_user) then
680  write(daylen, '(A1,I1.1,A1,I1.1)') 'I', int(log10(real(maxval(calendar_user_defined))))+1, &
681  '.', int(log10(real(maxval(calendar_user_defined))))+1
682  if( calendar_month < 10 ) then
683  write(monthlen, '(A4)') 'I1.1'
684  else
685  write(monthlen, '(A4)') 'I2.2'
686  endif
687  else
688  write(daylen, '(A4)') 'I2.2'
689  write(monthlen, '(A4)') 'I2.2'
690  endif
691 
692  write(seclen, '(A1,I1.1,A1,I1.1)') 'I', int(log10(max(calendar_sec -1.0_dp, 1.0_dp)))+1, &
693  '.', int(log10(max(calendar_sec -1.0_dp, 1.0_dp)))+1
694  write(minlen, '(A1,I1.1,A1,I1.1)') 'I', int(log10(max(calendar_min -1.0_dp, 1.0_dp)))+1, &
695  '.', int(log10(max(calendar_min -1.0_dp, 1.0_dp)))+1
696  write(hourlen,'(A1,I1.1,A1,I1.1)') 'I', int(log10(max(calendar_hour-1.0_dp, 1.0_dp)))+1, &
697  '.', int(log10(max(calendar_hour-1.0_dp, 1.0_dp)))+1
698 
699 ! write(chardate,'(I4.4,A1,I2.2,A1,I2.2,A1,I2.2,A1,I2.2,A1,I2.2,A2,F6.3)') &
700  write(chardate,'(I4.4,A1,'//monthlen//',A1,'//daylen//',A1,'//hourlen//',A1,'//minlen//',A1,'//seclen//',A2,F6.3)') &
701  ymdhms(1),'/',ymdhms(2),'/',ymdhms(3),' ', &
702  ymdhms(4),':',ymdhms(5),':',ymdhms(6),' +', &
703  subsec
704 
705  return

References calendar_hour, calendar_min, calendar_sec, calendar_ymd2absday(), scale_precision::dp, i_day, i_hour, i_min, i_month, i_sec, and i_year.

Referenced by mod_admin_time::admin_time_checkstate(), mod_admin_time::admin_time_setup(), and scale_atmos_solarins::atmos_solarins_setup().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ calendar_get_name()

subroutine, public scale_calendar::calendar_get_name ( character(len=*), intent(out)  name)

Definition at line 806 of file scale_calendar.F90.

806  character(len=*), intent(out) :: name
807 
808  if ( calendar_360days ) then
809  name = "360_day"
810  elseif( calendar_365days ) then
811  name = "365_day"
812  elseif( calendar_user ) then
813  name = "USER_DEFINED"
814  else
815  name = "gregorian"
816  endif
817 
818  return

Referenced by scale_file_cartesc::file_cartesc_create(), scale_file_history_cartesc::file_history_cartesc_setup(), and scale_file_history_cartesc::file_history_cartesc_truncate_3d().

Here is the caller graph for this function:

Variable Documentation

◆ i_year

integer, parameter, public scale_calendar::i_year = 1

◆ i_month

integer, parameter, public scale_calendar::i_month = 2

◆ i_day

integer, parameter, public scale_calendar::i_day = 3

◆ i_hour

integer, parameter, public scale_calendar::i_hour = 4

[index] hour

Definition at line 48 of file scale_calendar.F90.

48  integer, public, parameter :: I_hour = 4

Referenced by scale_atmos_solarins::atmos_solarins_ecliptic_longitude(), calendar_date2char(), calendar_date2daysec(), and calendar_daysec2date().

◆ i_min

integer, parameter, public scale_calendar::i_min = 5

[index] minute

Definition at line 49 of file scale_calendar.F90.

49  integer, public, parameter :: I_min = 5

Referenced by scale_atmos_solarins::atmos_solarins_ecliptic_longitude(), calendar_date2char(), calendar_date2daysec(), and calendar_daysec2date().

◆ i_sec

integer, parameter, public scale_calendar::i_sec = 6

[index] second

Definition at line 50 of file scale_calendar.F90.

50  integer, public, parameter :: I_sec = 6

Referenced by scale_atmos_solarins::atmos_solarins_ecliptic_longitude(), calendar_date2char(), calendar_date2daysec(), and calendar_daysec2date().

◆ calendar_doi

real(dp), public scale_calendar::calendar_doi = 365.0_DP

days of year

Definition at line 52 of file scale_calendar.F90.

52  real(DP), public :: CALENDAR_DOI = 365.0_dp

Referenced by scale_atmos_solarins::atmos_solarins_setup(), calendar_getdayofyear(), calendar_setup(), and calendar_ymd2absday().

◆ calendar_hour

real(dp), public scale_calendar::calendar_hour = 24.0_DP

◆ calendar_min

real(dp), public scale_calendar::calendar_min = 60.0_DP

◆ calendar_sec

real(dp), public scale_calendar::calendar_sec = 60.0_DP
scale_prc::prc_abort
subroutine, public prc_abort
Abort Process.
Definition: scale_prc.F90:350
scale_calendar::i_min
integer, parameter, public i_min
[index] minute
Definition: scale_calendar.F90:49
scale_calendar::calendar_hms2abssec
subroutine, public calendar_hms2abssec(abssec, hour, minute, second, subsec)
Hour, minute, second, subsecond -> absolute second.
Definition: scale_calendar.F90:384
scale_prc
module PROCESS
Definition: scale_prc.F90:11
scale_calendar::calendar_ymd2absday
subroutine, public calendar_ymd2absday(absday, gyear, gmonth, gday, oyear)
Convert from gregorian date to absolute day, DAY 0 is AD1/1/1.
Definition: scale_calendar.F90:287
scale_calendar::i_hour
integer, parameter, public i_hour
[index] hour
Definition: scale_calendar.F90:48
scale_calendar::i_month
integer, parameter, public i_month
[index] month
Definition: scale_calendar.F90:46
scale_calendar::i_year
integer, parameter, public i_year
[index] year
Definition: scale_calendar.F90:45
scale_calendar::i_day
integer, parameter, public i_day
[index] day
Definition: scale_calendar.F90:47
scale_calendar::i_sec
integer, parameter, public i_sec
[index] second
Definition: scale_calendar.F90:50