Skip to content

Commit

Permalink
* user-defineable regex used for determining extra restart file dates…
Browse files Browse the repository at this point in the history
… to keep

* default experiment now uses IC files from 2004010100
  • Loading branch information
travissluka committed May 24, 2018
1 parent 66b0408 commit d5b71ef
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 16 deletions.
23 changes: 12 additions & 11 deletions run/config.exp_default/hybridgodas.template.config
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ export SCHED_QUEUE="batch"
# averages should be run for 6 days if a leap day is encountered
# so that the analysis days are the same for each year.
#--------------------------------------------------------------------------------
export CYCLE_START=2003010100
export CYCLE_END=2004010100
export CYCLE_START=2004010100
export CYCLE_END=2005123100
export CYCLE_LEN=120
export CYCLE_LEAPADJ=1

Expand Down Expand Up @@ -216,15 +216,16 @@ export FCST_IO_MISS="0024"
# subsequent 3dvar step then adjusts this analysis mean,
# saving the final mean via SAVE_ANA_MEAN
# SAVE_OMF : save the observation minus forecast (O-F) statistics
# SAVE_OMA : save the observation minus analysis (O-A) statistics.
# NOTE: not yet implemented.
# SAVE_RST_ANNUAL : If =1, the restart files (for the whole ensemble) are save
# at the beginning of each year
# SAVE_RST_CYCLES : if > 0, the full ensemble restart files for this many of
# SAVE_RST_MINCYCLES : if > 0, the full ensemble restart files for this many of
# the previous cycles are saved so that the experiment can
# be rewound several cycles when something goes wrong.
# Restart files from any older cycles are deleted, except
# for the first cycle of each year if SAVE_RST_ANUAL=1
# for the first cycle of each year if SAVE_RST_ANUAL=1, or if
# the dates match a pattern given by SAVE_RST_REGEX
# SAVE_RST_REGEX : save the restart files if the date (YYYYMMDDHH) matches the
# provided egrep formated regular expression
# SAVE_RST_ANNUAL : If =1, the restart files (for the whole ensemble) are saved
# at the beginning of each year
#--------------------------------------------------------------------------------
export SAVE_FORMAT_GRID="native"
export SAVE_COMP_LEVEL=4
Expand All @@ -240,7 +241,7 @@ export SAVE_ANA_MEAN_LETKF=1
export SAVE_ANA_SPRD=1

export SAVE_OMF=1
export SAVE_OMA=0

export SAVE_RST_ANNUAL=1
export SAVE_RST_CYCLES=3
export SAVE_RST_MINCYCLES=3
export SAVE_RST_REGEX="^....(0101|0401|0705|1003)00"
export SAVE_RST_ANNUAL=0
4 changes: 4 additions & 0 deletions run/init_cycle.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ export EXP_DIR=$exp_dir
export D='$'
cat $root_dir/run/config.exp_default/hybridgodas.template.config | envsubst '$EXP_NAME $ROOT_DIR $EXP_DIR $D' > config/hybridgodas.config

# setup the initial conditions
icdir=$root_dir/DATA/ic/2004010100
echo "Using initial conditions from $icdir"
cp $icdir/cycle . -r

# Save code version information
touch version
Expand Down
15 changes: 10 additions & 5 deletions run/subscripts/cycle.post.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@ cat << \#\#
envar+=("SAVE_ANA_SPRD")
envar+=("SAVE_OMF")
envar+=("SAVE_OMA")
envar+=("SAVE_RST_ANNUAL")
envar+=("SAVE_RST_CYCLES")
envar+=("SAVE_RST_REGEX")
envar+=("SAVE_RST_MINCYCLES")
#================================================================================
#================================================================================
Expand Down Expand Up @@ -322,12 +322,12 @@ fi
# delete any old working directories that are no longer needed
#--------------------------------------------------------------------------------
# cycle directory
if [[ "$SAVE_RST_CYCLES" -gt "0" ]]; then
if [[ "$SAVE_RST_MINCYCLES" -gt "0" ]]; then
echo "Checking for old cycles to delete..."
# how far back do we need to go?
dtz(){ echo ${1:0:8}Z${1:8:10}; }
keep_hrs=$(($FCST_LEN + $SAVE_RST_CYCLES))
keep_hrs=$(($FCST_LEN + $SAVE_RST_MINCYCLES))
keep_date=$(date "+%Y%m%d%H" -d "$(dtz $CYCLE) - $keep_hrs hours")
echo "Deleting cycles before $keep_date"
Expand All @@ -339,13 +339,18 @@ if [[ "$SAVE_RST_CYCLES" -gt "0" ]]; then
# keep if new enough
if [[ "$d" -ge "$CYCLE" ]]; then keep=1; fi
#save annual restart file?
# save annual restart file?
if [[ "$SAVE_RST_ANNUAL" -gt 0 ]]; then
y1=${d:0:4}
y2=$(date "+%Y" -d "$(dtz $d) - $FCST_LEN hours")
if [[ "$y1" -ne "$y2" ]]; then keep=1; fi
fi
# save if the regular expression matches
if [[ "$SAVE_RST_REGEX" != "" ]]; then
( echo $d | grep -E "$SAVE_RST_REGEX" ) && keep=1
fi
# delete
if [[ "$keep" -eq 0 ]]; then
echo "* Deleting $d"
Expand Down

0 comments on commit d5b71ef

Please sign in to comment.