[Dart-dev] [4843] DART/trunk/models/cam: Added capability to read CAM restart files that have dates that preceed the

nancy at ucar.edu nancy at ucar.edu
Tue Apr 5 08:49:30 MDT 2011


Revision: 4843
Author:   thoar
Date:     2011-04-05 08:49:29 -0600 (Tue, 05 Apr 2011)
Log Message:
-----------
Added capability to read CAM restart files that have dates that preceed the
start of the Gregorian calendar. Simply adding 1601 to the year for all years
that are before 1601. The resulting DART ics file can be modified with the
restart_file_tool.

Modified Paths:
--------------
    DART/trunk/models/cam/cam_to_dart.html
    DART/trunk/models/cam/model_mod.f90

-------------- next part --------------
Modified: DART/trunk/models/cam/cam_to_dart.html
===================================================================
--- DART/trunk/models/cam/cam_to_dart.html	2011-04-04 22:11:13 UTC (rev 4842)
+++ DART/trunk/models/cam/cam_to_dart.html	2011-04-05 14:49:29 UTC (rev 4843)
@@ -50,6 +50,14 @@
    <a href="../../utilities/restart_file_tool.html">restart_file_tool</a> if desired.
    <br />
    <br />
+   Some CAM restart files are from climatological runs and have a valid time that
+   predates the use of the Gregorian calendar. In such instances, the year component
+   of the original date is changed to be a valid Gregorian year (by adding 1601).
+   A warning is issued to the screen and to the logfile. Please use the
+   <a href="../../utilities/restart_file_tool.html">restart_file_tool</a> to change
+   this time.  
+   <br />
+   <br />
    Conditions required for successful execution of <em class=program>cam_to_dart</em>:
 </P>
 

Modified: DART/trunk/models/cam/model_mod.f90
===================================================================
--- DART/trunk/models/cam/model_mod.f90	2011-04-04 22:11:13 UTC (rev 4842)
+++ DART/trunk/models/cam/model_mod.f90	2011-04-05 14:49:29 UTC (rev 4843)
@@ -556,7 +556,7 @@
 logical                 :: do_out
 
 ! common message string used by many subroutines
-character(len=129) :: msgstring
+character(len=129) :: msgstring, string2
 
 ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 integer :: nflds         ! # fields to read
@@ -1762,11 +1762,27 @@
    imin   = rem / 60
    isec   = rem - imin*60
 
+   ! some cam files are from before the start of the gregorian calendar. 
+   ! since these are 'arbitrary' years, just change the offset.
+
+   if (iyear < 1601) then
+      write(logfileunit,*)' '
+      write(     *     ,*)' '
+      write(msgstring,*)'WARNING - ',trim(file_name),' changing year from ',iyear,'to',iyear+1601
+      call error_handler(E_MSG, 'read_cam_init', msgstring, source, revision, &
+                   revdate, text2='to make it a valid Gregorian date.')
+      write(logfileunit,*)' '
+      write(     *     ,*)' '
+      iyear = iyear + 1601
+   endif
+
    model_time = set_date(iyear,imonth,iday,ihour,imin,isec)
 
    if (do_out) then
-      call print_date(model_time,'read_cam_init:CAM input date')
-      call print_time(model_time,'read_cam_init:CAM input time')
+      call print_date(model_time,' read_cam_init ... input date')
+      call print_time(model_time,' read_cam_init ... input time')
+      call print_date(model_time,' read_cam_init ... input date',logfileunit)
+      call print_time(model_time,' read_cam_init ... input time',logfileunit)
    endif
 
    deallocate(datetmp, datesec)


More information about the Dart-dev mailing list