diff --git a/scripts/exregional_clean.ksh b/scripts/exregional_clean.ksh index c74de74c2..9ff8b6b46 100755 --- a/scripts/exregional_clean.ksh +++ b/scripts/exregional_clean.ksh @@ -1,27 +1,48 @@ #!/bin/ksh --login -currentime=`date` - +# +#----------------------------------------------------------------------- +# Source the variable definitions file. +#----------------------------------------------------------------------- +# . ${GLOBAL_VAR_DEFNS_FP} +# +#----------------------------------------------------------------------- +# Save current shell options (in a global array). Then set new options +# for this script/function. +#----------------------------------------------------------------------- +# +{ save_shell_opts; set -u -x; } > /dev/null 2>&1 +# +# +#----------------------------------------------------------------------- +# set up currentime from CDATE +#----------------------------------------------------------------------- +# +currentime=$(echo "${CDATE}" | sed 's/\([[:digit:]]\{2\}\)$/ \1/') +#----------------------------------------------------------------------- # Delete ptmp directories -deletetime=`date +%Y%m%d -d "${currentime} 72 hours ago"` +#----------------------------------------------------------------------- +deletetime=$(date +%Y%m%d -d "${currentime} ${CLEAN_OLDPROD_HRS} hours ago") echo "Deleting ptmp directories before ${deletetime}..." cd ${COMOUT_BASEDIR} -set -A XX `ls -d ${RUN}.20* | sort -r` +set -A XX $(ls -d ${RUN}.20* | sort -r) for dir in ${XX[*]};do - onetime=`echo $dir | cut -d'.' -f2` + onetime=$(echo $dir | cut -d'.' -f2) if [[ ${onetime} -le ${deletetime} ]]; then rm -rf ${COMOUT_BASEDIR}/${RUN}.${onetime} echo "Deleted ${COMOUT_BASEDIR}/${RUN}.${onetime}" fi done +#----------------------------------------------------------------------- # Delete stmp directories -deletetime=`date +%Y%m%d%H -d "${currentime} 72 hours ago"` +#----------------------------------------------------------------------- +deletetime=$(date +%Y%m%d%H -d "${currentime} ${CLEAN_OLDRUN_HRS} hours ago") echo "Deleting stmp directories before ${deletetime}..." cd ${CYCLE_BASEDIR} -set -A XX `ls -d 20* | sort -r` +set -A XX $(ls -d 20* | sort -r) for onetime in ${XX[*]};do if [[ ${onetime} -le ${deletetime} ]]; then rm -rf ${CYCLE_BASEDIR}/${onetime} @@ -29,30 +50,33 @@ for onetime in ${XX[*]};do fi done +#----------------------------------------------------------------------- # Delete netCDF files -deletetime=`date +%Y%m%d%H -d "${currentime} 24 hours ago"` +#----------------------------------------------------------------------- +deletetime=$(date +%Y%m%d%H -d "${currentime} ${CLEAN_OLDFCST_HRS} hours ago") echo "Deleting netCDF files before ${deletetime}..." cd ${CYCLE_BASEDIR} -set -A XX `ls -d 20* | sort -r` +set -A XX $(ls -d 20* | sort -r) for onetime in ${XX[*]};do if [[ ${onetime} -le ${deletetime} ]]; then rm -f ${CYCLE_BASEDIR}/${onetime}/fcst_fv3lam/phy*nc rm -f ${CYCLE_BASEDIR}/${onetime}/fcst_fv3lam/dyn*nc rm -rf ${CYCLE_BASEDIR}/${onetime}/fcst_fv3lam/RESTART - rm -rf ${CYCLE_BASEDIR}/${onetime}/fcst_fv3lam/INPUT echo "Deleted netCDF files in ${CYCLE_BASEDIR}/${onetime}/fcst_fv3lam" fi done +#----------------------------------------------------------------------- # Delete old log files -deletetime=`date +%Y%m%d%H -d "${currentime} 48 hours ago"` +#----------------------------------------------------------------------- +deletetime=$(date +%Y%m%d%H -d "${currentime} ${CLEAN_OLDLOG_HRS} hours ago") echo "Deleting log files before ${deletetime}..." # Remove template date from last two levels -logs=`echo ${LOGDIR} | rev | cut -f 3- -d / | rev` +logs=$(echo ${LOGDIR} | rev | cut -f 3- -d / | rev) cd ${logs} pwd -set -A XX `ls -d ${RUN}.20*/* | sort -r` +set -A XX $(ls -d ${RUN}.20*/* | sort -r) for onetime in ${XX[*]}; do # Remove slash and RUN from directory to get time filetime=${onetime/\//} diff --git a/ush/config.sh.RRFS_AK_dev1 b/ush/config.sh.RRFS_AK_dev1 index 40b4c29ad..48a99d753 100644 --- a/ush/config.sh.RRFS_AK_dev1 +++ b/ush/config.sh.RRFS_AK_dev1 @@ -128,7 +128,16 @@ COMINgfs="" STMP="/lfs4/BMC/nrtrr/NCO_dirs/stmp" # Path to directory STMP that mostly contains input files. PTMP="/lfs4/BMC/nrtrr/NCO_dirs/ptmp" # Path to directory STMP that mostly contains input files. - +if [[ $DO_RETRO == "true" ]] ; then + CLEAN_OLDPROD_HRS="240" + CLEAN_OLDLOG_HRS="240" + CLEAN_OLDRUN_HRS="6" + CLEAN_OLDFCST_HRS="6" + if [[ $LBCS_ICS_ONLY == "true" ]]; then + CLEAN_OLDRUN_HRS="7777" + CLEAN_OLDFCST_HRS="7777" + fi +fi # # In NCO mode, the user must manually (e.g. after doing the build step) # create the symlink "${FIXrrfs}/fix_sar" that points to EMC's FIXLAM diff --git a/ush/config.sh.RRFS_NA_13km b/ush/config.sh.RRFS_NA_13km index f17acf7f2..c2685521e 100644 --- a/ush/config.sh.RRFS_NA_13km +++ b/ush/config.sh.RRFS_NA_13km @@ -128,6 +128,17 @@ COMINgfs="" STMP="/lfs4/BMC/nrtrr/NCO_dirs/stmp" # Path to directory STMP that mostly contains input files. PTMP="/lfs4/BMC/nrtrr/NCO_dirs/ptmp" # Path to directory STMP that mostly contains input files. +if [[ $DO_RETRO == "true" ]] ; then + CLEAN_OLDPROD_HRS="240" + CLEAN_OLDLOG_HRS="240" + CLEAN_OLDRUN_HRS="6" + CLEAN_OLDFCST_HRS="6" + if [[ $LBCS_ICS_ONLY == "true" ]]; then + CLEAN_OLDRUN_HRS="7777" + CLEAN_OLDFCST_HRS="7777" + fi +fi + # # In NCO mode, the user must manually (e.g. after doing the build step) # create the symlink "${FIXrrfs}/fix_sar" that points to EMC's FIXLAM diff --git a/ush/config.sh.RRFS_NA_3km b/ush/config.sh.RRFS_NA_3km index a59d5aee0..3ecdaeb0b 100644 --- a/ush/config.sh.RRFS_NA_3km +++ b/ush/config.sh.RRFS_NA_3km @@ -137,6 +137,17 @@ COMINgfs="" STMP="/lfs4/BMC/nrtrr/NCO_dirs/stmp" # Path to directory STMP that mostly contains input files. PTMP="/lfs4/BMC/nrtrr/NCO_dirs/ptmp" # Path to directory STMP that mostly contains input files. +if [[ $DO_RETRO == "true" ]] ; then + CLEAN_OLDPROD_HRS="240" + CLEAN_OLDLOG_HRS="240" + CLEAN_OLDRUN_HRS="6" + CLEAN_OLDFCST_HRS="6" + if [[ $LBCS_ICS_ONLY == "true" ]]; then + CLEAN_OLDRUN_HRS="7777" + CLEAN_OLDFCST_HRS="7777" + fi +fi + # # In NCO mode, the user must manually (e.g. after doing the build step) # create the symlink "${FIXrrfs}/fix_sar" that points to EMC's FIXLAM diff --git a/ush/config.sh.RRFS_dev1 b/ush/config.sh.RRFS_dev1 index 8bc3a18fa..a0ec81f3a 100644 --- a/ush/config.sh.RRFS_dev1 +++ b/ush/config.sh.RRFS_dev1 @@ -150,6 +150,17 @@ COMINgfs="" STMP="/lfs4/BMC/nrtrr/NCO_dirs/stmp" # Path to directory STMP that mostly contains input files. PTMP="/lfs4/BMC/nrtrr/NCO_dirs/ptmp" # Path to directory STMP that mostly contains input files. +if [[ $DO_RETRO == "true" ]] ; then + CLEAN_OLDPROD_HRS="240" + CLEAN_OLDLOG_HRS="240" + CLEAN_OLDRUN_HRS="6" + CLEAN_OLDFCST_HRS="6" + if [[ $LBCS_ICS_ONLY == "true" ]]; then + CLEAN_OLDRUN_HRS="7777" + CLEAN_OLDFCST_HRS="7777" + fi +fi + # # In NCO mode, the user must manually (e.g. after doing the build step) # create the symlink "${FIXrrfs}/fix_sar" that points to EMC's FIXLAM diff --git a/ush/config.sh.RRFS_wcoss b/ush/config.sh.RRFS_wcoss index ab62de99f..451010b18 100644 --- a/ush/config.sh.RRFS_wcoss +++ b/ush/config.sh.RRFS_wcoss @@ -133,6 +133,17 @@ COMINgfs="" STMP="/gpfs/hps3/ptmp/Ming.Hu/stmp" # Path to directory STMP that mostly contains input files. PTMP="/gpfs/hps3/ptmp/Ming.Hu/ptmp" # Path to directory STMP that mostly contains input files. +if [[ $DO_RETRO == "true" ]] ; then + CLEAN_OLDPROD_HRS="240" + CLEAN_OLDLOG_HRS="240" + CLEAN_OLDRUN_HRS="6" + CLEAN_OLDFCST_HRS="6" + if [[ $LBCS_ICS_ONLY == "true" ]]; then + CLEAN_OLDRUN_HRS="7777" + CLEAN_OLDFCST_HRS="7777" + fi +fi + # # In NCO mode, the user must manually (e.g. after doing the build step) # create the symlink "${FIXrrfs}/fix_sar" that points to EMC's FIXLAM diff --git a/ush/config_defaults.sh b/ush/config_defaults.sh index 6b493376d..677aab0a9 100644 --- a/ush/config_defaults.sh +++ b/ush/config_defaults.sh @@ -1771,3 +1771,23 @@ DO_REFL2TTEN="FALSE" # RADARREFL_MINS=(0 1 2 3) RADARREFL_TIMELEVEL=(0) + +# +#----------------------------------------------------------------------- +# +# Parameters for cleaning the real-time and retrospective runs. +# CLEAN_OLDPROD_HRS: +# the product under com directory from cycles older than (current cycle - this hour) will be cleaned +# CLEAN_OLDLOG_HRS +# the log files under com directory from cycles older than (current cycle - this hour) will be cleaned +# CLEAN_OLDRUN_HRS +# the run directory under tmpnwprd directory from cycles older than (current cycle - this hour) will be cleaned +# CLEAN_OLDFCST_HRS +# the fv3lam forecast netcdf files forecast run directory from cycles older than (current cycle - this hour) will be cleaned +#----------------------------------------------------------------------- +# + +CLEAN_OLDPROD_HRS="72" +CLEAN_OLDLOG_HRS="48" +CLEAN_OLDRUN_HRS="72" +CLEAN_OLDFCST_HRS="24" diff --git a/ush/templates/FV3LAM_wflow.xml b/ush/templates/FV3LAM_wflow.xml index 500d8c863..4cebaf69f 100644 --- a/ush/templates/FV3LAM_wflow.xml +++ b/ush/templates/FV3LAM_wflow.xml @@ -950,15 +950,7 @@ MODULES_RUN_TASK_FP script. - {%- endif %} - - -{%- if not do_retro %} -