[Dart-dev] [6478] DART/trunk/models/clm: Minor revisions/ spelling changes to make more consistent across CESM model

nancy at ucar.edu nancy at ucar.edu
Tue Sep 17 09:09:44 MDT 2013


Revision: 6478
Author:   thoar
Date:     2013-09-17 09:09:43 -0600 (Tue, 17 Sep 2013)
Log Message:
-----------
Minor revisions/spelling changes to make more consistent across CESM model
components. The make* scripts are fundamentally new, however, and require
a work/input.nml.template file.

Modified Paths:
--------------
    DART/trunk/models/clm/model_mod.f90
    DART/trunk/models/clm/shell_scripts/CESM1_1_1_hybrid_initial
    DART/trunk/models/clm/shell_scripts/CESM1_1_1_pmo_setup
    DART/trunk/models/clm/shell_scripts/CESM_DART_config
    DART/trunk/models/clm/shell_scripts/makedaily.sh

Added Paths:
-----------
    DART/trunk/models/clm/shell_scripts/make6h.sh
    DART/trunk/models/clm/work/input.nml.template

-------------- next part --------------
Modified: DART/trunk/models/clm/model_mod.f90
===================================================================
--- DART/trunk/models/clm/model_mod.f90	2013-09-13 22:24:10 UTC (rev 6477)
+++ DART/trunk/models/clm/model_mod.f90	2013-09-17 15:09:43 UTC (rev 6478)
@@ -2328,7 +2328,7 @@
 
 subroutine get_grid_vertval(x, location, varstring, interp_val, istatus)
 !
-! Calculate the expected vertical value fort the gridcell.
+! Calculate the expected vertical value for the gridcell.
 ! Each gridcell value is an area-weighted value of an unknown number of
 ! column-based quantities.
 

Modified: DART/trunk/models/clm/shell_scripts/CESM1_1_1_hybrid_initial
===================================================================
--- DART/trunk/models/clm/shell_scripts/CESM1_1_1_hybrid_initial	2013-09-13 22:24:10 UTC (rev 6477)
+++ DART/trunk/models/clm/shell_scripts/CESM1_1_1_hybrid_initial	2013-09-17 15:09:43 UTC (rev 6478)
@@ -196,7 +196,7 @@
 
 setenv ACCOUNT      P8685xxxx
 setenv queue        economy
-setenv timewall     1:00
+setenv timewall     0:30
 
 # ==============================================================================
 # set these standard commands based on the machine you are running on.
@@ -293,7 +293,7 @@
 else
    echo "WARNING: the script to configure for data assimilation is not available."
    echo "         CESM_DART_config should be present locally or in"
-   echo "         ${dartroot}/models/CESM/shell_scripts/"
+   echo "         ${dartroot}/models/clm/shell_scripts/"
    echo "         You can stage this script later, but you must manually edit it"
    echo "         to reflect the location of the DART code tree."
 endif
@@ -316,7 +316,7 @@
    endif
 end
 
-if ( $num_instances < 10) then
+if ($num_instances < 10) then
 
    # This is only for the purpose of debugging the code.
    @ atm_tasks = $ptile * $num_instances * 4
@@ -343,13 +343,13 @@
 # echo "task partitioning ... perhaps ... atm // ocn // lnd+ice+glc+rof"
 # presently, all components run 'serially' - one after another.
 echo ""
-echo "ATM  gets $atm_tasks"
-echo "LND  gets $lnd_tasks"
-echo "ICE  gets $ice_tasks"
-echo "OCN  gets $ocn_tasks"
-echo "CPL  gets $cpl_tasks"
-echo "GLC  gets $glc_tasks"
-echo "ROF  gets $rof_tasks"
+echo "ATM gets $atm_tasks"
+echo "LND gets $lnd_tasks"
+echo "ICE gets $ice_tasks"
+echo "OCN gets $ocn_tasks"
+echo "CPL gets $cpl_tasks"
+echo "GLC gets $glc_tasks"
+echo "ROF gets $rof_tasks"
 echo ""
 
 ./xmlchange NTHRDS_ATM=$nthreads,NTASKS_ATM=$atm_tasks,NINST_ATM=$num_instances
@@ -543,24 +543,24 @@
 while ($inst <= $num_instances)
 
    # following the CESM strategy for 'inst_string'
-   set inst_string  = `printf _%04d $inst`
+   set inst_string = `printf _%04d $inst`
 
    # ===========================================================================
    set fname = "user_nl_datm${inst_string}"
    # ===========================================================================
 
-   echo "dtlimit = 1.5, 1.5, 1.5"                    >> $fname
-   echo "fillalgo = 'nn', 'nn', 'nn'"                >> $fname
-   echo "fillmask = 'nomask','nomask','nomask'"      >> $fname
-   echo "mapalgo = 'bilinear','bilinear','bilinear'" >> $fname
-   echo "mapmask = 'nomask','nomask','nomask'"       >> $fname
-   echo "streams = 'datm.streams.txt.CPLHIST3HrWx.Solar$inst_string             $stream_year_align $stream_year_first $stream_year_last'," >> $fname
-   echo "          'datm.streams.txt.CPLHIST3HrWx.Precip$inst_string            $stream_year_align $stream_year_first $stream_year_last'," >> $fname
-   echo "          'datm.streams.txt.CPLHIST3HrWx.nonSolarNonPrecip$inst_string $stream_year_align $stream_year_first $stream_year_last'"  >> $fname
-   echo "taxmode = 'cycle','cycle','cycle'"          >> $fname
-   echo "tintalgo = 'coszen','nearest','linear'"     >> $fname
-   echo "restfils = 'unset'"                         >> $fname
-   echo "restfilm = 'unset'"                         >> $fname
+   echo "dtlimit  = 1.5, 1.5, 1.5"                    >> $fname
+   echo "fillalgo = 'nn', 'nn', 'nn'"                 >> $fname
+   echo "fillmask = 'nomask','nomask','nomask'"       >> $fname
+   echo "mapalgo  = 'bilinear','bilinear','bilinear'" >> $fname
+   echo "mapmask  = 'nomask','nomask','nomask'"       >> $fname
+   echo "streams  = 'datm.streams.txt.CPLHIST3HrWx.Solar$inst_string             $stream_year_align $stream_year_first $stream_year_last'," >> $fname
+   echo "           'datm.streams.txt.CPLHIST3HrWx.Precip$inst_string            $stream_year_align $stream_year_first $stream_year_last'," >> $fname
+   echo "           'datm.streams.txt.CPLHIST3HrWx.nonSolarNonPrecip$inst_string $stream_year_align $stream_year_first $stream_year_last'"  >> $fname
+   echo "taxmode  = 'cycle','cycle','cycle'"          >> $fname
+   echo "tintalgo = 'coszen','nearest','linear'"      >> $fname
+   echo "restfils = 'unset'"                          >> $fname
+   echo "restfilm = 'unset'"                          >> $fname
 
    # ===========================================================================
    set fname = "user_nl_clm${inst_string}"
@@ -613,10 +613,19 @@
 # "To modify the contents of a stream txt file, first use preview_namelists to
 #  obtain the contents of the stream txt files in CaseDocs, and then place a copy
 #  of the modified stream txt file in $CASEROOT with the string user_ prepended."
+#
+# -or-
+#
+# we copy a template stream txt file from the
+# $dartroot/models/clm/shell_scripts directory and modify one for each instance.
+#
 # ==============================================================================
 
 ./preview_namelists
 
+# This gives us a stream txt file for each instance that we can
+# modify for our own purpose.
+
 foreach FILE (CaseDocs/*streams*)
    set FNAME = $FILE:t
 
@@ -635,7 +644,7 @@
 
 end
 
-# Replace each default stream txt file with one that uses the CLM DATM
+# Replace each default stream txt file with one that uses the CAM DATM
 # conditions for a default year and modify the instance number.
 
 foreach FNAME (user*streams*)
@@ -643,7 +652,7 @@
    @ instance_index = $#name_parse
    @ filename_index = $#name_parse - 1
    set streamname = $name_parse[$filename_index]
-   set instance   = $name_parse[$instance_index]
+   set   instance = $name_parse[$instance_index]
 
    if (-e $dartroot/models/clm/shell_scripts/user_$streamname*template) then
 
@@ -734,7 +743,8 @@
 echo '   #BSUB -R "select[scratch_ok > 0]"'
 echo "   around line 9, delete it."
 echo ""
-echo "3) configure and execute the ${caseroot}/CESM_DART_config script."
+echo "3) If you want to assimilate 'right away', configure and execute"
+echo "   the ${caseroot}/CESM_DART_config script."
 echo ""
 echo "3) Verify the contents of env_run.xml and submit the CESM job:"
 echo "   ./${case}.submit"
@@ -746,9 +756,9 @@
 echo "5) To extend the run in $assim_n '"$stop_option"' steps,"
 echo "   change the env_run.xml variables:"
 echo ""
-echo "  ./xmlchange CONTINUE_RUN=TRUE"
-echo "  ./xmlchange RESUBMIT=<number_of_cycles_to_run>"
-echo "  ./xmlchange STOP_N=$assim_n"
+echo "   ./xmlchange CONTINUE_RUN=TRUE"
+echo "   ./xmlchange RESUBMIT=<number_of_cycles_to_run>"
+echo "   ./xmlchange STOP_N=$assim_n"
 echo ""
 
 exit 0

Modified: DART/trunk/models/clm/shell_scripts/CESM1_1_1_pmo_setup
===================================================================
--- DART/trunk/models/clm/shell_scripts/CESM1_1_1_pmo_setup	2013-09-13 22:24:10 UTC (rev 6477)
+++ DART/trunk/models/clm/shell_scripts/CESM1_1_1_pmo_setup	2013-09-17 15:09:43 UTC (rev 6478)
@@ -303,7 +303,7 @@
 else
    echo "WARNING: the script to configure for data assimilation is not available."
    echo "         CESM_DART_config should be present locally or in"
-   echo "         ${dartroot}/models/CESM/shell_scripts/"
+   echo "         ${dartroot}/models/clm/shell_scripts/"
    echo "         You can stage this script later, but you must manually edit it"
    echo "         to reflect the location of the DART code tree."
 endif
@@ -338,13 +338,13 @@
 # echo "task partitioning ... perhaps ... atm // ocn // lnd+ice+glc+rof"
 # presently, all components run 'serially' - one after another.
 echo ""
-echo "ATM  gets $atm_tasks"
-echo "LND  gets $lnd_tasks"
-echo "ICE  gets $ice_tasks"
-echo "OCN  gets $ocn_tasks"
-echo "CPL  gets $cpl_tasks"
-echo "GLC  gets $glc_tasks"
-echo "ROF  gets $rof_tasks"
+echo "ATM gets $atm_tasks"
+echo "LND gets $lnd_tasks"
+echo "ICE gets $ice_tasks"
+echo "OCN gets $ocn_tasks"
+echo "CPL gets $cpl_tasks"
+echo "GLC gets $glc_tasks"
+echo "ROF gets $rof_tasks"
 echo ""
 
 ./xmlchange NTHRDS_ATM=$nthreads,NTASKS_ATM=$atm_tasks,NINST_ATM=1
@@ -544,18 +544,18 @@
    set fname = "user_nl_datm${inst_string}"
    # ===========================================================================
 
-   echo "dtlimit = 1.5, 1.5, 1.5"                    >> $fname
-   echo "fillalgo = 'nn', 'nn', 'nn'"                >> $fname
-   echo "fillmask = 'nomask','nomask','nomask'"      >> $fname
-   echo "mapalgo = 'bilinear','bilinear','bilinear'" >> $fname
-   echo "mapmask = 'nomask','nomask','nomask'"       >> $fname
-   echo "streams = 'datm.streams.txt.CPLHIST3HrWx.Solar$inst_string             $stream_year_align $stream_year_first $stream_year_last'," >> $fname
-   echo "          'datm.streams.txt.CPLHIST3HrWx.Precip$inst_string            $stream_year_align $stream_year_first $stream_year_last'," >> $fname
-   echo "          'datm.streams.txt.CPLHIST3HrWx.nonSolarNonPrecip$inst_string $stream_year_align $stream_year_first $stream_year_last'"  >> $fname
-   echo "taxmode = 'cycle','cycle','cycle'"          >> $fname
-   echo "tintalgo = 'coszen','nearest','linear'"     >> $fname
-   echo "restfils = 'unset'"                         >> $fname
-   echo "restfilm = 'unset'"                         >> $fname
+   echo "dtlimit  = 1.5, 1.5, 1.5"                    >> $fname
+   echo "fillalgo = 'nn', 'nn', 'nn'"                 >> $fname
+   echo "fillmask = 'nomask','nomask','nomask'"       >> $fname
+   echo "mapalgo  = 'bilinear','bilinear','bilinear'" >> $fname
+   echo "mapmask  = 'nomask','nomask','nomask'"       >> $fname
+   echo "streams  = 'datm.streams.txt.CPLHIST3HrWx.Solar$inst_string             $stream_year_align $stream_year_first $stream_year_last'," >> $fname
+   echo "           'datm.streams.txt.CPLHIST3HrWx.Precip$inst_string            $stream_year_align $stream_year_first $stream_year_last'," >> $fname
+   echo "           'datm.streams.txt.CPLHIST3HrWx.nonSolarNonPrecip$inst_string $stream_year_align $stream_year_first $stream_year_last'"  >> $fname
+   echo "taxmode  = 'cycle','cycle','cycle'"          >> $fname
+   echo "tintalgo = 'coszen','nearest','linear'"      >> $fname
+   echo "restfils = 'unset'"                          >> $fname
+   echo "restfilm = 'unset'"                          >> $fname
 
    # ===========================================================================
    set fname = "user_nl_clm${inst_string}"
@@ -608,10 +608,19 @@
 # "To modify the contents of a stream txt file, first use preview_namelists to
 #  obtain the contents of the stream txt files in CaseDocs, and then place a copy
 #  of the modified stream txt file in $CASEROOT with the string user_ prepended."
+#
+# -or-
+#
+# we copy a template stream txt file from the
+# $dartroot/models/clm/shell_scripts directory and modify one for each instance.
+#
 # ==============================================================================
 
 ./preview_namelists
 
+# This gives us a stream txt file for each instance that we can
+# modify for our own purpose.
+
 foreach FILE (CaseDocs/*streams*)
    set FNAME = $FILE:t
 
@@ -630,7 +639,7 @@
 
 end
 
-# Replace each default stream txt file with one that uses the CLM DATM
+# Replace each default stream txt file with one that uses the CAM DATM
 # conditions for a default year and modify the instance number.
 # In a PMO setting, the stream text file 'instance' must refer to an
 # existing instance in the set of available forcing files.
@@ -641,7 +650,7 @@
    set name_parse = `echo $FNAME | sed 's/\_/ /g'`
    @ filename_index = $#name_parse
    set streamname = $name_parse[$filename_index]
-   set instance   = `printf %04d $TRUTHinstance`
+   set   instance = `printf %04d $TRUTHinstance`
 
    if (-e $dartroot/models/clm/shell_scripts/user_$streamname*template) then
 
@@ -732,7 +741,8 @@
 echo '   #BSUB -R "select[scratch_ok > 0]"'
 echo "   around line 9, delete it."
 echo ""
-echo "3) configure and execute the ${caseroot}/CESM_DART_config script."
+echo "3) If you want to create 'perfect obs' 'right away', configure and execute"
+echo "   the ${caseroot}/CESM_DART_config script."
 echo ""
 echo "3) Verify the contents of env_run.xml and submit the CESM job:"
 echo "   ./${case}.submit"
@@ -744,9 +754,9 @@
 echo "5) To extend the run in $assim_n '"$stop_option"' steps,"
 echo "   change the env_run.xml variables:"
 echo ""
-echo "  ./xmlchange CONTINUE_RUN=TRUE"
-echo "  ./xmlchange RESUBMIT=<number_of_cycles_to_run>"
-echo "  ./xmlchange STOP_N=$assim_n"
+echo "   ./xmlchange CONTINUE_RUN=TRUE"
+echo "   ./xmlchange RESUBMIT=<number_of_cycles_to_run>"
+echo "   ./xmlchange STOP_N=$assim_n"
 echo ""
 
 exit 0

Modified: DART/trunk/models/clm/shell_scripts/CESM_DART_config
===================================================================
--- DART/trunk/models/clm/shell_scripts/CESM_DART_config	2013-09-13 22:24:10 UTC (rev 6477)
+++ DART/trunk/models/clm/shell_scripts/CESM_DART_config	2013-09-17 15:09:43 UTC (rev 6478)
@@ -174,7 +174,7 @@
 # The first time this is executed, the update namlist script does not exist.
 
 if [[ -x update_dart_namelists ]]; then
-  ./update_dart_namelists
+       ./update_dart_namelists
 fi
 
 exit 0

Added: DART/trunk/models/clm/shell_scripts/make6h.sh
===================================================================
--- DART/trunk/models/clm/shell_scripts/make6h.sh	                        (rev 0)
+++ DART/trunk/models/clm/shell_scripts/make6h.sh	2013-09-17 15:09:43 UTC (rev 6478)
@@ -0,0 +1,176 @@
+#!/bin/bash
+#
+# This version splits files into chunks that are compatible with the
+# Flux Tower forward operator, which relies on using the CLM *.h1.* 
+# history file with timestamps that do not actually include the time
+# used in the filename.  
+# 
+
+# 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
+# http://www.image.ucar.edu/DAReS/DART/DART_download
+#
+# $Id$
+
+# set the first and last days to be split.  can roll over
+# month and year boundaries now! note that for the last day
+# the data from the following day must be available.
+
+start_year=2004
+start_month=1
+start_day=1
+
+end_year=2004
+end_month=1
+end_day=2
+
+# end of things you should have to set in this script
+
+# convert the start and stop times to DART days/seconds, so we can
+# compute total number of days including rolling over month and
+# year boundaries.
+# are < 10.  do the end time first so we can use the same values
+# to set the initial day while we are doing the total day calc.
+
+# make sure there is an initial input.nml for advance_time
+cp -f ../work/input.nml.template input.nml || exit -1
+
+# advance_time (with the -g flag) outputs 2 integers:
+# days seconds
+year1=`echo  $start_year  | bc`
+month1=`echo $start_month | bc`
+day1=`echo   $start_day   | bc`
+dart_1=`printf %04d%02d%02d%02d $year1 $month1 $day1 0`
+
+year2=`echo  $end_year  | bc`
+month2=`echo $end_month | bc`
+day2=`echo   $end_day   | bc`
+dart_N=`printf %04d%02d%02d%02d $year2 $month2 $day2 0`
+
+T1=(`echo ${dart_1} -6h -g | ../work/advance_time`)
+TN=(`echo ${dart_N}  0  -g | ../work/advance_time`)
+
+echo "start of period of interest is $dart_1 and ${T1[0]} ${T1[1]}"
+echo "end   of period of interest is $dart_N and ${TN[0]} ${TN[1]}"
+
+# how many total days are going to be split (for the loop counter)
+# and we are going to make 4 files per day, so times 4.  if we change
+# the increment (6h currently) the multiple will have to change as well.
+let totaldays=${TN[0]}-${T1[0]}+1
+let totaltimes=${totaldays}*4
+
+# these are a string in the format YYYYMMDDHH
+# do them here to prime the loop below which first takes them apart.
+prevtime=(`echo ${dart_1} -6h | ../work/advance_time`)
+middtime=(`echo ${dart_1}   0 | ../work/advance_time`)
+nexttime=(`echo ${dart_1}   0 | ../work/advance_time`)
+
+# loop over each new output file.
+
+let itime=1
+while ((itime <= totaltimes)) ; do
+
+   echo ''
+   # The FluxTower observations are one-sided ...
+   # 6 hours before the time of the filename.
+
+   # parse out the parts from a string which is YYYYMMDDHH
+   # both for the current time, the end time, and the middle of
+   # the interval (the middle is for the filename; the others
+   # for the obs time limits.)
+
+    pyear=${prevtime:0:4}
+   pmonth=${prevtime:4:2}
+     pday=${prevtime:6:2}
+    phour=${prevtime:8:2}
+
+    myear=${middtime:0:4}
+   mmonth=${middtime:4:2}
+     mday=${middtime:6:2}
+    mhour=${middtime:8:2}
+
+    nyear=${nexttime:0:4}
+   nmonth=${nexttime:4:2}
+     nday=${nexttime:6:2}
+    nhour=${nexttime:8:2}
+
+   # echo prev $pyear $pmonth $pday $phour
+   # echo midd $myear $mmonth $mday $mhour
+   # echo next $nyear $nmonth $nday $nhour
+
+   # Create the file containing the input observation sequences.
+   # The input.nml.template explicitly references this file.
+   # The input observation sequences generally live in directories
+   # with names YYYYMM. FIXME ... year boundaries ...
+
+   echo "/glade/p/image/Observations/FluxTower/obs_seq.USBar.2004" >  olist
+   echo "/glade/p/image/Observations/FluxTower/obs_seq.USHa1.2004" >> olist
+   echo "/glade/p/image/Observations/FluxTower/obs_seq.USNR1.2004" >> olist
+   echo "/glade/p/image/Observations/FluxTower/obs_seq.USSP3.2004" >> olist
+   echo "/glade/p/image/Observations/FluxTower/obs_seq.USSRM.2004" >> olist
+   echo "/glade/p/image/Observations/FluxTower/obs_seq.USWcr.2004" >> olist
+   echo "/glade/p/image/Observations/FluxTower/obs_seq.USWrc.2004" >> olist
+
+   # compute the equivalent DART days here for the current time
+   # plus 1 second (the interval start) and the end time.
+
+   g=(`echo ${myear}${mmonth}${mday}${mhour} -6h -g | ../work/advance_time`)
+   dart1d=${g[0]}
+   darts1=${g[1]}
+   let dart1s=${darts1}+1
+
+   g=(`echo ${myear}${mmonth}${mday}${mhour}   0 -g | ../work/advance_time`)
+   dartMd=${g[0]}
+   dartMs=`printf %05d ${g[1]}`
+
+   g=(`echo ${myear}${mmonth}${mday}${mhour}   0 -g | ../work/advance_time`)
+   dartNd=${g[0]}
+   dartNs=`printf %05d ${g[1]}`
+
+   echo prev $pyear $pmonth $pday $phour which is dart $dart1d $dart1s
+   echo midd $myear $mmonth $mday $mhour which is dart $dartMd $dartMs
+   echo next $nyear $nmonth $nday $nhour which is dart $dartNd $dartNs
+
+   echo "starting    time" ${pyear}${pmonth}${pday}${phour} plus 1 sec
+   echo "output      file" ${myear}${mmonth}${mday}${mhour}
+   echo "ending      time" ${nyear}${nmonth}${nday}${nhour}
+
+   # make sure output dir exists
+   OUTDIR=../${myear}${mmonth}_6H
+   if [[ ! -d ${OUTDIR} ]] ; then
+        mkdir ${OUTDIR}
+   fi
+
+   sed -e "s#OUTDIR#${OUTDIR}#g" \
+   sed -e "s#YYYY#${myear}#g"    \
+       -e "s#MM#${mmonth}#g"     \
+       -e "s#DD#${mday}#g"       \
+       -e "s#SSSSS#${dartMs}#g"  \
+       -e "s#DART1D#${dart1d}#g" \
+       -e "s#DART1S#${dart1s}#g" \
+       -e "s#DARTND#${dartNd}#g" \
+       -e "s#DARTNS#${dartNs}#g" < ../work/input.nml.template > input.nml
+
+   # do the extract here
+   #echo calling ./obs_sequence_tool here
+   ../work/obs_sequence_tool
+
+   # advance 6 hours; the output is YYYYMMDDHH
+   prevtime=(`echo ${pyear}${pmonth}${pday}${phour} +6h | ../work/advance_time`)
+   middtime=(`echo ${myear}${mmonth}${mday}${mhour} +6h | ../work/advance_time`)
+   nexttime=(`echo ${nyear}${nmonth}${nday}${nhour} +6h | ../work/advance_time`)
+   echo $prevtime $middtime $nexttime
+
+   # advance the loop counter
+   let itime=itime+1
+   echo "itime = $itime"
+
+done
+
+exit 0
+
+# <next few lines under version control, do not edit>
+# $URL$
+# $Revision$
+# $Date$
+


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

Modified: DART/trunk/models/clm/shell_scripts/makedaily.sh
===================================================================
--- DART/trunk/models/clm/shell_scripts/makedaily.sh	2013-09-13 22:24:10 UTC (rev 6477)
+++ DART/trunk/models/clm/shell_scripts/makedaily.sh	2013-09-17 15:09:43 UTC (rev 6478)
@@ -1,5 +1,4 @@
 #!/bin/bash
-# BLUEFIRE /usr/local/bin/bash
 #
 # 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
@@ -11,114 +10,159 @@
 # the previous day and end at 23:59Z on the day that matches the
 # day in the filename.
 
-# set the first and last days to be split.  can roll over
-# month and year boundaries now!   note that for the first day
-# the data from the previous day must be available.
+# set the first and last days to be split.
+# depending on the window and the input file, 
+# the data from outside these bounds may be needed.
 
-let start_year=2000
+let start_year=2004
 let start_month=01
 let start_day=01
 
-let end_year=2000
+let end_year=2004
 let end_month=12
 let end_day=31
 
-# end of things you should have to set in this script
+# end of things you should have to set in this script IFF you are
+# content to have 'daily' files with observations +/- 12 hours from
+# date in the filename.
 
-# convert the start and stop times to gregorian days, so we can
-# compute total number of days including rolling over month and
-# year boundaries.  make sure all values have leading 0s if they
-# are < 10.  do the end time first so we can use the same values
-# to set the initial day while we are doing the total day calc.
+# ----------------------------------------------------------------------------- 
+# convert the start and stop times to gregorian days, so we can compute
+# total number of days including rolling over month and year boundaries.
+# do the end time first so we can use the same values to set the 
+# initial day while we are doing the total day calculation.
 
+# bc strips off any preceeding zeros to prevent interpretation as octal.
+year1=`echo  $start_year  | bc`
+month1=`echo $start_month | bc`
+day1=`echo   $start_day   | bc`
+dart_1=`printf %04d%02d%02d%02d $year1 $month1 $day1 0`
+
+year2=`echo  $end_year  | bc`
+month2=`echo $end_month | bc`
+day2=`echo   $end_day   | bc`
+dart_N=`printf %04d%02d%02d%02d $year2 $month2 $day2 0`
+
 # make sure there is an initial input.nml for advance_time
-cp -f ../work/input.nml.template input.nml || exit 1
+# input.nml gets overwritten in the subsequent loop.
+cp -f  ../work/input.nml.template input.nml || exit -1
+ln -sf ../work/clm_history.nc             . || exit -2
+ln -sf ../work/clm_restart.nc             . || exit -3
 
-# these outputs from advance time (with the -g flag) are
-# 2 integers: gregorian_day_number seconds
-# and since we don't set hours, minutes, or seconds, the second
-# number is always 0 and uninteresting for us.
-mon2=`printf %02d $end_month`
-day2=`printf %02d $end_day`
+# these outputs from advance time (with the -g flag) are 2 integers:
+# gregorian_day_number seconds
+# since we are concerned with daily files at 00Z, 
+# we can hardwire hours, minutes, and seconds
+mon2=`printf %02d $month2`
+day2=`printf %02d $day2`
 end_d=(`echo ${end_year}${mon2}${day2}00 0 -g | ../work/advance_time`)
- echo last day is day $end_d
+echo "last  day,seconds is day ${end_d[0]} ${end_d[1]}"
 
-mon2=`printf %02d $start_month`
-day2=`printf %02d $start_day`
+mon2=`printf %02d $month1`
+day2=`printf %02d $day1`
 start_d=(`echo ${start_year}${mon2}${day2}00 0 -g | ../work/advance_time`)
- echo first day is day $start_d
+echo "first day,seconds is day ${start_d[0]} ${start_d[1]}"
 
-# these are a string in the format YYYYMMDDHH
-# do them here to prime the loop below which first takes them apart.
-prevday=(`echo ${start_year}${mon2}${day2}00 -1d | ../work/advance_time`)
-currday=(`echo ${start_year}${mon2}${day2}00   0 | ../work/advance_time`)
-nextday=(`echo ${start_year}${mon2}${day2}00 +1d | ../work/advance_time`)
-
 # how many total days are going to be split (for the loop counter)
-# (pull out the first of the 2 numbers which are output from advance_time)
-let totaldays=${end_d}-${start_d}+1
+let totaldays=${end_d[0]}-${start_d[0]}+1
 
+# ----------------------------------------------------------------------------- 
+# form some strings for logging.
+# time_one    .... the first time in the file
+# time_end    .... the last  time in the file
+# filetime    .... the time in the file NAME ... usually the center.
+# with no -g option advance_time returns strings in the format YYYYMMDDHH
+
+time_one=(`echo ${start_year}${mon2}${day2}00 -1d | ../work/advance_time`)
+time_end=(`echo ${start_year}${mon2}${day2}00 -1s | ../work/advance_time`)
+filetime=(`echo ${start_year}${mon2}${day2}00   0 | ../work/advance_time`)
+
 # loop over each day
 let d=1
 while (( d <= totaldays)) ; do
 
-  echo "subsetting $d of $totaldays ..."
-  #echo $currday $nextday
+   echo "subsetting $d of $totaldays ..."
+   #echo $filetime $time_end
 
-  # parse out the parts from a string which is YYYYMMDDHH
-  # for yesterday(previous), today(current), and tomorrow(next)
-  pyear=${prevday:0:4}
-  pmonth=${prevday:4:2}
-  pday=${prevday:6:2}
+   # string for first time in the file
+    pyear=${time_one:0:4}
+   pmonth=${time_one:4:2}
+     pday=${time_one:6:2}
+    phour=${time_one:8:2}
 
-  cyear=${currday:0:4}
-  cmonth=${currday:4:2}
-  cday=${currday:6:2}
+   # string for last time in the file
+    nyear=${time_end:0:4}
+   nmonth=${time_end:4:2}
+     nday=${time_end:6:2}
+    nhour=${time_end:8:2}
 
-  nyear=${nextday:0:4}
-  nmonth=${nextday:4:2}
-  nday=${nextday:6:2}
+   # string for time for the file NAME
+    fyear=${filetime:0:4}
+   fmonth=${filetime:4:2}
+     fday=${filetime:6:2}
+    fhour=${filetime:8:2}
 
-  # compute the equivalent gregorian days here.
-  g=(`echo ${cyear}${cmonth}${cday}00 -1d -g | ../work/advance_time`)
-  greg0=${g[0]}
-  g=(`echo ${cyear}${cmonth}${cday}00   0 -g | ../work/advance_time`)
-  greg1=${g[0]}
-  g=(`echo ${cyear}${cmonth}${cday}00 +1d -g | ../work/advance_time`)
-  greg2=${g[0]}
+   # compute the equivalent DART timestamps here - seconds and days.
+   g=(`echo ${fyear}${fmonth}${fday}${fhour} -1d -g | ../work/advance_time`)
+   dart1d=${g[0]}
+   darts1=${g[1]}
+#  dart1s=${darts1}+1     for non-flux tower observations
+   dart1s=${darts1}
 
-  echo prev $pyear $pmonth $pday which is gregorian $greg0
-  echo curr $cyear $cmonth $cday which is gregorian $greg1
-  echo next $nyear $nmonth $nday which is gregorian $greg2
+   # flux tower observations do not actually contain the time in the file name.
+   g=(`echo ${fyear}${fmonth}${fday}${fhour} -1s -g | ../work/advance_time`)
+   dartNd=${g[0]}
+   dartNs=${g[1]}
 
-  # I have annual files  ...
-  # I'll need to revisit this when I wrap over year boundaries ... TJH
+   g=(`echo ${fyear}${fmonth}${fday}${fhour}   0 -g | ../work/advance_time`)
+   dartFd=${g[0]}
+   dartFs=${g[1]}
 
-  sed -e "s/YYYY/${cyear}/g"    \
-      -e "s/MM/${cmonth}/g"     \
-      -e "s/PP/${pmonth}/g"     \
-      -e "s/DD/${cday}/g"       \
-      -e "s/GREG0/${greg0}/g"  \
-      -e "s/GREG1/${greg1}/g"  \
-      -e "s/GREG2/${greg2}/g"    < ../work/input.nml.template > input.nml
+   echo "first $pyear $pmonth $pday $phour which is dart $dart1d $dart1s"
+   echo "last  $nyear $nmonth $nday $nhour which is dart $dartNd $dartNs"
+   echo "file  $fyear $fmonth $fday $fhour which is dart $dartFd $dartFs"
 
-  # make sure output dir exists
-  if [[ ! -d ../${cyear}${cmonth} ]] ; then
-     mkdir ../${cyear}${cmonth}
-  fi
+   # Create the file containing the input observation sequences.
+   # The input.nml.template explicitly references this file.
+   # The input observation sequences generally live in directories
+   # with names YYYYMM. FIXME ... year boundaries ...
 
-  # do the extract here
-  ../work/obs_sequence_tool
+   echo "/glade/p/image/Observations/FluxTower/obs_seq.USBar.2004" >  olist
+   echo "/glade/p/image/Observations/FluxTower/obs_seq.USHa1.2004" >> olist
+   echo "/glade/p/image/Observations/FluxTower/obs_seq.USNR1.2004" >> olist
+   echo "/glade/p/image/Observations/FluxTower/obs_seq.USSP3.2004" >> olist
+   echo "/glade/p/image/Observations/FluxTower/obs_seq.USSRM.2004" >> olist
+   echo "/glade/p/image/Observations/FluxTower/obs_seq.USWcr.2004" >> olist
+   echo "/glade/p/image/Observations/FluxTower/obs_seq.USWrc.2004" >> olist
 
-  # advance the day; the output is YYYYMMDD00
-  prevday=$currday
-  currday=$nextday
-  nextday=(`echo ${nyear}${nmonth}${nday}00 +1d | ../work/advance_time`)
-  #echo $currday $nextday $prevday
+   # make sure output dir exists
+   OUTDIR=../${fyear}${fmonth}
+   if [[ ! -d ${OUTDIR} ]] ; then
+        mkdir ${OUTDIR}
+   fi
 
-  # advance the loop counter
-  let d=d+1
+   sed -e "s#OUTDIR#${OUTDIR}#" \
+       -e "s#YYYY#${fyear}#g"   \
+       -e "s#MM#${fmonth}#g"    \
+       -e "s#DD#${fday}#g"      \
+       -e "s#SSSSS#${dartMs}#g" \
+       -e "s#DART1D#${dart1d}#" \
+       -e "s#DART1S#${dart1s}#" \
+       -e "s#DARTND#${dartNd}#" \
+       -e "s#DARTNS#${dartNs}#" < ../work/input.nml.template > input.nml
 
+   # do the extract here
+   ../work/obs_sequence_tool
+
+   # advance the day; the output is YYYYMMDD00
+   time_one=(`echo ${pyear}${pmonth}${pday}${phour} +1d | ../work/advance_time`)
+   filetime=(`echo ${fyear}${fmonth}${fday}${fhour} +1d | ../work/advance_time`)
+   time_end=(`echo ${nyear}${nmonth}${nday}${nhour} +1d | ../work/advance_time`)
+   echo "next set of times are: $time_one $filetime $time_end"
+
+   # advance the loop counter
+   let d=d+1
+
 done
 
 exit 0

Added: DART/trunk/models/clm/work/input.nml.template
===================================================================
--- DART/trunk/models/clm/work/input.nml.template	                        (rev 0)
+++ DART/trunk/models/clm/work/input.nml.template	2013-09-17 15:09:43 UTC (rev 6478)
@@ -0,0 +1,335 @@
+&perfect_model_obs_nml
+   start_from_restart    = .true.,
+   output_restart        = .true.,
+   async                 = 0,
+   init_time_days        = -1,
+   init_time_seconds     = -1,
+   first_obs_days        = -1,
+   first_obs_seconds     = -1,
+   last_obs_days         = -1,
+   last_obs_seconds      = -1,
+   output_interval       = 1,
+   trace_execution       = .false.,
+   restart_in_file_name  = "perfect_ics",
+   restart_out_file_name = "perfect_restart",
+   obs_seq_in_file_name  = "obs_seq.in",
+   obs_seq_out_file_name = "obs_seq.out",
+   adv_ens_command       = "./ha_ha_ha.csh"
+   output_timestamps     = .false.,
+   trace_execution       = .false.,
+   output_forward_op_errors = .true.,
+   print_every_nth_obs   = -1,
+   silence               = .false.,
+   /
+
+
+&filter_nml
+   async                    = 0,
+   adv_ens_command          = "./no_advance_model.csh",
+   ens_size                 =  80,
+   start_from_restart       = .true.,
+   output_restart           = .true.,
+   obs_sequence_in_name     = "obs_seq.out",
+   obs_sequence_out_name    = "obs_seq.final",
+   restart_in_file_name     = "filter_ics",
+   restart_out_file_name    = "filter_restart",
+   init_time_days           = -1,
+   init_time_seconds        = -1,
+   first_obs_days           = -1,
+   first_obs_seconds        = -1,
+   last_obs_days            = -1,
+   last_obs_seconds         = -1,
+   num_output_state_members = 20,
+   num_output_obs_members   = 20,
+   output_interval          = 1,
+   num_groups               = 1,
+   input_qc_threshold       =  1.0,
+   outlier_threshold        =  -1.0,
+   output_forward_op_errors = .false.,
+   output_timestamps        = .false.,
+   output_inflation         = .true.,
+   trace_execution          = .true.,
+   silence                  = .false.,
+
+   inf_flavor                  = 0,                       0,
+   inf_initial_from_restart    = .false.,                 .false.,
+   inf_sd_initial_from_restart = .false.,                 .false.,
+   inf_output_restart          = .true.,                  .true.,
+   inf_deterministic           = .true.,                  .true.,
+   inf_in_file_name            = 'prior_inflate_ics',     'post_inflate_ics',
+   inf_out_file_name           = 'prior_inflate_restart', 'post_inflate_restart',
+   inf_diag_file_name          = 'prior_inflate_diag',    'post_inflate_diag',
+   inf_initial                 = 1.0,                     1.0,
+   inf_sd_initial              = 0.0,                     0.0,
+   inf_damping                 = 1.0,                     1.0,
+   inf_lower_bound             = 1.0,                     1.0,
+   inf_upper_bound             = 1000000.0,               1000000.0,
+   inf_sd_lower_bound          = 0.0,                     0.0
+   /
+
+
+&smoother_nml
+   num_lags              = 0,
+   start_from_restart    = .false.,
+   output_restart        = .false.,
+   restart_in_file_name  = 'smoother_ics',
+   restart_out_file_name = 'smoother_restart'
+   /
+
+
+# cutoff of 0.03 (radians) is about 200km
+&assim_tools_nml
+   filter_kind                     = 1,
+   cutoff                          = 1.00,
+   allow_missing_in_state          = .true.,
+   sort_obs_inc                    = .false.,
+   spread_restoration              = .false.,
+   sampling_error_correction       = .false.,
+   adaptive_localization_threshold = -1,
+   output_localization_diagnostics = .true.,
+   localization_diagnostics_file   = 'localization_diagnostics',
+   print_every_nth_obs             = 0
+   /
+
+
+&ensemble_manager_nml
+   single_restart_file_in  = .false.,
+   single_restart_file_out = .false.,
+   perturbation_amplitude  = 0.2
+   /
+
+
+&cov_cutoff_nml
+   select_localization = 1
+   /
+
+
+&reg_factor_nml
+   select_regression    = 1,
+   input_reg_file       = "time_mean_reg",
+   save_reg_diagnostics = .false.,
+   reg_diagnostics_file = "reg_diagnostics"
+   /
+
+
+&obs_sequence_nml
+   write_binary_obs_sequence = .false.
+   /
+
+
+&preprocess_nml
+    input_obs_kind_mod_file = '../../../obs_kind/DEFAULT_obs_kind_mod.F90',
+   output_obs_kind_mod_file = '../../../obs_kind/obs_kind_mod.f90',
+     input_obs_def_mod_file = '../../../obs_def/DEFAULT_obs_def_mod.F90',
+    output_obs_def_mod_file = '../../../obs_def/obs_def_mod.f90',
+   input_files              = '../../../obs_def/obs_def_tower_mod.f90'
+   /
+
+
+# casename will get overwritten in the assimilate.csh script.
+# hist_nhtfrq should be negative (hours) ... same context as in
+# the CLM namelist for the .h1. files.
+&obs_def_tower_nml
+   casename    = '../clm_dart',
+   debug       = .true.
+   hist_nhtfrq = -24,
+   /
+
+
+&obs_kind_nml
+   assimilate_these_obs_types = 'TOWER_NETC_ECO_EXCHANGE',
+                                'TOWER_LATENT_HEAT_FLUX',
+                                'TOWER_SENSIBLE_HEAT_FLUX',
+                                'MODIS_SNOWCOVER_FRAC',
+                                'COSMOS_NEUTRON_INTENSITY',
+   evaluate_these_obs_types   = 'null'
+   /
+
+
+&assim_model_nml
+   write_binary_restart_files = .true.,
+   netCDF_large_file_support  = .true.
+   /
+
+
+# nolton:Desktop/CLM/camforcing_daily.clm2.r.2000-12-31-00000.nc
+# nolton:Desktop/CLM/camforcing_daily.clm2.h0.2000-12-31-00000.nc
+# nolton:Desktop/CLM/timing_128inst_1month_avectCopy_speedup_US-Ha1_ICN.clm2.1.r.0001-02-01-00000.nc
+# The definitions for most of the DART kinds are in obs_def_tower_mod.f90
+
+&model_nml
+   clm_restart_filename         = 'clm_restart.nc',
+   clm_history_filename         = 'clm_history.nc',
+   assimilation_period_days     = 1,
+   assimilation_period_seconds  = 0,
+   model_perturbation_amplitude = 0.2,
+   output_state_vector          = .false.,
+   calendar                     = 'Gregorian',
+   debug                        = 0,
+   clm_state_variables          = 'frac_sno',    'KIND_SNOWCOVER_FRAC',
+                                  'H2OSNO',      'KIND_SNOW_WATER',
+                                  'H2OSOI_LIQ',  'KIND_SOIL_MOISTURE',
+                                  'H2OSOI_ICE',  'KIND_ICE',
+                                  'T_SOISNO',    'KIND_SOIL_TEMPERATURE',
+                                  'cpool',       'KIND_CARBON',
+                                  'frootc',      'KIND_ROOT_CARBON',
+                                  'leafc',       'KIND_LEAF_CARBON',
+                                  'leafn',       'KIND_LEAF_NITROGEN',
+   /
+
+  frac_sno  is needed for the forward operator
+  H2OSNO is updated by the filter,
+  update_snow() takes H2OSNO* and updates the four following:
+                                  'SNOWDP',      'KIND_SNOW_THICKNESS',
+                                  'H2OSOI_LIQ',  'KIND_LIQUID_WATER',
+                                  'H2OSOI_ICE',  'KIND_ICE',
+                                  'T_SOISNO',    'KIND_SOIL_TEMPERATURE',
+
+
+&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.
+   /
+
+
+&location_nml
+   horiz_dist_only             = .true.,
+   vert_normalization_pressure = 100000.0,
+   vert_normalization_height   = 10000.0,
+   vert_normalization_level    = 20.0,
+   approximate_distance        = .false.,
+   nlon                        = 71,
+   nlat                        = 36,
+   output_box_info             = .true.
+   /
+
+
+&utilities_nml
+   TERMLEVEL = 1,
+   module_details = .false.,
+   logfilename = 'dart_log.out',
+   nmlfilename = 'dart_log.nml',
+   write_nml   = 'file'
+   /
+
+
+&mpi_utilities_nml
+   reverse_task_layout = .true.,
+   /
+
+
+# Gregorian: 12 Z 1 January 1996 <==> DART: 144270 days 43200 seconds
+# Gregorian: 12 Z 1 January 2000 <==> DART: 145731 days 43200 seconds
+
+&restart_file_tool_nml
+   input_file_name              = "filter_restart",
+   output_file_name             = "filter_updated_restart",
+   ens_size                     = 1,
+   single_restart_file_in       = .true.,
+   single_restart_file_out      = .true.,
+   write_binary_restart_files   = .true.,
+   overwrite_data_time          = .false.,
+   new_data_days                = -1,
+   new_data_secs                = -1,
+   input_is_model_advance_file  = .false.,
+   output_is_model_advance_file = .false.,
+   overwrite_advance_time       = .false.,
+   new_advance_days             = -1,
+   new_advance_secs             = -1,
+   gregorian_cal                = .true.
+   /
+
+
+# The times in the namelist for the obs_diag program are vectors
+# that follow the following sequence:
+# year   month   day   hour   minute   second
+# max_num_bins can be used to specify a fixed number of bins,
+# in which case last_bin_center should be safely in the future.
+#
+# Acceptable latitudes range from  [-90,  90]
+# Acceptable longitudes range from [  0, Inf]
+
+&obs_diag_nml
+   obs_sequence_name = '',
+   obs_sequence_list = 'obs_seq_files.txt',
+   first_bin_center =  2002,11, 2, 0, 0, 0 ,
+   last_bin_center  =  2003,02, 1, 0, 0, 0 ,
+   bin_separation   =     0, 0, 1, 0, 0, 0 ,
+   bin_width        =     0, 0, 1, 0, 0, 0 ,
+   time_to_skip     =     0, 0, 0, 0, 0, 0 ,
+   max_num_bins     = 1000,
+   rat_cri            = 3.0,
+   input_qc_threshold = 1,
+   Nregions   = 4,
+   lonlim1    =     0.0,     0.0,    0.0,  180.0,
+   lonlim2    =   360.0,   360.0,  180.0,  360.0,
+   latlim1    =   -90.0,     0.0,  -90.0,  -90.0,
+   latlim2    =     0.0,    90.0,   90.0,   90.0,
+   reg_names  = 'South', 'North', 'East', 'West',
+   hlevel =  0.0,  0.05, 0.1, 0.2, 0.50, 1.0, 2.0, 5.0, 10.0, 20.0, 40.0,
+   print_mismatched_locs = .false.,
+   create_rank_histogram = .true.,
+   verbose               = .true.,
+   /
+
+
+&obs_sequence_tool_nml
+   filename_seq_list = 'olist',
+   filename_out      = 'YYYYMM/obs_seq.YYYY-MM-DD-SSSSS',
+   print_only        = .false.,
+   gregorian_cal     = .true.,
+   first_obs_days    = DART1D,
+   first_obs_seconds = DART1S,
+   last_obs_days     = DART2D,
+   last_obs_seconds  = DART2S,
+   edit_qc_metadata  = .true.,
+   new_qc_metadata   = 'Original QC',
+/
+
+
+&schedule_nml
+   calendar        = 'Gregorian',
+   first_bin_start =  1601,  1,  1,  0,  0,  0,
+   first_bin_end   =  2999,  1,  1,  0,  0,  0,
+   last_bin_end    =  2999,  1,  1,  0,  0,  0,
+   bin_interval_days    = 1000000,
+   bin_interval_seconds = 0,
+   max_num_bins         = 1000,

@@ Diff output truncated at 40000 characters. @@


More information about the Dart-dev mailing list