[Dart-dev] [3707] DART/trunk/utilities/restart_file_tool.f90: Don' t try to print time out if no calendar is set.

nancy at ucar.edu nancy at ucar.edu
Thu Dec 11 16:31:57 MST 2008


An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/dart-dev/attachments/20081211/2668da2b/attachment.html
-------------- next part --------------
Modified: DART/trunk/utilities/restart_file_tool.f90
===================================================================
--- DART/trunk/utilities/restart_file_tool.f90	2008-12-11 22:23:31 UTC (rev 3706)
+++ DART/trunk/utilities/restart_file_tool.f90	2008-12-11 23:31:56 UTC (rev 3707)
@@ -14,13 +14,14 @@
 ! Program to overwrite the time on each ensemble in a restart file.
 
 use types_mod,           only : r8
-use time_manager_mod,    only : time_type, operator(<), operator(==), &
-                                set_time_missing, set_time,           &
-                                operator(/=), print_time, print_date, &
-                                set_calendar_type, GREGORIAN
+use time_manager_mod,    only : time_type, operator(<), operator(==),      &
+                                set_time_missing, set_time,                &
+                                operator(/=), print_time, print_date,      &
+                                set_calendar_type, GREGORIAN, NO_CALENDAR, &
+                                get_calendar_type
 
 use utilities_mod,       only : initialize_utilities, register_module,    &
-                                error_handler, nmlfileunit, E_MSG, E_ERR,  &
+                                error_handler, nmlfileunit, E_MSG, E_ERR, &
                                 timestamp, find_namelist_in_file,         &
                                 check_namelist_read, do_output
                                 
@@ -47,7 +48,7 @@
 integer                 :: iunit, model_size, io, member
 type(ensemble_type)     :: ens_handle
 character(len = 128)    :: ifile, ofile
-logical                 :: one_by_one
+logical                 :: one_by_one, has_cal
 character(len=16)       :: write_format
 
 !----------------------------------------------------------------
@@ -107,10 +108,20 @@
 if (do_output()) write(     *     , nml=restart_file_tool_nml)
 
 ! if you are not using a gregorian cal, set this to false
-! in the namelist
-if (gregorian_cal) call set_calendar_type(GREGORIAN)
+! in the namelist.
+! NOTE: the namelist entry should probably be: calendar = 'string_name'
+! and then the time manager should have a: call set_calendar_by_name('name')
+! and then this is much more flexible.  it should probably have a call
+! to get the calendar name as well so it could be used in print statements.
+if (gregorian_cal) then
+   call set_calendar_type(GREGORIAN)
+   has_cal = .true.
+else
+   has_cal = .false.
+endif
 
 
+
 ! ens_size is in the filter namelist, and the single restart file flags
 ! are in the ensemble manager namelist.  how do i get access to them
 ! here without replication?  write accessor routines for those parms
@@ -311,18 +322,22 @@
 
 if (old_advance_time .ne. set_time_missing()) then
    call print_time(old_advance_time,  "input file had an advance_time, which was ")
+   if (has_cal) &
    call print_date(old_advance_time,  "input file had an advance_time, which was ")
 endif
 if ((advance_time .ne. set_time_missing()) .and. output_is_model_advance_file) then
    call print_time(advance_time,  "output file advance_time is now set to ")
+   if (has_cal) &
    call print_date(advance_time,  "output file advance_time is now set to ")
 endif
 if (old_data_time .ne. set_time_missing()) then
    call print_time(old_data_time,  "input file data_time was ")
+   if (has_cal) &
    call print_date(old_data_time,  "input file data_time was ")
 endif
 if ((data_time .ne. set_time_missing()) .or. overwrite_data_time) then
    call print_time(data_time,  "output file data_time is now set to ")
+   if (has_cal) &
    call print_date(data_time,  "output file data_time is now set to ")
 endif
 


More information about the Dart-dev mailing list