[Dart-dev] [7737] DART/trunk/models/cam/shell_scripts: updated for CAM-SE support, including code to handle

nancy at ucar.edu nancy at ucar.edu
Mon Mar 16 16:42:31 MDT 2015


Revision: 7737
Author:   nancy
Date:     2015-03-16 16:42:30 -0600 (Mon, 16 Mar 2015)
Log Message:
-----------
updated for CAM-SE support, including code to handle
the 'cs mapping' file, which is created by cam-to-dart
if it doesn't already exist. 

Modified Paths:
--------------
    DART/trunk/models/cam/shell_scripts/CESM_DART_config
    DART/trunk/models/cam/shell_scripts/assimilate.csh
    DART/trunk/models/cam/shell_scripts/perfect_model.csh
    DART/trunk/models/cam/shell_scripts/st_archive.sh

Property Changed:
----------------
    DART/trunk/models/cam/shell_scripts/CESM_DART_config
    DART/trunk/models/cam/shell_scripts/assimilate.csh
    DART/trunk/models/cam/shell_scripts/perfect_model.csh

-------------- next part --------------
Modified: DART/trunk/models/cam/shell_scripts/CESM_DART_config
===================================================================
--- DART/trunk/models/cam/shell_scripts/CESM_DART_config	2015-03-16 21:57:14 UTC (rev 7736)
+++ DART/trunk/models/cam/shell_scripts/CESM_DART_config	2015-03-16 22:42:30 UTC (rev 7737)
@@ -142,10 +142,12 @@
    echo ""
 endif
 
+
 ${COPY} ${DARTROOT}/models/cam/shell_scripts/st_archive.sh       Tools/
 ${COPY} ${DARTROOT}/models/cam/shell_scripts/no_assimilate.csh   .
 ${COPY} ${DARTROOT}/models/cam/shell_scripts/assimilate.csh      .
 ${COPY} ${DARTROOT}/models/cam/shell_scripts/perfect_model.csh   .
+${COPY} ${DARTROOT}/models/cam/shell_scripts/submit_cycles.csh   ${CASE}.submit_cycles
 ${COPY} ${DARTROOT}/shell_scripts/shell_exit.sh                  .
 
 # ==============================================================================
@@ -307,6 +309,8 @@
 # The number of instances dictates what DART script will be used.
 # ==============================================================================
 
+# The "" around EndOfText prevent the expansion of variables,
+# so that they will end up with the values in the created script, when it is run.
 cat << "EndOfText" >! temp.$$
 
 # -------------------------------------------------------------------------
@@ -330,8 +334,8 @@
    # If you want to use DART, use 'DARTSCRIPTNAME'
    # You can only use one of the two.
 
-   ${CASEROOT}/no_assimilate.csh
-#  ${CASEROOT}/DARTSCRIPTNAME
+   ${CASEROOT}/no_assimilate.csh      || exit 123
+#  ${CASEROOT}/DARTSCRIPTNAME         || exit 124
 
    if ( $status == 0 ) then
       echo "`date` -- DART HAS FINISHED"


Property changes on: DART/trunk/models/cam/shell_scripts/CESM_DART_config
___________________________________________________________________
Added: svn:mergeinfo
   + /DART/branches/cam/models/cam/shell_scripts/CESM_DART_config:6638-7732
/DART/branches/cam-update/shell_scripts/CESM_DART_config:4903-4923
/DART/branches/development/models/cam/shell_scripts/CESM_DART_config:4680-6255
/DART/branches/gitm/models/cam/shell_scripts/CESM_DART_config:5143-6215
/DART/branches/gitm_lanai/models/cam/shell_scripts/CESM_DART_config:6571-6652
/DART/branches/helen/models/cam/shell_scripts/CESM_DART_config:5995-6161

Modified: DART/trunk/models/cam/shell_scripts/assimilate.csh
===================================================================
--- DART/trunk/models/cam/shell_scripts/assimilate.csh	2015-03-16 21:57:14 UTC (rev 7736)
+++ DART/trunk/models/cam/shell_scripts/assimilate.csh	2015-03-16 22:42:30 UTC (rev 7737)
@@ -18,17 +18,6 @@
 # The VERBOSE options are useful for debugging though
 # some systems don't like the -v option to any of the following
 switch ("`hostname`")
-   case be*:
-      # NCAR "bluefire"
-      set   MOVE = '/usr/local/bin/mv -fv'
-      set   COPY = '/usr/local/bin/cp -fv --preserve=timestamps'
-      set   LINK = '/usr/local/bin/ln -fvs'
-      set REMOVE = '/usr/local/bin/rm -fr'
-
-      set BASEOBSDIR = /glade/proj3/image/Observations/ACARS
-      set  LAUNCHCMD = mpirun.lsf
-   breaksw
-
    case ys*:
       # NCAR "yellowstone"
       set   MOVE = 'mv -fv'
@@ -38,11 +27,22 @@
       set TASKS_PER_NODE = `echo $LSB_SUB_RES_REQ | sed -ne '/ptile/s#.*\[ptile=\([0-9][0-9]*\)]#\1#p'`
       setenv MP_DEBUG_NOTIMEOUT yes
 
-      # BASEOBSDIR needs the whole path name except for the date directory and file name.
+      # BASEOBSDIR has the month/year and specific date appended (see usage below).
       set BASEOBSDIR = /glade/p/image/Observations/ACARS
       set  LAUNCHCMD = mpirun.lsf
    breaksw
 
+   case linux_system_with_utils_in_other_dirs*:
+      # example of pointing this script at a different set of basic commands
+      set   MOVE = '/usr/local/bin/mv -fv'
+      set   COPY = '/usr/local/bin/cp -fv --preserve=timestamps'
+      set   LINK = '/usr/local/bin/ln -fvs'
+      set REMOVE = '/usr/local/bin/rm -fr'
+
+      set BASEOBSDIR = /glade/proj3/image/Observations/ACARS
+      set LAUNCHCMD  = mpirun.lsf
+   breaksw
+
    default:
       # NERSC "hopper"
       set   MOVE = 'mv -fv'
@@ -51,7 +51,8 @@
       set REMOVE = 'rm -fr'
 
       set BASEOBSDIR = /scratch/scratchdirs/nscollin/ACARS
-      set  LAUNCHCMD = "aprun -n $NTASKS"
+      set LAUNCHCMD  = "aprun -n $NTASKS"
+
    breaksw
 endsw
 
@@ -96,9 +97,17 @@
 # The observation file names have a time that matches the stopping time of CAM.
 #-----------------------------------------------------------------------------
 # Make sure the file name structure matches the obs you will be using.
+# PERFECT model obs output appends .perfect to the filenames
 
-set YYYYMM   = `printf %04d%02d ${ATM_YEAR} ${ATM_MONTH}`
-set OBSFNAME = `printf obs_seq%04d%02d%02d%02d ${ATM_YEAR} ${ATM_MONTH} ${ATM_DAY} ${ATM_HOUR}`
+set YYYYMM   = `printf %04d%02d                ${ATM_YEAR} ${ATM_MONTH}`
+if (! -d ${BASEOBSDIR}/${YYYYMM}_6H) then
+   echo "CESM+DART requires 6 hourly obs_seq files in directories of the form YYYYMM_6H"
+   echo "The directory ${BASEOBSDIR}/${YYYYMM}_6H is not found.  Exiting"
+   exit -10
+endif
+
+set OBSFNAME = `printf obs_seq.%04d-%02d-%02d-%05d ${ATM_YEAR} ${ATM_MONTH} ${ATM_DAY} ${ATM_SECONDS}`
+
 set OBS_FILE = ${BASEOBSDIR}/${YYYYMM}_6H/${OBSFNAME}
 
 if (  -e   ${OBS_FILE} ) then
@@ -350,7 +359,7 @@
 # &dart_to_cam_nml:      dart_to_cam_input_file  = 'dart_restart',
 #                        advance_time_present    = .false.
 #
-# KDR; NOTE; when starting an OSSE by perturbing a single file, use
+# NOTE: when starting an OSSE by perturbing a single file, use
 # &filter_nml
 #   start_from_restart        = .false.,
 #   output_restart            = .true.,
@@ -367,6 +376,32 @@
 
 echo "`date` -- BEGIN CAM-TO-DART"
 
+# CAM-SE: DART needs a SEMapping_cs_grid.nc file for cubed-sphere grid mapping.
+# Use an existing file (given in the namelist), or DART will create one the
+# first time it runs.  To create one it needs an existing SEMapping.nc file,
+# which should be output from CAM-SE every forecast.
+
+if ( $CAM_DYCORE == 'se') then
+   # set the default filenames, and then check the input namelist to
+   # see if the user has specified a different cs grid filename.
+   set CS_GRID_FILENAME = 'SEMapping_cs_grid.nc'
+   set MAPPING_FILENAME = 'SEMapping.nc'
+
+   set MYSTRING = `grep cs_grid_file input.nml`
+   if ($#MYSTRING == 3) then
+      set MYSTRING = `echo $MYSTRING | sed -e "s#'# #g"`
+      set CS_GRID_FILENAME = $MYSTRING[3]
+   endif
+
+   # Grid file needs to be in run directory, or cam_to_dart will create one
+   # based on information from the MAPPING file (which was created by CAM).
+   if ( -f ../$CS_GRID_FILENAME) then
+      ${LINK} ../$CS_GRID_FILENAME .
+   else
+      ${LINK} ../$MAPPING_FILENAME .
+   endif
+endif
+
 set member = 1
 while ( ${member} <= ${ensemble_size} )
 
@@ -391,6 +426,16 @@
    ${LINK} ../../$ATM_INITIAL_FILENAME caminput.nc
    ${LINK} ../../$ATM_HISTORY_FILENAME cam_phis.nc
 
+   if ( $CAM_DYCORE == 'se') then
+      # Grid file needs to be in current directory, or cam_to_dart will create one
+      # based on information from the MAPPING file (which was created by CAM).
+      if ( -f ../../$CS_GRID_FILENAME) then
+         ${LINK} ../../$CS_GRID_FILENAME .
+      else
+         ${LINK} ../../$MAPPING_FILENAME .
+      endif
+   endif
+
    echo "starting cam_to_dart for member ${member} at "`date`
    ${EXEROOT}/cam_to_dart >! output.${member}.cam_to_dart &
 
@@ -408,6 +453,14 @@
    exit -6
 endif
 
+if ( $CAM_DYCORE == 'se') then
+   # CAM-SE: if a new grid file was created, copy it to both the run dir and
+   # the case dir for future use.
+   if (! -f ../$CS_GRID_FILENAME)         ${COPY} member_1/$CS_GRID_FILENAME   ..
+   if (! -f $CS_GRID_FILENAME)            ${LINK} ../$CS_GRID_FILENAME         .
+   if (! -f $CASEROOT/$CS_GRID_FILENAME)  ${COPY} ../$CS_GRID_FILENAME         $CASEROOT
+endif
+
 echo "`date` -- END CAM-TO-DART for all ${ensemble_size} members."
 
 #=========================================================================
@@ -450,7 +503,7 @@
 ${MOVE} obs_seq.final      ../cam_obs_seq.${ATM_DATE_EXT}.final
 ${MOVE} dart_log.out       ../cam_dart_log.${ATM_DATE_EXT}.out
 
-# Accomodate any possible inflation files
+# Accommodate any possible inflation files
 # 1) rename file to reflect current date
 # 2) move to RUNDIR so the DART INFLATION BLOCK works next time and
 #    that they can get archived.
@@ -463,6 +516,25 @@
    endif
 end
 
+# Handle localization_diagnostics_files
+set MYSTRING = `grep localization_diagnostics_file input.nml`
+set MYSTRING = `echo $MYSTRING | sed -e "s#[=,']# #g"`
+set MYSTRING = `echo $MYSTRING | sed -e 's#"# #g'`
+set loc_diag = $MYSTRING[2]
+if (-f $loc_diag) then
+   $MOVE $loc_diag ../cam_${loc_diag}.${ATM_DATE_EXT}
+endif
+
+# Handle regression diagnostics
+set MYSTRING = `grep reg_diagnostics_file input.nml`
+set MYSTRING = `echo $MYSTRING | sed -e "s#[=,']# #g"`
+set MYSTRING = `echo $MYSTRING | sed -e 's#"# #g'`
+set reg_diag = $MYSTRING[2]
+if (-f $reg_diag) then
+   $MOVE $reg_diag ../cam_${reg_diag}.${ATM_DATE_EXT}
+endif
+
+# 
 #=========================================================================
 # Block 6: Update the cam restart files ... simultaneously ...
 #


Property changes on: DART/trunk/models/cam/shell_scripts/assimilate.csh
___________________________________________________________________
Added: svn:mergeinfo
   + /DART/branches/cam/models/cam/shell_scripts/assimilate.csh:6638-7732
/DART/branches/cam-update/shell_scripts/assimilate.csh:4903-4923
/DART/branches/development/models/cam/shell_scripts/assimilate.csh:4680-6255
/DART/branches/gitm/models/cam/shell_scripts/assimilate.csh:5143-6215
/DART/branches/gitm_lanai/models/cam/shell_scripts/assimilate.csh:6571-6652
/DART/branches/helen/models/cam/shell_scripts/assimilate.csh:5995-6161

Modified: DART/trunk/models/cam/shell_scripts/perfect_model.csh
===================================================================
--- DART/trunk/models/cam/shell_scripts/perfect_model.csh	2015-03-16 21:57:14 UTC (rev 7736)
+++ DART/trunk/models/cam/shell_scripts/perfect_model.csh	2015-03-16 22:42:30 UTC (rev 7737)
@@ -19,17 +19,8 @@
 # The FORCE options are not optional.
 # The VERBOSE options are useful for debugging though
 # some systems don't like the -v option to any of the following
+
 switch ("`hostname`")
-   case be*:
-      # NCAR "bluefire"
-      set   MOVE = '/usr/local/bin/mv -fv'
-      set   COPY = '/usr/local/bin/cp -fv --preserve=timestamps'
-      set   LINK = '/usr/local/bin/ln -fvs'
-      set REMOVE = '/usr/local/bin/rm -fr'
-
-      set BASEOBSDIR = /glade/proj3/image/Observations/ACARS
-   breaksw
-
    case ys*:
       # NCAR "yellowstone"
       set   MOVE = 'mv -fv'
@@ -37,9 +28,20 @@
       set   LINK = 'ln -fvs'
       set REMOVE = 'rm -fr'
 
-      set BASEOBSDIR = /glade/p/image/Observations/ACARS
+      # BASEOBSDIR has the month/year and specific date appended (see usage below).
+      set BASEOBSDIR    = /glade/p/image/Observations/ACARS
    breaksw
 
+   case linux_system_with_utils_in_other_dirs*:
+      # example of pointing this script at a different set of basic commands
+      set   MOVE = '/usr/local/bin/mv -fv'
+      set   COPY = '/usr/local/bin/cp -fv --preserve=timestamps'
+      set   LINK = '/usr/local/bin/ln -fvs'
+      set REMOVE = '/usr/local/bin/rm -fr'
+
+      set BASEOBSDIR = /glade/proj3/image/Observations/ACARS
+   breaksw
+
    default:
       # NERSC "hopper"
       set   MOVE = 'mv -fv'
@@ -105,7 +107,15 @@
 #-----------------------------------------------------------------------------
 
 set YYYYMM   = `printf %04d%02d                ${ATM_YEAR} ${ATM_MONTH}`
-set OBSFNAME = `printf obs_seq%04d%02d%02d%02d ${ATM_YEAR} ${ATM_MONTH} ${ATM_DAY} ${ATM_HOUR}`
+if (! -d ${BASEOBSDIR}/${YYYYMM}_6H) then
+   echo "CESM+DART requires 6 hourly obs_seq files in directories of the form YYYYMM_6H"
+   echo "The directory ${BASEOBSDIR}/${YYYYMM}_6H is not found.  Exiting"
+   exit -10
+endif
+
+# CESM time stamp format
+set OBSFNAME = `printf obs_seq.%04d-%02d-%02d-%05d ${ATM_YEAR} ${ATM_MONTH} ${ATM_DAY} ${ATM_SECONDS}`
+
 set OBS_FILE = ${BASEOBSDIR}/${YYYYMM}_6H/${OBSFNAME}
 
 if (  -e   ${OBS_FILE} ) then
@@ -138,7 +148,8 @@
    exit -2
 endif
 
-sed -e "s#dart_ics#perfect_ics#" < ${CASEROOT}/input.nml >! input.nml
+sed -e "s/dart_ics/perfect_ics/" \
+    -e "s/obs_seq\.out/obs_seq.perfect/"  < ${CASEROOT}/input.nml >! input.nml
 
 # Turns out the .h0. files are timestamped with the START of the
 # run, which is *not* ATM_DATE_EXT ...  I just link to a whatever
@@ -150,6 +161,32 @@
 ${LINK} $ATM_INITIAL_FILENAME caminput.nc
 ${LINK} $ATM_HISTORY_FILENAME cam_phis.nc
 
+# CAM-SE: DART needs a SEMapping_cs_grid.nc file for cubed-sphere grid mapping.
+# Use an existing file (given in the namelist), or DART will create one the
+# first time it runs.  To create one it needs an existing SEMapping.nc file,
+# which should be output from CAM-SE every forecast.
+
+if ( $CAM_DYCORE == 'se') then
+   # set the default filenames, and then check the input namelist to
+   # see if the user has specified a different cs grid filename.
+   set CS_GRID_FILENAME = 'SEMapping_cs_grid.nc'
+   set MAPPING_FILENAME = 'SEMapping.nc'
+
+   set MYSTRING = `grep cs_grid_file input.nml`
+   if ($#MYSTRING == 3) then
+      set MYSTRING = `echo $MYSTRING | sed -e "s#'# #g"`
+      set CS_GRID_FILENAME = $MYSTRING[3]
+   endif
+
+   # Grid file needs to be in run directory, or cam_to_dart will create one
+   # based on information from the MAPPING file (which was created by CAM).
+   if ( -f ../$CS_GRID_FILENAME ) then
+      ${LINK} ../$CS_GRID_FILENAME .
+   else
+      ${LINK} ../$MAPPING_FILENAME .
+   endif
+endif
+
 #=========================================================================
 # Block 2: Convert 1 CAM restart file to a DART initial conditions file.
 # At the end of the block, we have a DART initial condition file  perfect_ics
@@ -166,6 +203,13 @@
    exit -3
 endif
 
+if ( $CAM_DYCORE == 'se') then
+   # CAM-SE: if a new grid file was created, copy it to both the run dir and
+   # the case dir for future use.
+   if (! -f ../$CS_GRID_FILENAME)         ${COPY} $CS_GRID_FILENAME  ..
+   if (! -f $CASEROOT/$CS_GRID_FILENAME ) ${COPY} $CS_GRID_FILENAME $CASEROOT
+endif
+
 echo "`date` -- END CAM-TO-DART"
 
 #=========================================================================


Property changes on: DART/trunk/models/cam/shell_scripts/perfect_model.csh
___________________________________________________________________
Added: svn:mergeinfo
   + /DART/branches/cam/models/cam/shell_scripts/perfect_model.csh:6638-7732
/DART/branches/cam-update/shell_scripts/perfect_model.csh:4903-4923
/DART/branches/development/models/cam/shell_scripts/perfect_model.csh:4680-6255
/DART/branches/gitm/models/cam/shell_scripts/perfect_model.csh:5143-6215
/DART/branches/gitm_lanai/models/cam/shell_scripts/perfect_model.csh:6571-6652
/DART/branches/helen/models/cam/shell_scripts/perfect_model.csh:5995-6161

Modified: DART/trunk/models/cam/shell_scripts/st_archive.sh
===================================================================
--- DART/trunk/models/cam/shell_scripts/st_archive.sh	2015-03-16 21:57:14 UTC (rev 7736)
+++ DART/trunk/models/cam/shell_scripts/st_archive.sh	2015-03-16 22:42:30 UTC (rev 7737)
@@ -151,9 +151,31 @@
 set *True_State.*.nc;                                                                                                 dispose ifiles_n ${sta}/dart/hist $*
 set *Prior_Diag.*.nc;                                                                                                 dispose ifiles_n ${sta}/dart/hist $*
 set *Posterior_Diag.*.nc;                                                                                             dispose ifiles_n ${sta}/dart/hist $*
-set *obs_seq.*.out;                                                                                                   dispose ifiles_n ${sta}/dart/hist $*
-set *obs_seq.*.final;                                                                                                 dispose ifiles_n ${sta}/dart/hist $*
-set *obs_seq.*.perfect;                                                                                               dispose ifiles_n ${sta}/dart/hist $*
+
+# Save a copy of DART selected obs_sequence files (output from perfect_model_obs,
+# input to filter, and output from filter) to a place that won't be wiped out by lt_archive
+DOUT_ROOT=`dirname $RUNDIR`
+ls cam_obs_seq.*.perfect                         2> /dev/null
+if [ $? -eq 0 ]; then
+   mkdir -p $DOUT_ROOT/Obs_seq_perfect           2> /dev/null
+   cp *obs_seq.*.out $DOUT_ROOT/Obs_seq_perfect
+fi
+
+ls cam_obs_seq.*.out                             2> /dev/null
+if [ $? -eq 0 ]; then
+   mkdir -p $DOUT_ROOT/Obs_seq_out               2> /dev/null
+   cp *obs_seq.*.out $DOUT_ROOT/Obs_seq_out
+fi
+
+ls cam_obs_seq.*.final                           2> /dev/null
+if [ $? -eq 0 ]; then
+   mkdir -p $DOUT_ROOT/Obs_seq_final             2> /dev/null
+   cp *obs_seq.*.final $DOUT_ROOT/Obs_seq_final
+fi
+
+set *obs_seq.*.out;                                                                                                       dispose ifiles_n ${sta}/dart/hist $*
+set *obs_seq.*.final;                                                                                                     dispose ifiles_n ${sta}/dart/hist $*
+set *obs_seq.*.perfect;                                                                                                   dispose ifiles_n ${sta}/dart/hist $*
 set cam_*pr*inflate_restart*;  latest=`ls -rt $* 2> /dev/null | tail -1`; mv $latest ${sta}/rest/${dname} 2> /dev/null;   dispose ifiles_n ${sta}/dart/rest $*
 set cam_*po*inflate_restart*;  latest=`ls -rt $* 2> /dev/null | tail -1`; mv $latest ${sta}/rest/${dname} 2> /dev/null;   dispose ifiles_n ${sta}/dart/rest $*
 set clm_*pr*inflate_restart*;  latest=`ls -rt $* 2> /dev/null | tail -1`; mv $latest ${sta}/rest/${dname} 2> /dev/null;   dispose ifiles_n ${sta}/dart/rest $*
@@ -183,7 +205,8 @@
     set ${CASE}.cam*${inst_suffix}.h4.*;  latest=`ls -rt $* 2> /dev/null | tail -1`; cp $latest ${sta}/rest/${dname} 2> /dev/null; dispose ifiles_n ${sta}/atm/hist $*
     set ${CASE}.cam*${inst_suffix}.h5.*;  latest=`ls -rt $* 2> /dev/null | tail -1`; cp $latest ${sta}/rest/${dname} 2> /dev/null; dispose ifiles_n ${sta}/atm/hist $*
     set ${CASE}.cam*${inst_suffix}.hs.*;  latest=`ls -rt $* 2> /dev/null | tail -1`; cp $latest ${sta}/rest/${dname} 2> /dev/null; dispose ifiles_n ${sta}/atm/hist $*
-    set ${CASE}.cam*${inst_suffix}.i.*;   latest=`ls -rt $* 2> /dev/null | tail -1`; mv $latest ${sta}/rest/${dname} 2> /dev/null; dispose ifiles_y ${sta}/atm/init $*
+    # Save initial files for later evaluation/assimilation
+    set ${CASE}.cam*${inst_suffix}.i.*;   latest=`ls -rt $* 2> /dev/null | tail -1`; mv $latest ${sta}/rest/${dname} 2> /dev/null; dispose ifiles_n ${sta}/atm/init $*
     set ${CASE}.datm${inst_suffix}.r.* ;  latest=`ls -rt $* 2> /dev/null | tail -1`; mv $latest ${sta}/rest/${dname} 2> /dev/null; dispose ifiles_y ${sta}/atm/rest $*
     set ${CASE}.datm${inst_suffix}.rs* ;  latest=`ls -rt $* 2> /dev/null | tail -1`; mv $latest ${sta}/rest/${dname} 2> /dev/null; dispose ifiles_y ${sta}/atm/rest $*
     set ${CASE}.datm${inst_suffix}.h.* ;                                                                                           dispose ifiles_n ${sta}/atm/hist $*
@@ -350,7 +373,7 @@
 # copy back the required files for next restart
 cp ${sta}/rest/${dname}/* .
 
-# now possibly delete the current contents of the restart dir so
+# now selectively delete the current contents of the restart dir so
 # it won't be picked up by the long term archiver.  the diagnostic
 # files are saved for all times, but these are the restart files
 # needed to start a new model advance. if you try to save every
@@ -369,10 +392,20 @@
 # using the time variables from immediately above.
 
 # approximately the last day of each month: all months except feb have 30 days,
-# and all febs have a 28th.  save the 10th, 20th, and "last" day of each month.
+# and all febs have a 28th. 
 if [[ $month == 02 ]]; then lastday=28; else lastday=30; fi
 
-if [[ $secs == 00000 && ($day == 10 || $day == 20 || $day == $lastday) ]]; then
+# example options for how frequently to save a full restart set:
+#
+# 1. Save the 10th, 20th, and "last" day of each month.
+# if [[ $secs == 00000 && ($day == 10 || $day == 20 || $day == $lastday) ]]; then
+#
+# 2. Save every Nth day by setting the frequency in the lines below.
+# Nth=1 
+# if [[ $secs == 00000 && (`expr $day % $Nth` == 0 || $day == $lastday) ]]; then
+
+Nth=1
+if [[ $secs == 00000 && (`expr $day % $Nth` == 0 || $day == $lastday) ]]; then
   echo "st_archive: PRESERVING contents of restart ${dname}"
 else
   echo "st_archive: DELETING contents of restart ${dname}"
@@ -380,9 +413,7 @@
   touch ${sta}/rest/${dname}_removed
 fi
 
-# end of DART changes
 
-
 # make files visible again in the archive directory so they
 # are eligible again for the long term archiver to save.
 if mv ${sta}/* ${DOUT_S_ROOT}; then
@@ -394,7 +425,7 @@
     exit 1
 fi
 
-echo "st_archive.sh: short-term archiving completed successfully"
+echo "`date`: st_archive.sh: short-term archiving completed successfully"
 
 exit 0
 


More information about the Dart-dev mailing list