Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 37 additions & 13 deletions scripts/exregional_clean.ksh
Original file line number Diff line number Diff line change
@@ -1,58 +1,82 @@
#!/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}
echo "Deleted ${CYCLE_BASEDIR}/${onetime}"
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/\//}
Expand Down
11 changes: 10 additions & 1 deletion ush/config.sh.RRFS_AK_dev1
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
18 changes: 15 additions & 3 deletions ush/config.sh.RRFS_CONUS_13km
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,10 @@ VERBOSE="TRUE"
RUN_ENVIR="nco"
PREEXISTING_DIR_METHOD="upgrade"

#PREDEF_GRID_NAME=RRFS_CONUS_3km
PREDEF_GRID_NAME=RRFS_CONUS_13km
#ADDNL_OUTPUT_GRIDS=( "hrrr" )
#"ADDNL_OUTPUT_GRIDS=( "hrrr" )
TILE_LABELS="CONUS REGIONS"
TILE_SETS="full NE,NC,NW,SE,SC,SW"

DO_DACYCLE="true"
#DO_RETRO="true"
Expand Down Expand Up @@ -63,7 +64,7 @@ if [[ $DO_RETRO == "true" ]] ; then
OBSPATH=/mnt/lfs4/BMC/wrfruc/Ruifang.Li/data/obs_rap
OBSPATH_NSSLMOSIAC=/mnt/lfs4/BMC/wrfruc/Ruifang.Li/data/reflectivity
LIGHTNING_ROOT=/mnt/lfs4/BMC/wrfruc/Ruifang.Li/data/lightning/vaisala/netcdf/
ENKF_FCST=/mnt/lfs4/BMC/wrfruc/Ruifang.Li/data/enkf/atm
ENKF_FCST=/mnt/lfs4/BMC/wrfruc/Ruifang.Li/data/enkf/atm
fi

if [[ $LBCS_ICS_ONLY == "true" ]]; then
Expand Down Expand Up @@ -159,6 +160,17 @@ COMINgfs=""
STMP="/mnt/lfs4/BMC/rtwbl/mhu/rrfs/dev2/stmp" # Path to directory STMP that mostly contains input files.
PTMP="/mnt/lfs4/BMC/rtwbl/mhu/rrfs/dev2/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
Expand Down
11 changes: 11 additions & 0 deletions ush/config.sh.RRFS_NA_13km
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
11 changes: 11 additions & 0 deletions ush/config.sh.RRFS_NA_3km
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
11 changes: 11 additions & 0 deletions ush/config.sh.RRFS_dev1
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
16 changes: 15 additions & 1 deletion ush/config.sh.RRFS_dev2
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ PREEXISTING_DIR_METHOD="upgrade"
PREDEF_GRID_NAME=RRFS_CONUS_3km
ADDNL_OUTPUT_GRIDS=( "hrrr" )

TILE_LABELS="CONUS REGIONS"
TILE_SETS="full NE,NC,NW,SE,SC,SW"

DO_DACYCLE="true"
#DO_RETRO="true"
#LBCS_ICS_ONLY="true"
Expand Down Expand Up @@ -62,7 +65,7 @@ if [[ $DO_RETRO == "true" ]] ; then
OBSPATH=/mnt/lfs4/BMC/wrfruc/Ruifang.Li/data/obs_rap
OBSPATH_NSSLMOSIAC=/mnt/lfs4/BMC/wrfruc/Ruifang.Li/data/reflectivity
LIGHTNING_ROOT=/mnt/lfs4/BMC/wrfruc/Ruifang.Li/data/lightning/vaisala/netcdf/
ENKF_FCST=/mnt/lfs4/BMC/wrfruc/Ruifang.Li/data/enkf/atm
ENKF_FCST=/mnt/lfs4/BMC/wrfruc/Ruifang.Li/data/enkf/atm
fi

if [[ $LBCS_ICS_ONLY == "true" ]]; then
Expand Down Expand Up @@ -147,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
Expand Down
11 changes: 11 additions & 0 deletions ush/config.sh.RRFS_wcoss
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
20 changes: 20 additions & 0 deletions ush/config_defaults.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
9 changes: 5 additions & 4 deletions ush/templates/FV3LAM_wflow.xml
Original file line number Diff line number Diff line change
Expand Up @@ -951,8 +951,6 @@ MODULES_RUN_TASK_FP script.
</task>

{%- endif %}

{%- if not do_retro %}
<!--
************************************************************************
************************************************************************
Expand All @@ -969,6 +967,11 @@ MODULES_RUN_TASK_FP script.

<envar><name>GLOBAL_VAR_DEFNS_FP</name><value>&GLOBAL_VAR_DEFNS_FP;</value></envar>
<envar><name>LOGDIR</name><value>&LOGDIR;</value></envar>
<envar><name>CDATE</name><value><cyclestr>@Y@m@d@H</cyclestr></value></envar>

<dependency>
<taskdep task="&RUN_FCST_TN;"/>
</dependency>

</task>

Expand All @@ -993,6 +996,4 @@ MODULES_RUN_TASK_FP script.
</task>

{%- endif %}
{%- endif %}

</workflow>