[Dart-dev] DART/branches Revision: 11319

dart at ucar.edu dart at ucar.edu
Tue Mar 14 16:14:48 MDT 2017


raeder at ucar.edu
2017-03-14 16:14:48 -0600 (Tue, 14 Mar 2017)
100
Added protection against rebuilding a case which has existing DART output
in the archive directory.



Modified: DART/branches/rma_trunk/models/cam-fv/shell_scripts/cesm1_5/setup_hybrid
===================================================================
--- DART/branches/rma_trunk/models/cam-fv/shell_scripts/cesm1_5/setup_hybrid	2017-03-14 22:05:09 UTC (rev 11318)
+++ DART/branches/rma_trunk/models/cam-fv/shell_scripts/cesm1_5/setup_hybrid	2017-03-14 22:14:48 UTC (rev 11319)
@@ -361,12 +361,20 @@
    exit 11
 endif
 
-echo "removing old files from ${caseroot}"
-echo "removing old files from ${exeroot}"
-echo "removing old files from ${rundir}"
-${REMOVE} ${caseroot}
-${REMOVE} ${exeroot}
-${REMOVE} ${rundir}
+set old_files = ()
+if (-d $archdir/dart/hist) set old_files = `ls $archdir/dart/hist`
+if ($#old_files == 0) then
+   echo "removing old files from ${caseroot}"
+   echo "removing old files from ${exeroot}"
+   echo "removing old files from ${rundir}"
+   ${REMOVE} ${caseroot}
+   ${REMOVE} ${exeroot}
+   ${REMOVE} ${rundir}
+else
+   echo "There are DART output files in $archdir/dart/hist."
+   echo "Do you REALLY want to rebuild this case?"
+   exit 12
+endif
 
 ${cesmroot}/cime/scripts/create_newcase -case ${caseroot} -mach ${mach} \
     -res ${resolution} -compset ${compset} 
@@ -374,7 +382,7 @@
 
 if ( $status != 0 ) then
    echo "ERROR: Case could not be created."
-   exit 12
+   exit 15
 endif
 
 # ==============================================================================

Modified: DART/branches/rma_trunk/models/cam-fv/shell_scripts/cesm2_0/setup_advanced
===================================================================
--- DART/branches/rma_trunk/models/cam-fv/shell_scripts/cesm2_0/setup_advanced	2017-03-14 22:05:09 UTC (rev 11318)
+++ DART/branches/rma_trunk/models/cam-fv/shell_scripts/cesm2_0/setup_advanced	2017-03-14 22:14:48 UTC (rev 11319)
@@ -404,12 +404,20 @@
    exit 11
 endif
 
-echo "removing old files from ${caseroot}"
-echo "removing old files from ${exeroot}"
-echo "removing old files from ${rundir}"
-${REMOVE} ${caseroot}
-${REMOVE} ${exeroot}
-${REMOVE} ${rundir}
+set old_files = ()
+if (-d $archdir/dart/hist) set old_files = `ls $archdir/dart/hist`
+if ($#old_files == 0) then
+   echo "removing old files from ${caseroot}"
+   echo "removing old files from ${exeroot}"
+   echo "removing old files from ${rundir}"
+   ${REMOVE} ${caseroot}
+   ${REMOVE} ${exeroot}
+   ${REMOVE} ${rundir}
+else
+   echo "There are DART output files in $archdir/dart/hist."
+   echo "Do you REALLY want to rebuild this case?"
+   exit 12
+endif
 
 # setup_advanced will need more flexible arguments, as in CESM1_5_setup_advanced(?)
 # This may need --project, if env var PROJECT is no longer used.
@@ -419,7 +427,7 @@
     
 if ( $status != 0 ) then
    echo "ERROR: Case could not be created."
-   exit 12
+   exit 15
 endif
 
 # ==============================================================================

Modified: DART/branches/rma_trunk/models/cam-fv/shell_scripts/cesm2_0/setup_hybrid
===================================================================
--- DART/branches/rma_trunk/models/cam-fv/shell_scripts/cesm2_0/setup_hybrid	2017-03-14 22:05:09 UTC (rev 11318)
+++ DART/branches/rma_trunk/models/cam-fv/shell_scripts/cesm2_0/setup_hybrid	2017-03-14 22:14:48 UTC (rev 11319)
@@ -375,12 +375,20 @@
    exit 11
 endif
 
-echo "removing old files from ${caseroot}"
-echo "removing old files from ${exeroot}"
-echo "removing old files from ${rundir}"
-${REMOVE} ${caseroot}
-${REMOVE} ${exeroot}
-${REMOVE} ${rundir}
+set old_files = ()
+if (-d $archdir/dart/hist) set old_files = `ls $archdir/dart/hist`
+if ($#old_files == 0) then
+   echo "removing old files from ${caseroot}"
+   echo "removing old files from ${exeroot}"


More information about the Dart-dev mailing list