[Dart-dev] [6040] DART/branches/development/models/CESM/shell_scripts: Making them consistent with their current counterparts in the respective model /shell_scripts directories.

nancy at ucar.edu nancy at ucar.edu
Wed Apr 3 09:56:23 MDT 2013


Revision: 6040
Author:   thoar
Date:     2013-04-03 09:56:23 -0600 (Wed, 03 Apr 2013)
Log Message:
-----------
Making them consistent with their current counterparts in the respective model/shell_scripts directories.

Modified Paths:
--------------
    DART/branches/development/models/CESM/shell_scripts/cam_assimilate.csh
    DART/branches/development/models/CESM/shell_scripts/clm_assimilate.csh
    DART/branches/development/models/CESM/shell_scripts/pop_assimilate.csh

-------------- next part --------------
Modified: DART/branches/development/models/CESM/shell_scripts/cam_assimilate.csh
===================================================================
--- DART/branches/development/models/CESM/shell_scripts/cam_assimilate.csh	2013-04-03 15:46:40 UTC (rev 6039)
+++ DART/branches/development/models/CESM/shell_scripts/cam_assimilate.csh	2013-04-03 15:56:23 UTC (rev 6040)
@@ -306,6 +306,9 @@
    mkdir -p $MYTEMPDIR
    cd $MYTEMPDIR
 
+   # make sure there are no old output logs hanging around
+   $REMOVE output.${member}.cam_to_dart
+
    set ATM_INITIAL_FILENAME = `printf ../../${MYCASE}.cam_%04d.i.${ATM_DATE_EXT}.nc ${member}`
    set ATM_HISTORY_FILENAME = `ls -1t ../../${MYCASE}.cam*.h0.* | head -n 1`
    set     DART_IC_FILENAME = `printf filter_ics.%04d     ${member}`
@@ -327,7 +330,8 @@
 
 wait
 
-if ($status != 0) then
+set nsuccess = `fgrep 'Finished ... at YYYY' member*/output.[0-9]*.cam_to_dart | wc -l`
+if (${nsuccess} != ${ensemble_size}) then
    echo "ERROR ... DART died in 'cam_to_dart' ... ERROR"
    echo "ERROR ... DART died in 'cam_to_dart' ... ERROR"
    exit -6
@@ -413,6 +417,8 @@
 
    cd member_${member}
 
+   ${REMOVE} output.${member}.dart_to_cam
+
    echo "starting dart_to_cam for member ${member} at "`date`
    ${EXEROOT}/dart_to_cam >! output.${member}.dart_to_cam &
 
@@ -423,7 +429,8 @@
 
 wait
 
-if ($status != 0) then
+set nsuccess = `fgrep 'Finished ... at YYYY' member*/output.[0-9]*.dart_to_cam | wc -l`
+if (${nsuccess} != ${ensemble_size}) then
    echo "ERROR ... DART died in 'dart_to_cam' ... ERROR"
    echo "ERROR ... DART died in 'dart_to_cam' ... ERROR"
    exit -8

Modified: DART/branches/development/models/CESM/shell_scripts/clm_assimilate.csh
===================================================================
--- DART/branches/development/models/CESM/shell_scripts/clm_assimilate.csh	2013-04-03 15:46:40 UTC (rev 6039)
+++ DART/branches/development/models/CESM/shell_scripts/clm_assimilate.csh	2013-04-03 15:56:23 UTC (rev 6040)
@@ -1,4 +1,4 @@
-#!/bin/csh -f
+#!/bin/csh
 #
 # DART software - Copyright 2004 - 2011 UCAR. This open source software is
 # provided by UCAR, "as is", without charge, subject to all terms of use at
@@ -10,17 +10,16 @@
 # changes to this script such that the same script can be used
 # on multiple platforms. This will help us maintain the script.
 
-echo "starting assimilate script at "`date`
+echo "`date` -- BEGIN ASSIMILATE"
 
 switch ("`hostname`")
    case be*:
       # NCAR "bluefire"
-# The FORCE options are not optional.
-# the VERBOSE options are useful for debugging.
+      # The FORCE options are not optional.
+      # the VERBOSE options are useful for debugging.
       set   MOVE = '/usr/local/bin/mv -fv'
       set   COPY = '/usr/local/bin/cp -fv --preserve=timestamps'
-      set  FLINK = '/usr/local/bin/ln -fvs'
-      set   LINK = '/usr/local/bin/ln -vs'
+      set   LINK = '/usr/local/bin/ln -fvs'
       set REMOVE = '/usr/local/bin/rm -fr'
 
       set BASEOBSDIR = /glade/proj3/image/Observations/FluxTower
@@ -28,12 +27,25 @@
       set LAUNCHCMD  = mpirun.lsf
    breaksw
 
+   case ys*:
+      # NCAR "yellowstone"
+      # The FORCE options are not optional.
+      # the VERBOSE options are useful for debugging.
+      set   MOVE = 'mv -fv'
+      set   COPY = 'cp -fv --preserve=timestamps'
+      set   LINK = 'ln -fvs'
+      set REMOVE = 'rm -fr'
+
+      set BASEOBSDIR = /glade/p/image/Observations/FluxTower
+      set DARTDIR    = ${HOME}/svn/DART/dev
+      set LAUNCHCMD  = mpirun.lsf
+   breaksw
+
    default:
       # NERSC "hopper"
       set   MOVE = 'mv -fv'
       set   COPY = 'cp -fv --preserve=timestamps'
-      set  FLINK = 'ln -fvs'
-      set   LINK = 'ln -vs'
+      set   LINK = 'ln -fvs'
       set REMOVE = 'rm -fr'
 
       set BASEOBSDIR = /scratch/scratchdirs/nscollin/ACARS
@@ -47,63 +59,70 @@
 # Create temporary working directory for the assimilation
 set temp_dir = assimilate_dir
 echo "temp_dir is $temp_dir"
-mkdir -p $temp_dir
+
+# Create a clean temporary directory and go there
+if ( -d $temp_dir ) then
+   ${REMOVE} $temp_dir/*
+else
+   mkdir -p $temp_dir
+endif
 cd $temp_dir
 
 #-------------------------------------------------------------------------
 # Determine time of model state ... from file name of first member
 # of the form "./${CASE}.clm2_${ensemble_member}.r.2000-01-06-00000.nc"
+#
+# Piping stuff through 'bc' strips off any preceeding zeros.
 #-------------------------------------------------------------------------
 
 set FILE = `head -1 ../rpointer.lnd_0001`
 set FILE = $FILE:t
 set FILE = $FILE:r
 set MYCASE = `echo $FILE | sed -e "s#\..*##"`
-set MODEL_DATE_EXT = `echo $FILE:e`
-set MODEL_DATE     = `echo $FILE:e | sed -e "s#-# #g"`
-set MODEL_YEAR     = $MODEL_DATE[1]
-set MODEL_MONTH    = $MODEL_DATE[2]
-set MODEL_DAY      = $MODEL_DATE[3]
-set MODEL_SECONDS  = $MODEL_DATE[4]
-set MODEL_HOUR     = `echo $MODEL_DATE[4] / 3600 | bc`
+set LND_DATE_EXT = `echo $FILE:e`
+set LND_DATE     = `echo $FILE:e | sed -e "s#-# #g"`
+set LND_YEAR     = `echo $LND_DATE[1] | bc`
+set LND_MONTH    = `echo $LND_DATE[2] | bc`
+set LND_DAY      = `echo $LND_DATE[3] | bc`
+set LND_SECONDS  = `echo $LND_DATE[4] | bc`
+set LND_HOUR     = `echo $LND_DATE[4] / 3600 | bc`
 
-echo "valid time of model is $MODEL_YEAR $MODEL_MONTH $MODEL_DAY $MODEL_SECONDS (seconds)"
-echo "valid time of model is $MODEL_YEAR $MODEL_MONTH $MODEL_DAY $MODEL_HOUR (hours)"
+echo "valid time of model is $LND_YEAR $LND_MONTH $LND_DAY $LND_SECONDS (seconds)"
+echo "valid time of model is $LND_YEAR $LND_MONTH $LND_DAY $LND_HOUR (hours)"
 
 #-----------------------------------------------------------------------------
-# Get observation sequence file ... or die right away. Cannot specify -f on
-# the link command and still check status. The observation file names have
-# a time that matches the stopping time of CLM. The contents of the file
-# must match the history file contents if one is using the obs_def_tower_mod
-# or could be the 'traditional' +/- 12Z ... or both. Since the history file
-# contains the previous days' history ... so must the obs file.
+# Get observation sequence file ... or die right away.
+# The observation file names have a time that matches the stopping time of CLM.
+# The contents of the file must match the history file contents if one is using 
+# the obs_def_tower_mod or could be the 'traditional' +/- 12Z ... or both.
+# Since the history file contains the previous days' history ... so must the obs file.
 #-----------------------------------------------------------------------------
 
-set OBSDIR   = ${BASEOBSDIR}/${MODEL_YEAR}${MODEL_MONTH}
-set OBSFNAME = obs_seq.daybefore.${MODEL_YEAR}${MODEL_MONTH}${MODEL_DAY}
-set OBS_FILE = ${OBSDIR}/${OBSFNAME}
+set YYYYMMDD = `printf %04d%02d%02d ${LND_YEAR} ${LND_MONTH} ${LND_DAY}`
+set YYYYMM   = `printf %04d%02d     ${LND_YEAR} ${LND_MONTH}`
+set OBSFNAME = obs_seq.daybefore.${YYYYMMDD}
+set OBS_FILE = ${BASEOBSDIR}/${YYYYMM}/${OBSFNAME}
 
-${REMOVE}           obs_seq.out
-${LINK} ${OBS_FILE} obs_seq.out
-
-set lnstat = $status
-if ($lnstat != 0) then
+if (  -e   ${OBS_FILE} ) then
+   ${LINK} ${OBS_FILE} obs_seq.out
+else
    echo "ERROR ... no observation file $OBS_FILE"
    echo "ERROR ... no observation file $OBS_FILE"
-   echo "ERROR ... ln died with status $lnstat"
-   exit 1
+   exit -1
 endif
 
 #=========================================================================
 # Block 1: Populate a run-time directory with the input needed to run DART.
 #=========================================================================
 
+echo "`date` -- BEGIN COPY BLOCK"
+
 if (  -e   ${CASEROOT}/input.nml ) then
    ${COPY} ${CASEROOT}/input.nml .
 else
    echo "ERROR ... DART required file ${CASEROOT}/input.nml not found ... ERROR"
    echo "ERROR ... DART required file ${CASEROOT}/input.nml not found ... ERROR"
-   exit 1
+   exit -2
 endif
 
 # Modify the DART input.nml such that
@@ -118,19 +137,23 @@
 wq
 ex_end
 
+#
+echo "`date` -- END COPY BLOCK"
+
 #=========================================================================
 # Block 2: Stage the files needed for SAMPLING ERROR CORRECTION
 #
-# The sampling error correction is a lookup table. The tables are stored
-# in the DART distribution. Each ensemble size has its own (static) file 
-# which does not need to be archived.  It is only needed if
+# The sampling error correction is a lookup table.
+# The tables are stored in the DART distribution.
+# Each ensemble size has its own (static) file.
+# It is only needed if
 # input.nml:&assim_tools_nml:sampling_error_correction = .true.,
 #=========================================================================
 
 set  MYSTRING = `grep sampling_error_correction input.nml`
 set  MYSTRING = `echo $MYSTRING | sed -e "s#[=,'\.]# #g"`
 set  MYSTRING = `echo $MYSTRING | sed -e 's#"# #g'`
-set SECSTRING = `echo $MYSTRING[2] | tr 'A-Z' 'a-z'`
+set SECSTRING = `echo $MYSTRING[2] | tr '[:upper:]' '[:lower:]'`
 
 if ( $SECSTRING == true ) then
    set SAMP_ERR_FILE = ${DARTDIR}/system_simulation/final_full_precomputed_tables/final_full.${ensemble_size}
@@ -139,7 +162,7 @@
    else
       echo "ERROR: no sampling error correction file for this ensemble size."
       echo "ERROR: looking for ${SAMP_ERR_FILE}"
-      exit 2
+      exit -3
    endif
 else
    echo "Sampling Error Correction not requested for this assimilation."
@@ -181,31 +204,31 @@
 #=========================================================================
 
 set  MYSTRING = `grep inf_flavor input.nml`
-set  MYSTRING = `echo $MYSTRING | sed -e "s#[=,]# #g"`
+set  MYSTRING = `echo $MYSTRING | sed -e "s#[=,'\.]# #g"`
 set  PRIOR_INF = $MYSTRING[2]
 set  POSTE_INF = $MYSTRING[3]
 
 set  MYSTRING = `grep inf_initial_from_restart input.nml`
-set  MYSTRING = `echo $MYSTRING | sed -e "s#[=,]# #g"`
-set  PRIOR_TF = `echo $MYSTRING[2] | tr [A-Z] [a-z]`
-set  POSTE_TF = `echo $MYSTRING[3] | tr [A-Z] [a-z]`
+set  MYSTRING = `echo $MYSTRING | sed -e "s#[=,'\.]# #g"`
+set  PRIOR_TF = `echo $MYSTRING[2] | tr '[:upper:]' '[:lower:]'`
+set  POSTE_TF = `echo $MYSTRING[3] | tr '[:upper:]' '[:lower:]'`
 
 # its a little tricky to remove both styles of quotes from the string.
 
 set  MYSTRING = `grep inf_in_file_name input.nml`
-set  MYSTRING = `echo $MYSTRING | sed -e "s#[=,']# #g"`
+set  MYSTRING = `echo $MYSTRING | sed -e "s#[=,'\.]# #g"`
 set  MYSTRING = `echo $MYSTRING | sed -e 's#"# #g'`
 set  PRIOR_INF_IFNAME = $MYSTRING[2]
 set  POSTE_INF_IFNAME = $MYSTRING[3]
 
 set  MYSTRING = `grep inf_out_file_name input.nml`
-set  MYSTRING = `echo $MYSTRING | sed -e "s#[=,']# #g"`
+set  MYSTRING = `echo $MYSTRING | sed -e "s#[=,'\.]# #g"`
 set  MYSTRING = `echo $MYSTRING | sed -e 's#"# #g'`
 set  PRIOR_INF_OFNAME = $MYSTRING[2]
 set  POSTE_INF_OFNAME = $MYSTRING[3]
 
 set  MYSTRING = `grep inf_diag_file_name input.nml`
-set  MYSTRING = `echo $MYSTRING | sed -e "s#[=,']# #g"`
+set  MYSTRING = `echo $MYSTRING | sed -e "s#[=,'\.]# #g"`
 set  MYSTRING = `echo $MYSTRING | sed -e 's#"# #g'`
 set  PRIOR_INF_DIAG = $MYSTRING[2]
 set  POSTE_INF_DIAG = $MYSTRING[3]
@@ -214,88 +237,97 @@
 
 if ( $PRIOR_INF > 0 ) then
 
-   if ($PRIOR_TF == ".false.") then
-      echo "ERROR: inf_flavor(1) = $PRIOR_INF, yet inf_initial_from_restart = $PRIOR_TF"
-      echo "ERROR: fix input.nml to reflect whether you want prior inflation or not."
-      exit 3
-   endif
+   if ($PRIOR_TF == false) then
+      echo "inf_flavor(1) = $PRIOR_INF, using namelist values."
+   else
+      # Look for the output from the previous assimilation
+      (ls -rt1 ../${PRIOR_INF_OFNAME}.* | tail -1 >! latestfile) > & /dev/null
+      set nfiles = `cat latestfile | wc -l`
 
-   # Look for the output from the previous assimilation
-   (ls -rt1 ../${PRIOR_INF_OFNAME}.* | tail -1 >! latestfile) > & /dev/null
-   set nfiles = `cat latestfile | wc -l`
+      # If one exists, use it as input for this assimilation
+      if ( $nfiles > 0 ) then
+         set latest = `cat latestfile`
+         ${LINK} $latest ${PRIOR_INF_IFNAME}
+      else
+         echo "ERROR: Requested PRIOR inflation but specified no incoming inflation file."
+         echo "ERROR: expected something like ../${PRIOR_INF_OFNAME}.YYYY-MM-DD-SSSSS"
+         exit -4
+      endif
 
-   # If one exists, use it as input for this assimilation
-   if ( $nfiles > 0 ) then
-      set latest = `cat latestfile`
-      ${FLINK} $latest ${PRIOR_INF_IFNAME}
-   else
-      echo "ERROR: Requested prior inflation but specified no incoming prior inflation file."
-      echo "ERROR: expected something like ../${PRIOR_INF_OFNAME}.YYYY-MM-DD-SSSSS"
-      exit 4
    endif
-   else
-   echo "Prior Inflation not requested for this assimilation."
-   endif
+else
+   echo "Prior Inflation           not requested for this assimilation."
+endif
 
 # POSTERIOR: We look for the 'newest' and use it - IFF we need it.
 
 if ( $POSTE_INF > 0 ) then
 
-   if ($POSTE_TF == ".false.") then
-      echo "ERROR: inf_flavor(2) = $POSTE_INF, yet inf_initial_from_restart = $POSTE_TF"
-      echo "ERROR: fix input.nml to reflect whether you want posterior inflation or not."
-      exit 5
-   endif
+   if ($POSTE_TF == false) then
+      echo "inf_flavor(2) = $POSTE_INF, using namelist values."
+   else
 
-   # Look for the output from the previous assimilation
-   (ls -rt1 ../${POSTE_INF_OFNAME}.* | tail -1 >! latestfile) > & /dev/null
-   set nfiles = `cat latestfile | wc -l`
+      # Look for the output from the previous assimilation
+      (ls -rt1 ../${POSTE_INF_OFNAME}.* | tail -1 >! latestfile) > & /dev/null
+      set nfiles = `cat latestfile | wc -l`
 
-   # If one exists, use it as input for this assimilation
-   if ( $nfiles > 0 ) then
-      set latest = `cat latestfile`
-      ${FLINK} $latest ${POSTE_INF_IFNAME}
-   else
-      echo "ERROR: Requested POSTERIOR inflation but specified no incoming POSTERIOR inflation file."
-      echo "ERROR: expected something like ../${POSTE_INF_OFNAME}.YYYY-MM-DD-SSSSS"
-      exit 6
+      # If one exists, use it as input for this assimilation
+      if ( $nfiles > 0 ) then
+         set latest = `cat latestfile`
+         ${LINK} $latest ${POSTE_INF_IFNAME}
+      else
+         echo "ERROR: Requested POSTERIOR inflation but specified no incoming inflation file."
+         echo "ERROR: expected something like ../${POSTE_INF_OFNAME}.YYYY-MM-DD-SSSSS"
+         exit -5
+      endif
    endif
 else
-   echo "Posterior Inflation not requested for this assimilation."
+   echo "Posterior Inflation       not requested for this assimilation."
 endif
 
 #=========================================================================
-#
-# Block 4: Convert CLM restart files to DART initial condition files.
+# Block 4: Convert N CLM restart files to DART initial condition files.
 # clm_to_dart is serial code, we can do all of these at the same time
-# as long as we can have unique namelists for all of them.
+# as long as we can have unique namelists for each of them.
 #
-# DART namelist settings appropriate/required:
+# At the end of the block, we have DART initial condition files  filter_ics.[1-N]
+# that came from pointer files ../rpointer.lnd_[1-N].restart
+#
+# REQUIRED DART namelist settings:
 # &filter_nml:           restart_in_file_name    = 'filter_ics'
+#                        restart_out_file_name   = 'filter_restart'
 # &ensemble_manager_nml: single_restart_file_in  = '.false.'
 # &clm_to_dart_nml:      clm_to_dart_output_file = 'dart_ics',
-#
+# &dart_to_clm_nml:      dart_to_clm_input_file  = 'dart_restart',
+#                        advance_time_present    = .false.
 #=========================================================================
 
+echo "`date` -- BEGIN CLM TO DART"
+
 set member = 1
 while ( ${member} <= ${ensemble_size} )
 
    # Each member will do its job in its own directory.
    # That way, we can do N of them simultaneously -
-   # they all read their OWN 'input.nml'
 
    set MYTEMPDIR = member_${member}
    mkdir -p $MYTEMPDIR
    cd $MYTEMPDIR
 
-   set LND_RESTART_FILENAME = `printf ../../${MYCASE}.clm2_%04d.r.${MODEL_DATE_EXT}.nc  ${member}`
-   set LND_HISTORY_FILENAME = `printf ../../${MYCASE}.clm2_%04d.h0.${MODEL_DATE_EXT}.nc ${member}`
-   set     DART_IC_FILENAME = `printf ../filter_ics.%04d ${member}`
+   # make sure there are no old output logs hanging around
+   $REMOVE output.${member}.clm_to_dart
 
-   ${FLINK} $LND_RESTART_FILENAME clm_restart.nc
-   ${FLINK} $LND_HISTORY_FILENAME clm_history.nc
-   ${FLINK}     $DART_IC_FILENAME dart_ics
+   set LND_RESTART_FILENAME = `printf ../../${MYCASE}.clm2_%04d.r.${LND_DATE_EXT}.nc  ${member}`
+   set LND_HISTORY_FILENAME = `printf ../../${MYCASE}.clm2_%04d.h0.${LND_DATE_EXT}.nc ${member}`
+   set     DART_IC_FILENAME = `printf filter_ics.%04d     ${member}`
+   set    DART_RESTART_FILE = `printf filter_restart.%04d ${member}`
 
+   sed -e "s/dart_ics/..\/${DART_IC_FILENAME}/" \
+       -e "s/dart_restart/..\/${DART_RESTART_FILE}/" < ../input.nml >! input.nml
+
+   ${LINK} $LND_RESTART_FILENAME clm_restart.nc
+   ${LINK} $LND_HISTORY_FILENAME clm_history.nc
+
    # patch the CLM restart files to ensure they have the proper
    # _FillValue and missing_value attributes.
 #  ncatted -O -a    _FillValue,frac_sno,o,d,1.0e+36   clm_restart.nc
@@ -309,11 +341,8 @@
 #  ncatted -O -a    _FillValue,T_SOISNO,o,d,1.0e+36   clm_restart.nc
 #  ncatted -O -a missing_value,T_SOISNO,o,d,1.0e+36   clm_restart.nc
 
-   cp ../input.nml .
-
    echo "starting clm_to_dart for member ${member} at "`date`
    ${EXEROOT}/clm_to_dart >! output.${member}.clm_to_dart &
-   echo "finished clm_to_dart for member ${member} at "`date`
 
    cd ..
 
@@ -322,12 +351,15 @@
 
 wait
 
-if ($status != 0) then
+set nsuccess = `fgrep 'Finished ... at YYYY' member*/output.[0-9]*.clm_to_dart | wc -l`
+if (${nsuccess} != ${ensemble_size}) then
    echo "ERROR ... DART died in 'clm_to_dart' ... ERROR"
    echo "ERROR ... DART died in 'clm_to_dart' ... ERROR"
-   exit 7
+   exit -6
 endif
 
+echo "`date` -- END CLM-TO-DART for all ${ensemble_size} members."
+
 #=========================================================================
 # Block 5: Actually run the assimilation.
 # Will result in a set of files : 'filter_restart.xxxx'
@@ -351,30 +383,34 @@
 
 # clm always needs a clm_restart.nc, clm_history.nc for geometry information, etc.
 
-set LND_RESTART_FILENAME = ../${MYCASE}.clm2_0001.r.${MODEL_DATE_EXT}.nc
-set LND_HISTORY_FILENAME = ../${MYCASE}.clm2_0001.h0.${MODEL_DATE_EXT}.nc
+set LND_RESTART_FILENAME = ../${MYCASE}.clm2_0001.r.${LND_DATE_EXT}.nc
+set LND_HISTORY_FILENAME = ../${MYCASE}.clm2_0001.h0.${LND_DATE_EXT}.nc
 
-${FLINK} $LND_RESTART_FILENAME clm_restart.nc
-${FLINK} $LND_HISTORY_FILENAME clm_history.nc
+${LINK} $LND_RESTART_FILENAME clm_restart.nc
+${LINK} $LND_HISTORY_FILENAME clm_history.nc
 
-# FIXME: special for trying out non-monotonic task layouts.
-setenv ORG_PATH "${PATH}"
-setenv LSF_BINDIR /contrib/lsf/tgmpatch
-setenv PATH ${LSF_BINDIR}:${PATH}
+# On yellowstone, you can explore task layouts with the following:
+if ( $?LSB_PJL_TASK_GEOMETRY ) then
+   setenv ORIGINAL_LAYOUT "${LSB_PJL_TASK_GEOMETRY}"
 
-# layout: flat
-setenv NANCY_GEOMETRY_54_1NODE \
-	"{(0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53)}";
-setenv LSB_PJL_TASK_GEOMETRY "${NANCY_GEOMETRY_54_1NODE}"
+   # setenv GEOMETRY_32_1NODE \
+   #    "{(0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31)}";
+   # setenv LSB_PJL_TASK_GEOMETRY "${GEOMETRY_32_1NODE}"
+endif
 
-${LAUNCHCMD} ${EXEROOT}/filter || exit 7
-echo "assimilate:finished filter at "`date`
+echo "`date` -- BEGIN FILTER"
+${LAUNCHCMD} ${EXEROOT}/filter || exit -7
+echo "`date` -- END FILTER"
 
-${MOVE} Prior_Diag.nc      ../Prior_Diag.${MODEL_DATE_EXT}.nc
-${MOVE} Posterior_Diag.nc  ../Posterior_Diag.${MODEL_DATE_EXT}.nc
-${MOVE} obs_seq.final      ../obs_seq.${MODEL_DATE_EXT}.final
-${MOVE} dart_log.out       ../dart_log.${MODEL_DATE_EXT}.out
+if ( $?LSB_PJL_TASK_GEOMETRY ) then
+   setenv LSB_PJL_TASK_GEOMETRY "${ORIGINAL_LAYOUT}"
+endif
 
+${MOVE} Prior_Diag.nc      ../Prior_Diag.${LND_DATE_EXT}.nc
+${MOVE} Posterior_Diag.nc  ../Posterior_Diag.${LND_DATE_EXT}.nc
+${MOVE} obs_seq.final      ../obs_seq.${LND_DATE_EXT}.final
+${MOVE} dart_log.out       ../dart_log.${LND_DATE_EXT}.out
+
 # Accomodate any possible inflation files
 # 1) rename file to reflect current date
 # 2) move to CENTRALDIR so the DART INFLATION BLOCK works next time and
@@ -382,39 +418,29 @@
 
 foreach FILE ( ${PRIOR_INF_OFNAME} ${POSTE_INF_OFNAME} ${PRIOR_INF_DIAG} ${POSTE_INF_DIAG} )
    if ( -e ${FILE} ) then
-      ${MOVE} ${FILE} ../${FILE}.${MODEL_DATE_EXT}
+      ${MOVE} ${FILE} ../${FILE}.${LND_DATE_EXT}
    else
-      echo "No ${FILE} for ${MODEL_DATE_EXT}"
+      echo "No ${FILE} for ${LND_DATE_EXT}"
    endif
 end
 
-# FIXME: special for trying out non-monotonic task layouts.
-setenv PATH "${ORG_PATH}"
-
 #=========================================================================
 # Block 6: Update the clm restart files.
 #
-# DART namelist settings required:
-# &filter_nml:           restart_out_file_name  = 'filter_restart'
-# &ensemble_manager_nml: single_restart_file_in = '.false.'
-# &dart_to_clm_nml:      dart_to_clm_input_file = 'dart_restart',
-# &dart_to_clm_nml:      advance_time_present   = .false.
+# Each member will do its job in its own directory, which already exists
+# and has the required input files remaining from 'Block 4'
 #=========================================================================
 
+echo "`date` -- BEGIN DART TO CLM"
 set member = 1
-while ( ${member} <= ${ensemble_size} )
+while ( $member <= $ensemble_size )
 
-   # Each member will do its job in its own directory, which already exists
-   # and has the required input files remaining from 'Block 4'
-
    cd member_${member}
 
-   set DART_RESTART_FILE = `printf ../filter_restart.%04d ${member}`
-   ${FLINK} $DART_RESTART_FILE dart_restart
+   ${REMOVE} output.${member}.dart_to_clm
 
    echo "starting dart_to_clm for member ${member} at "`date`
    ${EXEROOT}/dart_to_clm >! output.${member}.dart_to_clm &
-   echo "finished dart_to_clm for member ${member} at "`date`
 
    cd ..
 
@@ -423,12 +449,16 @@
 
 wait
 
-if ($status != 0) then
+set nsuccess = `fgrep 'Finished ... at YYYY' member*/output.[0-9]*.dart_to_clm | wc -l`
+if (${nsuccess} != ${ensemble_size}) then
    echo "ERROR ... DART died in 'dart_to_clm' ... ERROR"
    echo "ERROR ... DART died in 'dart_to_clm' ... ERROR"
-   exit 8
+   exit -8
 endif
 
+echo "`date` -- END DART-TO-CLM for all ${ensemble_size} members."
+echo "`date` -- END ASSIMILATE"
+
 #-------------------------------------------------------------------------
 # Cleanup
 #-------------------------------------------------------------------------

Modified: DART/branches/development/models/CESM/shell_scripts/pop_assimilate.csh
===================================================================
--- DART/branches/development/models/CESM/shell_scripts/pop_assimilate.csh	2013-04-03 15:46:40 UTC (rev 6039)
+++ DART/branches/development/models/CESM/shell_scripts/pop_assimilate.csh	2013-04-03 15:56:23 UTC (rev 6040)
@@ -1,4 +1,4 @@
-#!/bin/tcsh
+#!/bin/csh
 #
 # DART software - Copyright 2004 - 2011 UCAR. This open source software is
 # provided by UCAR, "as is", without charge, subject to all terms of use at
@@ -19,8 +19,7 @@
       # the VERBOSE options are useful for debugging.
       set   MOVE = '/usr/local/bin/mv -fv'
       set   COPY = '/usr/local/bin/cp -fv --preserve=timestamps'
-      set  FLINK = '/usr/local/bin/ln -fvs'
-      set   LINK = '/usr/local/bin/ln -vs'
+      set   LINK = '/usr/local/bin/ln -fvs'
       set REMOVE = '/usr/local/bin/rm -fr'
 
       set BASEOBSDIR = /glade/proj3/image/Observations/WOD09
@@ -34,8 +33,7 @@
       # the VERBOSE options are useful for debugging.
       set   MOVE = 'mv -fv'
       set   COPY = 'cp -fv --preserve=timestamps'
-      set  FLINK = 'ln -fvs'
-      set   LINK = 'ln -vs'
+      set   LINK = 'ln -fvs'
       set REMOVE = 'rm -fr'
 
       set BASEOBSDIR = /glade/p/image/Observations/WOD09
@@ -47,8 +45,7 @@
       # NERSC "hopper"
       set   MOVE = 'mv -fv'
       set   COPY = 'cp -fv --preserve=timestamps'
-      set  FLINK = 'ln -fvs'
-      set   LINK = 'ln -vs'
+      set   LINK = 'ln -fvs'
       set REMOVE = 'rm -fr'
 
       set BASEOBSDIR = /scratch/scratchdirs/nscollin/ACARS
@@ -73,7 +70,7 @@
 
 #-------------------------------------------------------------------------
 # Determine time of model state ... from file name of first member
-# of the form "./${CASE}.pop.$ensemble_member.r.2000-01-06-00000.nc"
+# of the form "./${CASE}.pop_${ensemble_member}.r.2000-01-06-00000.nc"
 #
 # Piping stuff through 'bc' strips off any preceeding zeros.
 #-------------------------------------------------------------------------
@@ -95,22 +92,19 @@
 
 #-----------------------------------------------------------------------------
 # Get observation sequence file ... or die right away.
-# Cannot specify -f on the link command and still check status.
 # The observation file names have a time that matches the stopping time of POP.
 #-----------------------------------------------------------------------------
 
-set YYYYMM   = `printf %04d%02d ${OCN_YEAR} ${OCN_MONTH}`
-set OBSFNAME = `printf obs_seq.0Z.%04d%02d%02d ${OCN_YEAR} ${OCN_MONTH} ${OCN_DAY}`
+set YYYYMMDD = `printf %04d%02d%02d ${OCN_YEAR} ${OCN_MONTH} ${OCN_DAY}`
+set YYYYMM   = `printf %04d%02d     ${OCN_YEAR} ${OCN_MONTH}`
+set OBSFNAME = obs_seq.0Z.${YYYYMMDD}
 set OBS_FILE = ${BASEOBSDIR}/${YYYYMM}/${OBSFNAME}
 
-${REMOVE}           obs_seq.out
-${LINK} ${OBS_FILE} obs_seq.out
-
-set lnstat = $status
-if ($lnstat != 0) then
+if (  -e   ${OBS_FILE} ) then
+   ${LINK} ${OBS_FILE} obs_seq.out
+else
    echo "ERROR ... no observation file $OBS_FILE"
    echo "ERROR ... no observation file $OBS_FILE"
-   echo "ERROR ... ln died with status $lnstat"
    exit -1
 endif
 
@@ -125,13 +119,12 @@
 else
    echo "ERROR ... DART required file ${CASEROOT}/input.nml not found ... ERROR"
    echo "ERROR ... DART required file ${CASEROOT}/input.nml not found ... ERROR"
-   exit -1
+   exit -2
 endif
 
-# Since the obs sequence files are small, modify the DART input.nml such
-# that the num_output_obs_members matches the ensemble size.
-#
-# g;num_output_state_members ;s;= .*;= $ensemble_size;
+# Modify the DART input.nml such that
+# the DART ensemble size matches the CESM number of instances
+# WARNING: the output files contain ALL enemble members ==> BIG
 
 ex input.nml <<ex_end
 g;ens_size ;s;= .*;= $ensemble_size;
@@ -166,7 +159,7 @@
    else
       echo "ERROR: no sampling error correction file for this ensemble size."
       echo "ERROR: looking for ${SAMP_ERR_FILE}"
-      exit -2
+      exit -3
    endif
 else
    echo "Sampling Error Correction not requested for this assimilation."
@@ -251,11 +244,11 @@
       # If one exists, use it as input for this assimilation
       if ( $nfiles > 0 ) then
          set latest = `cat latestfile`
-         ${FLINK} $latest ${PRIOR_INF_IFNAME}
+         ${LINK} $latest ${PRIOR_INF_IFNAME}
       else
          echo "ERROR: Requested PRIOR inflation but specified no incoming inflation file."
          echo "ERROR: expected something like ../${PRIOR_INF_OFNAME}.YYYY-MM-DD-SSSSS"
-         exit 4
+         exit -4
       endif
 
    endif
@@ -278,11 +271,11 @@
       # If one exists, use it as input for this assimilation
       if ( $nfiles > 0 ) then
          set latest = `cat latestfile`
-         ${FLINK} $latest ${POSTE_INF_IFNAME}
+         ${LINK} $latest ${POSTE_INF_IFNAME}
       else
          echo "ERROR: Requested POSTERIOR inflation but specified no incoming inflation file."
          echo "ERROR: expected something like ../${POSTE_INF_OFNAME}.YYYY-MM-DD-SSSSS"
-         exit 6
+         exit -5
       endif
    endif
 else
@@ -290,22 +283,20 @@
 endif
 
 #=========================================================================
-# Block 4: convert N POP restart files to DART initial conditions file(s)
+# Block 4: Convert N POP restart files to DART initial condition files.
 # pop_to_dart is serial code, we can do all of these at the same time
-# and just wait for them to finish IFF it were not for the fact we'd have
-# to have unique namelists for all of them.
+# as long as we can have unique namelists for each of them.
 #
-# At the end of the block, we have DART restart files  filter_ics.[1-N]
-# that came from pointer files ../rpointer.ocn.[1-N].restart
+# At the end of the block, we have DART initial condition files  filter_ics.[1-N]
+# that came from pointer files ../rpointer.ocn_[1-N].restart
 #
-# DART namelist settings appropriate/required:
+# REQUIRED DART namelist settings:
 # &filter_nml:           restart_in_file_name    = 'filter_ics'
 #                        restart_out_file_name   = 'filter_restart'
 # &ensemble_manager_nml: single_restart_file_in  = '.false.'
 # &pop_to_dart_nml:      pop_to_dart_output_file = 'dart_ics',
 # &dart_to_pop_nml:      dart_to_pop_input_file  = 'dart_restart',
-# &dart_to_pop_nml:      advance_time_present    = .false.
-#
+#                        advance_time_present    = .false.
 #=========================================================================
 
 echo "`date` -- BEGIN POP TO DART"
@@ -320,6 +311,9 @@
    mkdir -p $MYTEMPDIR
    cd $MYTEMPDIR
 
+   # make sure there are no old output logs hanging around
+   $REMOVE output.${member}.pop_to_dart
+
    set OCN_RESTART_FILENAME = `printf ../../${MYCASE}.pop_%04d.r.${OCN_DATE_EXT}.nc  ${member}`
    set     OCN_NML_FILENAME = `printf ../../pop2_in_%04d  ${member}`
    set     DART_IC_FILENAME = `printf filter_ics.%04d     ${member}`
@@ -328,8 +322,8 @@
    sed -e "s/dart_ics/..\/${DART_IC_FILENAME}/" \
        -e "s/dart_restart/..\/${DART_RESTART_FILE}/" < ../input.nml >! input.nml
 
-   ${FLINK} $OCN_RESTART_FILENAME pop.r.nc
-   ${FLINK}     $OCN_NML_FILENAME pop_in
+   ${LINK} $OCN_RESTART_FILENAME pop.r.nc
+   ${LINK}     $OCN_NML_FILENAME pop_in
 
    echo "starting pop_to_dart for member ${member} at "`date`
    ${EXEROOT}/pop_to_dart >! output.${member}.pop_to_dart &
@@ -341,10 +335,11 @@
 
 wait
 
-if ($status != 0) then
+set nsuccess = `fgrep 'Finished ... at YYYY' member*/output.[0-9]*.pop_to_dart | wc -l`
+if (${nsuccess} != ${ensemble_size}) then
    echo "ERROR ... DART died in 'pop_to_dart' ... ERROR"
    echo "ERROR ... DART died in 'pop_to_dart' ... ERROR"
-   exit -7
+   exit -6
 endif
 
 echo "`date` -- END POP-TO-DART for all ${ensemble_size} members."
@@ -366,7 +361,7 @@
 # &filter_nml:           first_obs_seconds      = -1,
 # &filter_nml:           last_obs_days          = -1,
 # &filter_nml:           last_obs_seconds       = -1,
-# &ensemble_manager_nml: single_restart_file_in = '.false.'
+# &ensemble_manager_nml: single_restart_file_in = .false.
 #
 #=========================================================================
 
@@ -374,13 +369,27 @@
 # Lots of ways to get the filename
 
 set OCN_RESTART_FILENAME = `head -1 ../rpointer.ocn_0001.restart`
+
 ${LINK} ../$OCN_RESTART_FILENAME pop.r.nc
 ${LINK} ../pop2_in_0001          pop_in
 
+# On yellowstone, you can explore task layouts with the following:
+if ( $?LSB_PJL_TASK_GEOMETRY ) then
+   setenv ORIGINAL_LAYOUT "${LSB_PJL_TASK_GEOMETRY}"
+
+   # setenv GEOMETRY_32_1NODE \
+   #    "{(0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31)}";
+   # setenv LSB_PJL_TASK_GEOMETRY "${GEOMETRY_32_1NODE}"
+endif
+
 echo "`date` -- BEGIN FILTER"
-${LAUNCHCMD} ${EXEROOT}/filter || exit -2
+${LAUNCHCMD} ${EXEROOT}/filter || exit -7
 echo "`date` -- END FILTER"
 
+if ( $?LSB_PJL_TASK_GEOMETRY ) then
+   setenv LSB_PJL_TASK_GEOMETRY "${ORIGINAL_LAYOUT}"
+endif
+
 ${MOVE} Prior_Diag.nc      ../Prior_Diag.${OCN_DATE_EXT}.nc
 ${MOVE} Posterior_Diag.nc  ../Posterior_Diag.${OCN_DATE_EXT}.nc
 ${MOVE} obs_seq.final      ../obs_seq.${OCN_DATE_EXT}.final
@@ -402,19 +411,18 @@
 #=========================================================================
 # Block 6: Update the POP restart files ... simultaneously ...
 #
-# Each member will do its job in its own directory.
-# That way, we can do N of them simultaneously.
-# The namelist already reflects the right filenames.
-# The right filenames are already linked from the pop_to_dart conversion.
+# Each member will do its job in its own directory, which already exists
+# and has the required input files remaining from 'Block 4'
 #=========================================================================
 
 echo "`date` -- BEGIN DART TO POP"
 set member = 1
 while ( $member <= $ensemble_size )
 
-   set m4 = `printf %04d $member`
    cd member_${member}
 
+   ${REMOVE} output.${member}.dart_to_pop
+
    echo "starting dart_to_pop for member ${member} at "`date`
    ${EXEROOT}/dart_to_pop >! output.${member}.dart_to_pop &
 
@@ -425,7 +433,8 @@
 
 wait
 
-if ($status != 0) then
+set nsuccess = `fgrep 'Finished ... at YYYY' member*/output.[0-9]*.dart_to_pop | wc -l`
+if (${nsuccess} != ${ensemble_size}) then
    echo "ERROR ... DART died in 'dart_to_pop' ... ERROR"
    echo "ERROR ... DART died in 'dart_to_pop' ... ERROR"
    exit -8


More information about the Dart-dev mailing list