[Dart-dev] DART/branches Revision: 13197

dart at ucar.edu dart at ucar.edu
Wed Jul 17 09:12:56 MDT 2019


raeder at ucar.edu
2019-07-17 09:12:56 -0600 (Wed, 17 Jul 2019)
157
Fixed handling of existing yearly history files.
They were not found in the previous version
due to having "TYPE" in the file name.

Better exit numbering.




Modified: DART/branches/reanalysis/models/cam-fv/shell_scripts/cesm2_1/repack_st_arch.csh
===================================================================
--- DART/branches/reanalysis/models/cam-fv/shell_scripts/cesm2_1/repack_st_arch.csh	2019-07-16 17:51:35 UTC (rev 13196)
+++ DART/branches/reanalysis/models/cam-fv/shell_scripts/cesm2_1/repack_st_arch.csh	2019-07-17 15:12:56 UTC (rev 13197)
@@ -38,11 +38,11 @@
 #
 #SBATCH --job-name=repack_st_archive
 # 80 members
-# #SBATCH --ntasks=405 
+#SBATCH --ntasks=405 
 # 3 members; 
-#SBATCH --ntasks=15 
+# #SBATCH --ntasks=15 
 # #SBATCH --ntasks=1 
-#SBATCH --time=01:00:00
+#SBATCH --time=03:00:00
 #SBATCH --mail-type=END
 #SBATCH --mail-type=FAIL
 #SBATCH --mail-user=raeder at ucar.edu
@@ -149,10 +149,10 @@
    # CASE could be replaced by setup_*, as is done for DART_config.
    # "project" will be created as needed (assuming user has permission to write there).
    # set project    = /glade/p/cisl/dares/Reanalyses/CAM6_2017
-   set project    = /glade/p/nsc/ncis0006/Reanalyses/CAM6_2010
-   set campaign   = /gpfs/csfs1/cisl/dares/Reanalyses/CAM6_2010
+   set project    = /glade/p/nsc/ncis0006/Reanalyses
+   set campaign   = /gpfs/csfs1/cisl/dares/Reanalyses
    set year  = 2011
-   set month = 1
+   set month = 2
    set yr_mo = `printf %4d-%02d ${year} ${month}`
    set obs_space  = Diags_NTrS_${yr_mo}
    # set DART       = ~/DART/reanalysis
@@ -240,7 +240,7 @@
    set files_dates = `ls ${CASE}.cpl_0001.ha2x1d.${yr_mo}-*.nc*`
    if ($#files_dates == 0) then
       echo "ERROR: there are no ${CASE}.cpl_0001.ha2x1d files.  Set do_forcing = false?"
-      exit
+      exit 23
    else if ($files_dates[1]:e == 'gz') then
       # Separate decompress.csh for each date
       foreach d ($files_dates)
@@ -263,11 +263,23 @@
    while ($i <= $ensemble_size)
       set NINST = `printf %04d $i`
       set inst_dir = ${project}/${CASE}/cpl/hist/${NINST}
-      if (! -d $inst_dir) mkdir -p $inst_dir
-
+# Fix nonmono; there is never a file yearly_file = ...TYPE...
+      # "TYPE" will be replaced by `sed` commands below.
       set yearly_file = ${CASE}.cpl_${NINST}.TYPE.${year}.nc
 
-      # && is bash for 'do the next command if the previous succeeded.
+      if (-d $inst_dir) then
+         mv ${inst_dir}/${CASE}.cpl_${NINST}.*.${year}.nc . || exit 28
+         # Possibly exit because the directory should only exist 
+         # if yearly files were put into it.
+     
+         # "$init" is a place holder, in the template command, for the existence
+         # of a yearly file
+         set init = $yearly_file
+      else
+         mkdir -p $inst_dir
+         set init = ''
+      endif
+
       # First try:
       # echo "ncrcat -A -o $yearly_file " \
       #    "${CASE}.cpl_${NINST}.TYPE.${yr_mo}-*.nc &> TYPE_${NINST}.eo " \
@@ -281,14 +293,8 @@
       # 3) The output file cannot also be the first input file,
       #    or the time monotonicity may be violated.
       #    This defeats the intent of the "append" mode, but testing confirmed it.
-      #
-      if (-f ${inst_dir}/$yearly_file) then
-         mv ${inst_dir}/$yearly_file . 
-         set init = $yearly_file
-      else
-         set init = ''
-      endif
-      echo "ncrcat --rec_apn  $init ${CASE}.cpl_${NINST}.TYPE.${yr_mo}-*.nc " \
+
+      echo "ncrcat --rec_apn $init  ${CASE}.cpl_${NINST}.TYPE.${yr_mo}-*.nc " \
            " ${inst_dir}/$yearly_file &> TYPE_${NINST}.eo " \
            >> cmds_template
       @ i++
@@ -324,7 +330,7 @@
    else
       echo 'ERROR in repackaging forcing (cpl history) files: See h*.eo, cmds_template, mycmdfile'
       echo '      grep ncrcat *.eo  yielded status '$gr_stat
-      exit 20
+      exit 50
    endif
 
 cd ../..
@@ -483,7 +489,7 @@
             echo 'ERROR in repackaging restart files: See tar*.eo, mycmdfile'
             echo '      grep tar *.eo  yielded status '$gr_stat
             ls -l *.eo
-            exit 20
+            exit 60


More information about the Dart-dev mailing list