Skip to content

Commit

Permalink
Merge pull request #437 from NCAR/bug_fix_CAM_assimilate
Browse files Browse the repository at this point in the history
Edit cam-fv assimilate.csh.template to improve purge logic for restarts
  • Loading branch information
hkershaw-brown committed Dec 2, 2022
2 parents da0d74e + e6b4a8b commit 3f3a4e0
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 2 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@ individual files.

The changes are now listed with the most recent at the top.

**December 2 2022 :: Bug-fix cam-fv. Tag v10.5.6**

- Fix for assimilate.csh purge of restart files when the interval for restart
saves is given as a string rather than an integer.
- Fix for setting ptype when no_normalization_of_scale_heights = .false.

**November 8 2022 :: Improved clean_nml and CLM quickbuild.sh. Tag v10.5.5**

- clean_nml tool for comparing input.nmls given optional arguments to
Expand Down
2 changes: 1 addition & 1 deletion conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
author = 'Data Assimilation Research Section'

# The full version, including alpha/beta/rc tags
release = '10.5.5'
release = '10.5.6'
master_doc = 'README'

# -- General configuration ---------------------------------------------------
Expand Down
20 changes: 19 additions & 1 deletion models/cam-fv/shell_scripts/cesm2_1/assimilate.csh.template
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,24 @@ if ($#log_list >= 3) then
set sec_o_day = $RM_DATE_PARTS[4]
set day_time = ${day_o_month}-${sec_o_day}

# Decide whether to purge restart files at this date and time.
set save_rest_freq = BOGUS_save_every_Mth

set purge = 'true'
# Learn whether save_rest_freq a string or a number.
# Character strings must be tested outside of the 'if' statement.
echo $save_rest_freq | grep '[a-z]'
if ($status == 0) then
set purge_date = $RM_DATE_PARTS[1]-$RM_DATE_PARTS[2]-$RM_DATE_PARTS[3]
set weekday = `date --date="$purge_date" +%A`
if ($weekday == $save_rest_freq) set purge = 'false'

# Numbers can be tested inside the 'if' statement.
else if (`echo $save_rest_freq | grep '[0-9]'`) then
if (${day_o_month} % ${save_rest_freq} == 0) set purge = 'false'

endif

# Identify log files to be removed or moved.
# [3] means the 3rd oldest restart set is being (re)moved.
set rm_log = `echo $log_list[3] | sed -e "s/\./ /g;"`
Expand All @@ -367,7 +385,7 @@ if ($#log_list >= 3) then
# The 'else' block preserves the restarts in the archive directory.

if ( $sec_o_day !~ '00000' || \
($sec_o_day =~ '00000' && $day_o_month % BOGUS_save_every_Mth != 0) ) then
($sec_o_day =~ '00000' && $purge == 'true') ) then

# Optionally save inflation restarts, even if it's not a 'save restart' time.
if ($save_all_inf =~ TRUE) ${MOVE} ${CASE}*inf*${day_time}* ${archive}/esp/hist
Expand Down

0 comments on commit 3f3a4e0

Please sign in to comment.