[Dart-dev] DART/branches Revision: 12990

dart at ucar.edu dart at ucar.edu
Wed Feb 27 14:31:39 MST 2019


thoar at ucar.edu
2019-02-27 14:31:38 -0700 (Wed, 27 Feb 2019)
749
Can increment/decrement dates by months ... 
dates near the end of the months are problematic.
Adding a month to the last day of a month will result in the last day of the next month.
Subtracting a month from the last day of a month will result in the last day of the previous month.

This logic renders some dates unreachable or overloaded. For a more thorough set of examples, turn on 'verbose', set the bin_separation months to be /= 0 and a table
will be generated in the output (date_increment_test() will be run).

Jun 30 + 1 month results in July 31, not July 30
Mar 31 - 1 month      results in Feb 29 or 28
Mar 30 - 1 month also results in Feb 28 or 29
Mar 29 - 1 month also results in Feb 28 or 29
Mar 28 - 1 month also results in Feb 28




Modified: DART/branches/cesm_clm/assimilation_code/programs/obs_diag/threed_sphere/obs_diag.f90
===================================================================
--- DART/branches/cesm_clm/assimilation_code/programs/obs_diag/threed_sphere/obs_diag.f90	2019-02-15 23:55:11 UTC (rev 12989)
+++ DART/branches/cesm_clm/assimilation_code/programs/obs_diag/threed_sphere/obs_diag.f90	2019-02-27 21:31:38 UTC (rev 12990)
@@ -41,8 +41,8 @@
                              is_vertical, VERTISUNDEF, VERTISSURFACE,  &
                              VERTISLEVEL, VERTISPRESSURE, VERTISHEIGHT,   &
                              VERTISSCALEHEIGHT
-use time_manager_mod, only : time_type, set_calendar_type, get_calendar_units, &
-                             increment_date, decrement_date, &
+use time_manager_mod, only : time_type, get_calendar_udunits, leap_year, &
+                             set_calendar_type, get_calendar_string, &
                              set_date, get_date, print_date, &
                              set_time, get_time, print_time, &
                              operator(*),  operator(+),  operator(-), &
@@ -332,7 +332,7 @@
 type(time_type) :: binsep, binwidth, halfbinwidth
 type(time_type) :: seqT1, seqTN        ! first,last time in entire observation sequence
 type(time_type) :: AllseqT1, AllseqTN  ! first,last time in ALL observation sequences
-type(time_type) :: obs_time, skip_time
+type(time_type) :: obs_time, averaging_start_time
 
 character(len=512) :: string1, string2, string3
 character(len=stringlength) :: obsname
@@ -375,7 +375,6 @@
 
 num_input_files = set_filename_list(obs_sequence_name, obs_sequence_list, 'obs_diag')
 
-
 ! Check to see if we are including the outlier observations in the
 ! rank histogram calculation.
 
@@ -388,6 +387,7 @@
 ! Now that we have input, do some checking and setup
 
 call set_calendar_type(calendar)
+if (verbose) call date_increment_test()
 call Namelist2Times()    ! convert namelist times to DART times
 call DefineTimeBins()    ! Set the temporal binning variables
 call SetPressureLevels(plevel, plevel_edges, Nplevels)
@@ -884,7 +884,7 @@
             ! end of time series statistics
             !===========================================================
 
-            if ( obs_time < skip_time ) cycle Areas
+            if ( obs_time < averaging_start_time ) cycle Areas
 
             !===========================================================
             ! vertical statistics part ... after skipping the burn-in
@@ -1405,14 +1405,15 @@
 !======================================================================
 
 
+!> ----------------------------------------------------------------------
+!> Define/Append the 'horizontal wind' obs_kinds to supplant the list declared
+!> in obs_kind_mod.f90 i.e. if there is a RADIOSONDE_U_WIND_COMPONENT
+!> and a RADIOSONDE_V_WIND_COMPONENT, there must be a RADIOSONDE_HORIZONTAL_WIND
+!> Replace calls to 'get_name_for_type_of_obs' with variable 'obs_type_strings'
+
 function grok_observation_names(my_names)
-!----------------------------------------------------------------------
-! Define/Append the 'horizontal wind' obs_kinds to supplant the list declared
-! in obs_kind_mod.f90 i.e. if there is a RADIOSONDE_U_WIND_COMPONENT
-! and a RADIOSONDE_V_WIND_COMPONENT, there must be a RADIOSONDE_HORIZONTAL_WIND
-! Replace calls to 'get_name_for_type_of_obs' with variable 'obs_type_strings'
-!----------------------------------------------------------------------
 
+
 character(len=stringlength), pointer :: my_names(:) ! INTENT OUT, btw
 integer :: grok_observation_names
 
@@ -1525,12 +1526,13 @@
 ! Global-scope variables set in this routine:
 ! type(time_type), intent(out) :: beg_time     ! first_bin_center
 ! type(time_type), intent(out) :: end_time     ! last_bin_center
-! type(time_type), intent(out) :: skip_time    ! time AFTER first bin leading edge
+! type(time_type), intent(out) :: averaging_start_time  ! time to start averaging
 ! type(time_type), intent(out) :: binsep       ! time between bin centers
 ! type(time_type), intent(out) :: binwidth     ! period of interest around center
 ! type(time_type), intent(out) :: halfbinwidth ! half that period
 
 integer :: iyear, imonth, iday, ihour, iminute, isecond
+type(time_type) :: offset
 
 ! Set time of first bin center
 beg_time   = set_date(first_bin_center(1), first_bin_center(2), &
@@ -1554,7 +1556,8 @@
 
 halfbinwidth = binwidth / 2
 
-! Set time that defines the end of the burn-in period.
+! Set time that defines the END of the burn-in period 
+! i.e. the START of the time-averaged quantities.
 ! Anything at or after this time will be used to accumulate time-averaged quantities.
 
 iyear     = time_to_skip(1)
@@ -1563,14 +1566,12 @@
 ihour     = time_to_skip(4)
 iminute   = time_to_skip(5)
 isecond   = time_to_skip(6)
-skip_time = increment_date(beg_time, iyear, imonth, iday, ihour, iminute , isecond)


More information about the Dart-dev mailing list