[Dart-dev] DART/branches Revision: 12989
dart at ucar.edu
dart at ucar.edu
Fri Feb 15 16:55:11 MST 2019
thoar at ucar.edu
2019-02-15 16:55:11 -0700 (Fri, 15 Feb 2019)
329
obs_diag has been tested with the noleap as well as gregorian calendar.
The time_manager_mod '[increment,decrement]_gregorian' routines have
been tested for bin intervals and bin widths defined by
years,months,days,hours,minutes,seconds ... this is an extension.
Previous versions only supported days,hours,minutes,seconds.
Modified: DART/branches/cesm_clm/assimilation_code/modules/utilities/time_manager_mod.f90
===================================================================
--- DART/branches/cesm_clm/assimilation_code/modules/utilities/time_manager_mod.f90 2019-02-14 18:03:58 UTC (rev 12988)
+++ DART/branches/cesm_clm/assimilation_code/modules/utilities/time_manager_mod.f90 2019-02-15 23:55:11 UTC (rev 12989)
@@ -83,6 +83,8 @@
public :: julian_day
+public :: get_calendar_units
+
! Subroutines and functions for basic I/O
public :: time_manager_init, print_time, print_date
public :: write_time, read_time, interactive_time
@@ -137,7 +139,7 @@
logical, save :: module_initialized = .false.
-character(len=129) :: errstring
+character(len=512) :: errstring, string1
!======================================================================
@@ -770,8 +772,53 @@
end subroutine set_calendar_type_string
+!> returns the calendar units as a string
+subroutine get_calendar_units(units_string)
+! If you 'call print_date(set_time(0,0))' with each calendar, you get:
+! thirty_day_months 1 Jan 01 00:00:00
+! julian 1 Jan 01 00:00:00
+! noleap 1 Jan 01 00:00:00
+! gregorian_mars 1 sol 001 00:00:00
+! solar_mars 1 sol 00001 00:00:00
+! gregorian 1601 Jan 01 00:00:00
+
+character(len=*), intent(out) :: units_string
+
+integer, parameter :: max_calendar_string_length = len_trim('THIRTY_DAY_MONTHS')
+character(len=*), parameter :: routine = 'get_calendar_units'
+character(len=max_calendar_string_length) :: cstring
+
+if ( .not. module_initialized ) call time_manager_init
+
+call get_calendar_string(cstring)
+
+select case (cstring)
+
+ case ( 'NO_CALENDAR', 'NO CALENDAR', 'NONE' )
+ units_string = 'none'
+ case ( 'THIRTY_DAY_MONTHS' )
+ units_string = 'days since 0001-1-1'
+ case ( 'JULIAN' )
+ units_string = 'days since 0001-1-1'
+ case ( 'NOLEAP' )
+ units_string = 'days since 0001-1-1'
+ case ( 'GREGORIAN_MARS' )
+ units_string = 'sols since 1-001 00:00:00'
+ case ( 'SOLAR_MARS' )
+ units_string = 'sols since 1-00001 00:00:00'
+ case ( 'GREGORIAN' )
+ units_string = 'days since 1601-01-01_00:00:00'
+ case default
+ write(errstring,*)'Unknown calendar "',trim(cstring),'"'
+ call error_handler(E_ERR,routine,errstring,source,revision,revdate)
+
+end select
+
+end subroutine get_calendar_units
+
+
function get_calendar_type()
!------------------------------------------------------------------------
!
@@ -1422,7 +1469,9 @@
write(errstring,'(''year,mon,day,hour,min,sec'',6(1x,i4),'' not a valid date.'')') &
year,month,day,ohours,ominutes,oseconds
- call error_handler(E_ERR,'set_date_no_leap',errstring,source,revision,revdate)
+ write(string1,*)'first legal date is 1-1-1_00:00:00'
+ call error_handler(E_ERR,'set_date_no_leap',errstring, &
+ source, revision, revdate, text2=string1)
endif
ndays = 0
@@ -1620,11 +1669,10 @@
integer :: oseconds, ominutes, ohours, odays, omonths, oyears
integer :: csecond, cminute, chour, cday, cmonth, cyear
+integer :: imonth
if ( .not. module_initialized ) call time_manager_init
-call error_handler(E_ERR,'increment_gregorian','not implemented',source,revision,revdate)
-
! Missing optionals are set to 0
oseconds = 0; if(present(seconds)) oseconds = seconds
@@ -1634,7 +1682,7 @@
More information about the Dart-dev
mailing list