[Dart-dev] [6506] DART/trunk/models/CESM/shell_scripts: first stab at perfect model scripts when running the fully coupled

nancy at ucar.edu nancy at ucar.edu
Wed Oct 9 16:18:51 MDT 2013


Revision: 6506
Author:   nancy
Date:     2013-10-09 16:18:50 -0600 (Wed, 09 Oct 2013)
Log Message:
-----------
first stab at perfect model scripts when running the fully coupled
CESM model.  untested as of yet.

Added Paths:
-----------
    DART/trunk/models/CESM/shell_scripts/cam_perfect_model.csh
    DART/trunk/models/CESM/shell_scripts/clm_perfect_model.csh
    DART/trunk/models/CESM/shell_scripts/pop_perfect_model.csh

-------------- next part --------------
Added: DART/trunk/models/CESM/shell_scripts/cam_perfect_model.csh
===================================================================
--- DART/trunk/models/CESM/shell_scripts/cam_perfect_model.csh	                        (rev 0)
+++ DART/trunk/models/CESM/shell_scripts/cam_perfect_model.csh	2013-10-09 22:18:50 UTC (rev 6506)
@@ -0,0 +1,256 @@
+#!/bin/csh
+#
+# DART software - Copyright 2004 - 2013 UCAR. This open source software is
+# provided by UCAR, "as is", without charge, subject to all terms of use at
+# http://www.image.ucar.edu/DAReS/DART/DART_download
+#
+# DART $Id$
+
+# This block is an attempt to localize all the machine-specific
+# changes to this script such that the same script can be used
+# on multiple platforms. This will help us maintain the script.
+# Search below for TIMECHECK to see what times this script will
+# run.
+
+echo "`date` -- BEGIN GENERATE CAM TRUE STATE"
+
+set nonomatch       # suppress "rm" warnings if wildcard does not match anything
+
+# 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'
+      set   COPY = 'cp -fv --preserve=timestamps'
+      set   LINK = 'ln -fvs'
+      set REMOVE = 'rm -fr'
+
+      set BASEOBSDIR = /glade/p/image/Observations/ACARS
+   breaksw
+
+   default:
+      # NERSC "hopper"
+      set   MOVE = 'mv -fv'
+      set   COPY = 'cp -fv --preserve=timestamps'
+      set   LINK = 'ln -fvs'
+      set REMOVE = 'rm -fr'
+
+      set BASEOBSDIR = /scratch/scratchdirs/nscollin/ACARS
+   breaksw
+endsw
+
+#-------------------------------------------------------------------------
+# Determine time of model state ... from file name of first member
+# of the form "./${CASE}.cam_${ensemble_member}.i.2000-01-06-00000.nc"
+#
+# Piping stuff through 'bc' strips off any preceeding zeros.
+#-------------------------------------------------------------------------
+
+set FILE = `head -n 1 rpointer.atm_0001`
+set FILE = $FILE:t
+set FILE = $FILE:r
+set ATM_DATE_EXT = `echo $FILE:e`
+set ATM_DATE     = `echo $FILE:e | sed -e "s#-# #g"`
+set ATM_YEAR     = `echo $ATM_DATE[1] | bc`
+set ATM_MONTH    = `echo $ATM_DATE[2] | bc`
+set ATM_DAY      = `echo $ATM_DATE[3] | bc`
+set ATM_SECONDS  = `echo $ATM_DATE[4] | bc`
+set ATM_HOUR     = `echo $ATM_DATE[4] / 3600 | bc`
+
+echo "valid time of model is $ATM_YEAR $ATM_MONTH $ATM_DAY $ATM_SECONDS (seconds)"
+echo "valid time of model is $ATM_YEAR $ATM_MONTH $ATM_DAY $ATM_HOUR (hours)"
+
+#-------------------------------------------------------------------------
+# Determine if current time is a perfect model time.
+# If not, return before doing anything.
+#-------------------------------------------------------------------------
+
+## TIMECHECK:
+if ( $ATM_HOUR == 0 || $ATM_HOUR == 6 || $ATM_HOUR == 12 || $ATM_HOUR == 18) then
+   echo "Hour is $ATM_HOUR so we are generating perfect obs for the atmosphere"
+else
+   echo "Hour is not 0,6,12 or 18Z so we are skipping generating perfect obs for the atmosphere"
+   echo "`date` -- END CAM_ASSIMILATE"
+   exit 0
+endif
+
+#-------------------------------------------------------------------------
+# Create temporary working directory for the perfect model and go there
+#-------------------------------------------------------------------------
+
+set temp_dir = pmo_cam
+echo "temp_dir is $temp_dir"
+
+if ( -d $temp_dir ) then
+   ${REMOVE} $temp_dir/*
+else
+   mkdir -p $temp_dir
+endif
+cd $temp_dir
+
+#-----------------------------------------------------------------------------
+# Get observation sequence file ... or die right away.
+# The observation file names have a time that matches the stopping time of CAM.
+#-----------------------------------------------------------------------------
+
+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 OBS_FILE = ${BASEOBSDIR}/${YYYYMM}_6H/${OBSFNAME}
+
+if (  -e   ${OBS_FILE} ) then
+   ${LINK} ${OBS_FILE} obs_seq.in
+else
+   echo "ERROR ... no observation file $OBS_FILE"
+   echo "ERROR ... no observation file $OBS_FILE"
+   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}/cam_input.nml ) then
+   ${COPY} ${CASEROOT}/cam_input.nml input.nml
+else
+   echo "ERROR ... DART required file ${CASEROOT}/cam_input.nml not found ... ERROR"
+   echo "ERROR ... DART required file ${CASEROOT}/cam_input.nml not found ... ERROR"
+   exit -2
+endif
+
+echo "`date` -- END COPY BLOCK"
+
+#=========================================================================
+# Block 2: Convert 1 CAM restart file to DART initial conditions file.
+# At the end of the block, we have DART initial condition file  perfect_ics
+# that came from pointer file ../rpointer.atm_0001
+#
+# REQUIRED DART namelist settings:
+# &perfect_model_obs_nml:  restart_in_file_name    = 'perfect_ics'
+# &cam_to_dart_nml:        cam_to_dart_output_file = 'dart_ics'
+#=========================================================================
+
+echo "`date` -- BEGIN CAM-TO-DART"
+
+set member = 1
+
+   set MYTEMPDIR = member_${member}
+   mkdir -p $MYTEMPDIR
+   cd $MYTEMPDIR
+
+   # 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
+   # is convenient (since the info is static).
+   # make sure there are no old output logs hanging around
+   $REMOVE output.${member}.cam_to_dart
+
+   set ATM_INITIAL_FILENAME = "../../${CASE}.cam.i.${ATM_DATE_EXT}.nc"
+   set ATM_HISTORY_FILENAME = `ls -1t ../../${CASE}.cam*.h0.* | head -n 1`
+   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} $ATM_INITIAL_FILENAME caminput.nc
+   ${LINK} $ATM_HISTORY_FILENAME cam_phis.nc
+
+   ${EXEROOT}/cam_to_dart >! output.${member}.cam_to_dart 
+
+   if ($status != 0) then
+   echo "ERROR ... DART died in 'cam_to_dart' ... ERROR"
+   echo "ERROR ... DART died in 'cam_to_dart' ... ERROR"
+   exit -6
+endif
+
+echo "`date` -- END CAM-TO-DART"
+
+#=========================================================================
+# Block 3: Advance the model and harvest the synthetic observations.
+# Will result in a single file : 'perfect_restart' which we don't need
+# for a perfect model experiment with CESM.
+#
+# DART namelist settings required:
+# &perfect_model_obs_nml:           async                  = 0,
+# &perfect_model_obs_nml:           adv_ens_command        = "./no_model_advance.csh",
+# &perfect_model_obs_nml:           restart_in_file_name   = 'perfect_ics'
+# &perfect_model_obs_nml:           restart_out_file_name  = 'perfect_restart'
+# &perfect_model_obs_nml:           obs_sequence_in_name   = 'obs_seq.in'
+# &perfect_model_obs_nml:           obs_sequence_out_name  = 'obs_seq.out'
+# &perfect_model_obs_nml:           init_time_days         = -1,
+# &perfect_model_obs_nml:           init_time_seconds      = -1,
+# &perfect_model_obs_nml:           first_obs_days         = -1,
+# &perfect_model_obs_nml:           first_obs_seconds      = -1,
+# &perfect_model_obs_nml:           last_obs_days          = -1,
+# &perfect_model_obs_nml:           last_obs_seconds       = -1,
+#
+#=========================================================================
+
+# CAM:static_init_model() always needs a caminput.nc and a cam_phis.nc
+# for geometry information, etc.
+
+set ATM_INITIAL_FILENAME = ../${CASE}.cam.i.${ATM_DATE_EXT}.nc
+set ATM_HISTORY_FILENAME = `ls -1t ../${CASE}.cam*.h0.* | head -n 1`
+
+${LINK} $ATM_INITIAL_FILENAME caminput.nc
+${LINK} $ATM_HISTORY_FILENAME cam_phis.nc
+
+echo "`date` -- BEGIN CAM PERFECT_MODEL_OBS"
+${LAUNCHCMD} ${EXEROOT}/perfect_model_obs_cam || exit -7
+echo "`date` -- END   CAM PERFECT_MODEL_OBS"
+
+${MOVE} Prior_Diag.nc      ../cam_Prior_Diag.${ATM_DATE_EXT}.nc
+${MOVE} Posterior_Diag.nc  ../cam_Posterior_Diag.${ATM_DATE_EXT}.nc
+${MOVE} obs_seq.final      ../cam_obs_seq.${ATM_DATE_EXT}.final
+${MOVE} dart_log.out       ../cam_dart_log.${ATM_DATE_EXT}.out
+
+#=========================================================================
+# Block 4: Update the cam restart file
+#=========================================================================
+
+# not needed ... perfect_model_obs does not update the model state.
+
+#=========================================================================
+# Block 5: Link the next cam file to the static name needed here.
+#=========================================================================
+
+cd ${RUNDIR}
+
+   set ATM_INITIAL_FILENAME = ${CASE}.cam.i.${ATM_DATE_EXT}.nc
+
+   ${LINK} ${ATM_INITIAL_FILENAME} cam_initial.nc || exit -9
+
+end
+
+#-------------------------------------------------------------------------
+# Cleanup
+# we (DART) do not need these files, and CESM does not need them either
+# to continue a run.  if we remove them here they do not get moved to
+# the short-term archiver.
+#-------------------------------------------------------------------------
+
+# ${REMOVE} ${RUNDIR}/*.rh0.*
+# ${REMOVE} ${RUNDIR}/*.rs1.*
+
+echo "`date` -- END   GENERATE CAM TRUE STATE"
+
+exit 0
+
+# <next few lines under version control, do not edit>
+# $URL$
+# $Revision$
+# $Date$
+


Property changes on: DART/trunk/models/CESM/shell_scripts/cam_perfect_model.csh
___________________________________________________________________
Added: svn:executable
   + *
Added: svn:mime-type
   + text/plain
Added: svn:keywords
   + Date Rev Author HeadURL Id
Added: svn:eol-style
   + native

Added: DART/trunk/models/CESM/shell_scripts/clm_perfect_model.csh
===================================================================
--- DART/trunk/models/CESM/shell_scripts/clm_perfect_model.csh	                        (rev 0)
+++ DART/trunk/models/CESM/shell_scripts/clm_perfect_model.csh	2013-10-09 22:18:50 UTC (rev 6506)
@@ -0,0 +1,290 @@
+#!/bin/csh
+#
+# DART software - Copyright 2004 - 2013 UCAR. This open source software is
+# provided by UCAR, "as is", without charge, subject to all terms of use at
+# http://www.image.ucar.edu/DAReS/DART/DART_download
+#
+# DART $Id$
+
+# This block is an attempt to localize all the machine-specific
+# changes to this script such that the same script can be used
+# on multiple platforms. This will help us maintain the script.
+
+echo "`date` -- BEGIN GENERATE CLM TRUE STATE"
+
+set nonomatch       # suppress "rm" warnings if wildcard does not match anything
+
+# 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/FluxTower
+   breaksw
+
+   case ys*:
+      # NCAR "yellowstone"
+      set   MOVE = 'mv -fv'
+      set   COPY = 'cp -fv --preserve=timestamps'
+      set   LINK = 'ln -fvs'
+      set REMOVE = 'rm -fr'
+
+      set BASEOBSDIR = /glade/p/image/Observations/land
+   breaksw
+
+   case lone*:
+      # UT lonestar
+      set   MOVE = '/bin/mv -fv'
+      set   COPY = '/bin/cp -fv --preserve=timestamps'
+      set   LINK = '/bin/ln -fvs'
+      set REMOVE = '/bin/rm -fr'
+
+      set BASEOBSDIR = ${WORK}/DART/observations/snow/work/obs_seqs
+   breaksw
+
+   case la*:
+      # LBNL "lawrencium"
+      set   MOVE = 'mv -fv'
+      set   COPY = 'cp -fv --preserve=timestamps'
+      set   LINK = 'ln -fvs'
+      set REMOVE = 'rm -fr'
+
+      set BASEOBSDIR = /your/observation/directory/here
+   breaksw
+
+   default:
+      # NERSC "hopper"
+      set   MOVE = 'mv -fv'
+      set   COPY = 'cp -fv --preserve=timestamps'
+      set   LINK = 'ln -fvs'
+      set REMOVE = 'rm -fr'
+
+      set BASEOBSDIR = /scratch/scratchdirs/nscollin/ACARS
+   breaksw
+endsw
+
+#-------------------------------------------------------------------------
+# Determine time of model state ... from file name of first member
+# of the form "./${CASE}.clm2.r.2000-01-06-00000.nc"
+#
+# Piping stuff through 'bc' strips off any preceeding zeros.
+#-------------------------------------------------------------------------
+
+set FILE = `head -n 1 rpointer.lnd`
+set FILE = $FILE:r
+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 $LND_YEAR $LND_MONTH $LND_DAY $LND_SECONDS (seconds)"
+echo "valid time of model is $LND_YEAR $LND_MONTH $LND_DAY $LND_HOUR (hours)"
+
+#-------------------------------------------------------------------------
+# Determine if current time is an perfect model time.
+# If not, return before doing anything.
+#-------------------------------------------------------------------------
+
+## TIMECHECK:
+if ( $LND_HOUR == 0 || $LND_HOUR == 6 || $LND_HOUR == 12 || $LND_HOUR == 18 ) then
+   echo "Hour is $LND_HOUR so we are generating perfect obs for the land"
+else
+   echo "Hour is not 0,6,12 or 18Z so we are skipping generating perfect obs for the land"
+   echo "`date` -- END   GENERATE TRUE STATE"
+   exit 0
+endif
+
+# we have flux tower observations which can be processed every 6 hours,
+# but if you want to only processed at 0Z each day, change the LND_HOUR
+# check to this one:
+#    if ( $LND_HOUR == 0 ) then
+# and the message in the else clause to this:
+#       echo "Hour is not 0Z so we are skipping generating perfect obs for the land"
+
+#-------------------------------------------------------------------------
+# Create temporary working directory for the perfect model and go there
+#-------------------------------------------------------------------------
+
+set temp_dir = pmo_clm
+echo "temp_dir is $temp_dir"
+
+if ( -d $temp_dir ) then
+   ${REMOVE} $temp_dir/*
+else
+   mkdir -p $temp_dir
+endif
+cd $temp_dir
+
+#-----------------------------------------------------------------------------
+# Get observation sequence file ... or die right away.
+# The observation file names have a time that matches the stopping time of CLM.
+#
+# The CLM observations are stowed in two sets of directories.
+# If you are stopping every 24 hours or more, the obs are in directories like YYYYMM.
+# In all other situations the observations come from directories like YYYYMM_6H.
+# The only ugly part here is if the first advance and subsequent advances are
+# not the same length. The observations _may_ come from different directories.
+#
+# 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.
+#-----------------------------------------------------------------------------
+
+if ($STOP_N >= 24) then
+   set OBSDIR = `printf %04d%02d    ${LND_YEAR} ${LND_MONTH}`
+else
+   set OBSDIR = `printf %04d%02d_6H ${LND_YEAR} ${LND_MONTH}`
+endif
+
+set OBS_FILE = ${BASEOBSDIR}/${OBSDIR}/obs_seq.${LND_DATE_EXT}
+
+if (  -e   ${OBS_FILE} ) then
+   ${COPY} ${OBS_FILE} obs_seq.in
+else
+   echo "ERROR ... no observation file $OBS_FILE"
+   echo "ERROR ... no observation file $OBS_FILE"
+   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}/clm_input.nml ) then
+   ${COPY} ${CASEROOT}/clm_input.nml input.nml
+else
+   echo "ERROR ... DART required file ${CASEROOT}/clm_input.nml not found ... ERROR"
+   echo "ERROR ... DART required file ${CASEROOT}/clm_input.nml not found ... ERROR"
+   exit -2
+endif
+
+echo "`date` -- END COPY BLOCK"
+
+#=========================================================================
+# Block 2: convert 1 clm restart file to a DART initial conditions file.
+# At the end of the block, we have a DART restart file  perfect_ics
+# that came from the pointer file ../rpointer.lnd_0001
+#
+# DART namelist settings appropriate/required:
+# &perfect_model_obs_nml:  restart_in_file_name    = 'perfect_ics'
+# &clm_to_dart_nml:        clm_to_dart_output_file = 'dart_ics'
+#=========================================================================
+
+echo "`date` -- BEGIN CLM-TO-DART"
+
+set member = 1
+
+   set MYTEMPDIR = member_${member}
+   mkdir -p $MYTEMPDIR
+   cd $MYTEMPDIR
+
+   # make sure there are no old output logs hanging around
+   $REMOVE output.${member}.clm_to_dart
+
+   set  LND_RESTART_FILENAME = ${CASE}.clm2.r.${LND_DATE_EXT}.nc
+   set  LND_HISTORY_FILENAME = ${CASE}.clm2.h0.${LND_DATE_EXT}.nc
+   set OBS1_HISTORY_FILENAME = ${CASE}.clm2.h1.${LND_DATE_EXT}.nc
+   set OBS2_HISTORY_FILENAME = ${CASE}.clm2_0001.h1.${LND_DATE_EXT}.nc
+   set DART_IC_FILENAME = perfect_ics
+
+   sed -e "s/dart_ics/..\/${DART_IC_FILENAME}/" < ../input.nml >! input.nml
+
+   ${LINK} ../../$LND_RESTART_FILENAME clm_restart.nc
+   ${LINK} ../../$LND_HISTORY_FILENAME clm_history.nc
+
+   if (-e $OBS1_HISTORY_FILENAME) then
+      ${LINK} ../../$OBS1_HISTORY_FILENAME $OBS2_HISTORY_FILENAME
+   endif
+
+   # 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
+#  ncatted -O -a missing_value,frac_sno,o,d,1.0e+36   clm_restart.nc
+#  ncatted -O -a    _FillValue,DZSNO,o,d,1.0e+36      clm_restart.nc
+#  ncatted -O -a missing_value,DZSNO,o,d,1.0e+36      clm_restart.nc
+#  ncatted -O -a    _FillValue,H2OSOI_LIQ,o,d,1.0e+36 clm_restart.nc
+#  ncatted -O -a missing_value,H2OSOI_LIQ,o,d,1.0e+36 clm_restart.nc
+#  ncatted -O -a    _FillValue,H2OSOI_ICE,o,d,1.0e+36 clm_restart.nc
+#  ncatted -O -a missing_value,H2OSOI_ICE,o,d,1.0e+36 clm_restart.nc
+#  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
+
+   ${EXEROOT}/clm_to_dart >! output.${member}.clm_to_dart
+
+   if ($status != 0) then
+      echo "ERROR ... DART died in 'clm_to_dart' ... ERROR"
+      echo "ERROR ... DART died in 'clm_to_dart' ... ERROR"
+      exit -3
+   endif
+
+   cd ..
+
+echo "`date` -- END CLM-TO-DART"
+
+#=========================================================================
+# Block 3: Advance the model and harvest the synthetic observations.
+# Will result in a single file : 'perfect_restart' which we don't need
+# for a perfect model experiment with CESM.
+#
+# DART namelist settings required:
+# &perfect_model_obs_nml:           async                  = 0,
+# &perfect_model_obs_nml:           adv_ens_command        = "./no_model_advance.csh",
+# &perfect_model_obs_nml:           restart_in_file_name   = 'perfect_ics'
+# &perfect_model_obs_nml:           restart_out_file_name  = 'perfect_restart'
+# &perfect_model_obs_nml:           obs_sequence_in_name   = 'obs_seq.in'
+# &perfect_model_obs_nml:           obs_sequence_out_name  = 'obs_seq.out'
+# &perfect_model_obs_nml:           init_time_days         = -1,
+# &perfect_model_obs_nml:           init_time_seconds      = -1,
+# &perfect_model_obs_nml:           first_obs_days         = -1,
+# &perfect_model_obs_nml:           first_obs_seconds      = -1,
+# &perfect_model_obs_nml:           last_obs_days          = -1,
+# &perfect_model_obs_nml:           last_obs_seconds       = -1,
+#
+#=========================================================================
+
+# clm always needs a clm_restart.nc, clm_history.nc for geometry information, etc.
+
+set LND_RESTART_FILENAME = ${CASE}.clm2.r.${LND_DATE_EXT}.nc
+set LND_HISTORY_FILENAME = ${CASE}.clm2.h0.${LND_DATE_EXT}.nc
+
+${LINK} ../$LND_RESTART_FILENAME clm_restart.nc
+${LINK} ../$LND_HISTORY_FILENAME clm_history.nc
+
+echo "`date` -- BEGIN CLM PERFECT_MODEL_OBS"
+${EXEROOT}/perfect_model_obs_clm || exit -4
+echo "`date` -- END   CLM PERFECT_MODEL_OBS"
+
+${MOVE} True_State.nc    ../clm_True_State.${LND_DATE_EXT}.nc
+${MOVE} obs_seq.out      ../clm_obs_seq.${LND_DATE_EXT}.out
+${MOVE} dart_log.out     ../clm_dart_log.${LND_DATE_EXT}.out
+
+#=========================================================================
+# Block 4: Update the clm restart files.
+#=========================================================================
+
+# not needed ... perfect_model_obs does not update the model state.
+
+#-------------------------------------------------------------------------
+# Cleanup
+#-------------------------------------------------------------------------
+
+echo "`date` -- END   GENERATE CLM TRUE STATE"
+
+exit 0
+
+# <next few lines under version control, do not edit>
+# $URL$
+# $Revision$
+# $Date$
+


Property changes on: DART/trunk/models/CESM/shell_scripts/clm_perfect_model.csh
___________________________________________________________________
Added: svn:executable
   + *
Added: svn:mime-type
   + text/plain
Added: svn:keywords
   + Date Rev Author HeadURL Id
Added: svn:eol-style
   + native

Copied: DART/trunk/models/CESM/shell_scripts/pop_perfect_model.csh (from rev 6501, DART/trunk/models/CESM/shell_scripts/run_perfect_model_obs.csh)
===================================================================
--- DART/trunk/models/CESM/shell_scripts/pop_perfect_model.csh	                        (rev 0)
+++ DART/trunk/models/CESM/shell_scripts/pop_perfect_model.csh	2013-10-09 22:18:50 UTC (rev 6506)
@@ -0,0 +1,237 @@
+#!/bin/csh
+#
+# DART software - Copyright 2004 - 2013 UCAR. This open source software is
+# provided by UCAR, "as is", without charge, subject to all terms of use at
+# http://www.image.ucar.edu/DAReS/DART/DART_download
+#
+# DART $Id$
+
+# This block is an attempt to localize all the machine-specific
+# changes to this script such that the same script can be used
+# on multiple platforms. This will help us maintain the script.
+# Search below for TIMECHECK to see what times this script will
+# evaluate obs.
+
+echo "`date` -- BEGIN GENERATE POP TRUE STATE"
+
+set nonomatch       # suppress "rm" warnings if wildcard does not match anything
+
+# 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/WOD09
+   breaksw
+
+   case ys*:
+      # NCAR "yellowstone"
+      set   MOVE = 'mv -fv'
+      set   COPY = 'cp -fv --preserve=timestamps'
+      set   LINK = 'ln -fvs'
+      set REMOVE = 'rm -fr'
+
+      set BASEOBSDIR = /glade/p/image/Observations/WOD09
+   breaksw
+
+   default:
+      # NERSC "hopper"
+      set   MOVE = 'mv -fv'
+      set   COPY = 'cp -fv --preserve=timestamps'
+      set   LINK = 'ln -fvs'
+      set REMOVE = 'rm -fr'
+
+      set BASEOBSDIR = /scratch/scratchdirs/nscollin/ACARS
+   breaksw
+endsw
+
+#-------------------------------------------------------------------------
+# Determine time of model state ... from file name of first member
+# of the form "./${CASE}.pop.r.2000-01-06-00000.nc"
+#
+# Piping stuff through 'bc' strips off any preceeding zeros.
+#-------------------------------------------------------------------------
+
+set FILE = `head -n 1 rpointer.ocn.restart`
+set FILE = $FILE:t
+set FILE = $FILE:r
+set OCN_DATE_EXT = `echo $FILE:e`
+set OCN_DATE     = `echo $FILE:e | sed -e "s#-# #g"`
+set OCN_YEAR     = `echo $OCN_DATE[1] | bc`
+set OCN_MONTH    = `echo $OCN_DATE[2] | bc`
+set OCN_DAY      = `echo $OCN_DATE[3] | bc`
+set OCN_SECONDS  = `echo $OCN_DATE[4] | bc`
+set OCN_HOUR     = `echo $OCN_DATE[4] / 3600 | bc`
+
+echo "valid time of model is $OCN_YEAR $OCN_MONTH $OCN_DAY $OCN_SECONDS (seconds)"
+echo "valid time of model is $OCN_YEAR $OCN_MONTH $OCN_DAY $OCN_HOUR (hours)"
+
+#-------------------------------------------------------------------------
+# Determine if current time is 0Z - if so, generate perfect obs.
+# If not, return before doing anything.
+#-------------------------------------------------------------------------
+
+## TIMECHECK:
+if ( $OCN_HOUR == 0 ) then
+   echo "Hour is $OCN_HOUR so we are generating perfect obs for the ocean"
+else
+   echo "Hour is not 0Z so we are skipping generating perfect obs for the ocean"
+   echo "`date` -- END   GENERATE TRUE STATE"
+   exit 0
+endif
+
+#-------------------------------------------------------------------------
+# Create temporary working directory for the perfect model and go there
+#-------------------------------------------------------------------------
+
+set temp_dir = pmo_pop
+echo "temp_dir is $temp_dir"
+
+if ( -d $temp_dir ) then
+   ${REMOVE} $temp_dir/*
+else
+   mkdir -p $temp_dir
+endif
+cd $temp_dir
+
+#-----------------------------------------------------------------------------
+# Get observation sequence file ... or die right away.
+# 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 OBS_FILE = ${BASEOBSDIR}/${YYYYMM}/${OBSFNAME}
+
+if (  -e   ${OBS_FILE} ) then
+   ${COPY} ${OBS_FILE} obs_seq.in
+else
+   echo "ERROR ... no observation file $OBS_FILE"
+   echo "ERROR ... no observation file $OBS_FILE"
+   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 -2
+endif
+
+echo "`date` -- END COPY BLOCK"
+
+# Eat the cookie regardless
+${REMOVE} ../pop_inflation_cookie
+
+#=========================================================================
+# Block 2: convert 1 pop restart file to a DART initial conditions file.
+# At the end of the block, we have a DART restart file  perfect_ics
+# that came from the pointer file ../rpointer.ocn.restart
+#
+# DART namelist settings appropriate/required:
+# &perfect_model_obs_nml:  restart_in_file_name    = 'perfect_ics'
+# &pop_to_dart_nml:        pop_to_dart_output_file = 'dart_ics'
+#=========================================================================
+
+echo "`date` -- BEGIN POP-TO-DART"
+
+set member = 1
+
+   set MYTEMPDIR = member_${member}
+   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 = ${CASE}.pop.r.${OCN_DATE_EXT}.nc
+   set     OCN_NML_FILENAME = pop2_in
+   set     DART_IC_FILENAME = perfect_ics
+   set    DART_RESTART_FILE = perfect_restart
+
+   sed -e "s#dart_ics#../${DART_IC_FILENAME}#" \
+       -e "s#dart_restart#../${DART_RESTART_FILE}#" < ../input.nml >! input.nml
+
+   ${LINK} ../../$OCN_RESTART_FILENAME pop.r.nc
+   ${LINK} ../../$OCN_NML_FILENAME     pop_in
+
+   ${EXEROOT}/pop_to_dart >! output.${member}.pop_to_dart
+
+   if ($status != 0) then
+      echo "ERROR ... DART died in 'pop_to_dart' ... ERROR"
+      echo "ERROR ... DART died in 'pop_to_dart' ... ERROR"
+      exit -3
+   endif
+
+   cd ..
+
+echo "`date` -- END POP-TO-DART"
+
+#=========================================================================
+# Block 3: Advance the model and harvest the synthetic observations.
+# Will result in a single file : 'perfect_restart' which we don't need
+# for a perfect model experiment with CESM.
+#
+# DART namelist settings required:
+# &perfect_model_obs_nml:           async                  = 0,
+# &perfect_model_obs_nml:           adv_ens_command        = "./no_model_advance.csh",
+# &perfect_model_obs_nml:           restart_in_file_name   = 'perfect_ics'
+# &perfect_model_obs_nml:           restart_out_file_name  = 'perfect_restart'
+# &perfect_model_obs_nml:           obs_sequence_in_name   = 'obs_seq.in'
+# &perfect_model_obs_nml:           obs_sequence_out_name  = 'obs_seq.out'
+# &perfect_model_obs_nml:           init_time_days         = -1,
+# &perfect_model_obs_nml:           init_time_seconds      = -1,
+# &perfect_model_obs_nml:           first_obs_days         = -1,
+# &perfect_model_obs_nml:           first_obs_seconds      = -1,
+# &perfect_model_obs_nml:           last_obs_days          = -1,
+# &perfect_model_obs_nml:           last_obs_seconds       = -1,
+#
+#=========================================================================
+
+# POP always needs a pop_in and a pop.r.nc to start.
+
+set OCN_RESTART_FILENAME = ${CASE}.pop.r.${OCN_DATE_EXT}.nc
+
+${LINK} ../$OCN_RESTART_FILENAME pop.r.nc
+${LINK} ../pop2_in               pop_in
+
+echo "`date` -- BEGIN PERFECT_MODEL_OBS"
+${EXEROOT}/perfect_model_obs || exit -4
+echo "`date` -- END   PERFECT_MODEL_OBS"
+
+${MOVE} True_State.nc    ../pop_True_State.${OCN_DATE_EXT}.nc
+${MOVE} obs_seq.out      ../pop_obs_seq.${OCN_DATE_EXT}.out
+${MOVE} dart_log.out     ../pop_dart_log.${OCN_DATE_EXT}.out
+
+#=========================================================================
+# Block 4: Update the pop restart files.
+#=========================================================================
+
+# not needed ... perfect_model_obs does not update the model state.
+
+#-------------------------------------------------------------------------
+# Cleanup
+#-------------------------------------------------------------------------
+
+echo "`date` -- END   GENERATE POP TRUE STATE"
+
+exit 0
+
+# <next few lines under version control, do not edit>
+# $URL$
+# $Revision$
+# $Date$
+


More information about the Dart-dev mailing list