[Dart-dev] [6123] DART/branches/development/models/CESM/shell_scripts/ CESM_setup_hybrid_from_prev_run.csh: missed one backslash in the section that creates

nancy at ucar.edu nancy at ucar.edu
Thu May 9 10:38:06 MDT 2013


Revision: 6123
Author:   nancy
Date:     2013-05-09 10:38:04 -0600 (Thu, 09 May 2013)
Log Message:
-----------
missed one backslash in the section that creates
the 'helper' scripts.  without this fix you get an
error about an undefined variable when you run
the script.

Modified Paths:
--------------
    DART/branches/development/models/CESM/shell_scripts/CESM_setup_hybrid_from_prev_run.csh

-------------- next part --------------
Modified: DART/branches/development/models/CESM/shell_scripts/CESM_setup_hybrid_from_prev_run.csh
===================================================================
--- DART/branches/development/models/CESM/shell_scripts/CESM_setup_hybrid_from_prev_run.csh	2013-05-08 22:24:03 UTC (rev 6122)
+++ DART/branches/development/models/CESM/shell_scripts/CESM_setup_hybrid_from_prev_run.csh	2013-05-09 16:38:04 UTC (rev 6123)
@@ -186,6 +186,16 @@
 # some simple error checking before diving into the work
 # ==============================================================================
 
+# fatal idea to make caseroot the same dir as where this setup script is
+# since the build process removes all files in the caseroot dir before
+# populating it.  try to prevent shooting yourself in the foot.
+if ( $caseroot == `dirname $0` ) then
+   echo "ERROR: the setup script should not be located in the caseroot"
+   echo "directory, because all files in the caseroot dir will be removed"
+   echo "before creating the new case.  move the script to a safer place."
+   exit -1
+endif
+
 # make sure these directories exist
 set musthavedirs = "cesm_datadir cesmroot DARTroot"
 foreach VAR ( $musthavedirs )
@@ -198,16 +208,22 @@
    endif
 end
 
-# make sure there is a filter in these dirs
+# make sure there is a filter in these dirs.   try to build
+# them if we can't find filter already built for each model.
 set musthavefiles = "cam POP clm"
 foreach MODEL ( $musthavefiles )
-   set target = $DARTroot/models/$MODEL/work/filter
-   if ( ! -x $target ) then
-      echo "ERROR: executable file 'filter' not found"
-      echo " Looking for: $target "
-      echo " Make sure all DART assimilation executables have "
-      echo " been compiled before running this setup script."
-      exit -1
+   set targetdir = $DARTroot/models/$MODEL/work
+   if ( ! -x $targetdir/filter ) then
+      echo "WARNING: executable file 'filter' not found"
+      echo " Looking for: $targetdir/filter "
+      echo " Trying to rebuild all model files now."
+      (cd $targetdir; ./quickbuild.csh -mpi)
+      if ( ! -x $targetdir/filter ) then
+         echo "ERROR: executable file 'filter' not found"
+         echo " Unsuccessfully tried to rebuild: $targetdir/filter "
+         echo " Required DART assimilation executables are not found "
+         exit -1
+      endif
    endif
 end
 
@@ -690,7 +706,7 @@
 #  4) resetting the env_run file to the first step
 # ==============================================================================
 
-cat << EndOfText >! restage.sh
+cat << EndOfText >! reset_step1.sh
 #!/bin/sh
 
 # this script removes the current contents of the run directory and
@@ -736,9 +752,9 @@
 exit 0
 
 EndOfText
-chmod 0775 restage.sh
+chmod 0775 reset_step1.sh
 
-cat << EndOfText >! restart.sh
+cat << EndOfText >! reset_last_successful_step.sh
 #!/bin/sh
 
 # this script removes the current contents of the run directory and
@@ -763,7 +779,7 @@
 do
    # instance string includes the leading underscore
    inst_string=\`printf _%04d \$inst\`
-   timetag=\`basename ${lastarchivedir}\`
+   timetag=\`basename \${lastarchivedir}\`
 
    ${LINK} ${case}.cam\${inst_string}.i.\${timetag}.nc cam_initial\${inst_string}.nc
 
@@ -778,9 +794,9 @@
 # ./xmlchange RESUBMIT=$resubmit   # depends on how many runs worked before failing
 
 EndOfText
-chmod 0775 restart.sh
+chmod 0775 reset_last_successful_step.sh
 
-cat << EndOfText >! step2.sh
+cat << EndOfText >! stepN.sh
 #!/bin/sh
 
 # this script changes the env_run options that are needed for
@@ -792,9 +808,10 @@
 ./xmlchange STOP_N=$assim_n
 ./xmlchange CONTINUE_RUN=TRUE
 ./xmlchange RESUBMIT=$resubmit
+exit 0
 
 EndOfText
-chmod 0775 step2.sh
+chmod 0775 stepN.sh
 
 cat << EndOfText >! step1.sh
 #!/bin/sh
@@ -808,6 +825,7 @@
 ./xmlchange STOP_N=$stop_n
 ./xmlchange CONTINUE_RUN=FALSE
 ./xmlchange RESUBMIT=0
+exit 0
 
 EndOfText
 chmod 0775 step1.sh
@@ -816,10 +834,19 @@
 # Stage the DART executables in the CESM execution root directory: EXEROOT
 # ==============================================================================
 
+cat << EndOfText >! refresh_dart_files.sh
+#!/bin/sh
+
+# this script copies over the dart executables and namelists to the
+# proper directory.  if you have to update any dart code or namelists,
+# do it in the $DARTroot directory and then rerun refresh_dart_files.sh
+# this script was autogenerated by $0
+# using the variables set in that script
+
 ${COPY} ${DARTroot}/models/cam/work/cam_to_dart   ${exeroot}/.
 ${COPY} ${DARTroot}/models/cam/work/dart_to_cam   ${exeroot}/.
 ${COPY} ${DARTroot}/models/cam/work/filter        ${exeroot}/filter_cam
-${COPY} ${DARTroot}/models/cam/work/filter        ${exeroot}/filter
+#${COPY} ${DARTroot}/models/cam/work/filter        ${exeroot}/filter
 ${COPY} ${DARTroot}/models/cam/work/input.nml                cam_input.nml
 
 ${COPY} ${DARTroot}/models/clm/work/clm_to_dart   ${exeroot}/.
@@ -837,32 +864,43 @@
 ${COPY} ${DARTroot}/models/CESM/work/filter       ${exeroot}/filter_cesm
 ${COPY} ${DARTroot}/models/CESM/work/input.nml               input.nml
 
+exit 0
+
+EndOfText
+chmod 0775 refresh_dart_files.sh
+
+./refresh_dart_files.sh
+
 # ==============================================================================
 # What to do next
 # ==============================================================================
 
-echo ''
+echo ""
 echo "Time to check the case."
-echo ''
+echo ""
 echo "cd into ${caseroot}"
-echo ''
+echo ""
 echo "Modify what you like in input.nml, make sure the observation directory"
 echo "names set in assimilate.csh match those on your system, and submit"
 echo "the CESM job by running:"
 echo "./${case}.submit"
-echo ''
+echo ""
 echo "For continued submissions after the initial (hybrid) startup,"
 echo "make the following changes to the env_run variables:"
-echo ''
+echo ""
 echo "  ./xmlchange -file env_run.xml -id CONTINUE_RUN  -val TRUE"
 echo "  ./xmlchange -file env_run.xml -id RESUBMIT      -val <number_of_cycles_to_run>"
 echo "  ./xmlchange -file env_run.xml -ie STOP_N        -val $assim_n"
-echo ''
+echo ""
+echo "The shell script 'stepN.sh' will do this for you."
+echo "If you have to start over, 'step1.sh' will reset the original files"
+echo " for the first timestep."
+echo ""
 echo "Check the streams listed in the streams text files.  If more or different"
 echo 'dates need to be added, then do this in the $CASEROOT/user_*files*'
 echo "then invoke 'preview_namelists' so you can check the information in the"
 echo "CaseDocs or ${rundir} directories."
-echo ''
+echo ""
 
 exit 0
 


More information about the Dart-dev mailing list