Skip to content

Commit

Permalink
Add a plot option for restart files of forecast task (#149)
Browse files Browse the repository at this point in the history
* change order of plot_stat

* add plot for forecast restart

* fix script failure
  • Loading branch information
chan-hoo authored Oct 8, 2024
1 parent 7731b28 commit 96de8e0
Show file tree
Hide file tree
Showing 7 changed files with 382 additions and 85 deletions.
2 changes: 2 additions & 0 deletions jobs/JLANDDA_PLOT_STATS
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ mkdir -p ${DATA_SHARE}
export DATA_HOFX="${DATA_HOFX:-${DATAROOT}/DATA_SHARE/hofx}"
mkdir -p ${DATA_HOFX}

# Set other dates
export NTIME=$($NDATE 24 $PDY$cyc)
#
#-----------------------------------------------------------------------
#
Expand Down
55 changes: 28 additions & 27 deletions parm/land_analysis_hera.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -187,33 +187,6 @@ workflow:
taskdep:
attrs:
task: analysis
task_plot_stats:
attrs:
cycledefs: cycled
maxtries: 2
envars:
MACHINE: "&MACHINE;"
SCHED: "&SCHED;"
ACCOUNT: "&ACCOUNT;"
model_ver: "&model_ver;"
RUN: "&RUN;"
HOMElandda: "&HOMElandda;"
COMROOT: "&COMROOT;"
DATAROOT: "&DATAROOT;"
KEEPDATA: "&KEEPDATA;"
PDY: "&PDY;"
cyc: "&cyc;"
account: "&ACCOUNT;"
command: '&HOMElandda;/parm/task_load_modules_run_jjob.sh "plot_stats" "&HOMElandda;" "&MACHINE;"'
jobname: plot_stats
cores: 1
walltime: 00:10:00
queue: batch
join: "&LOGDIR;/plot_stats&LOGFN_SUFFIX;"
dependency:
taskdep:
attrs:
task: analysis
task_forecast:
attrs:
cycledefs: cycled
Expand Down Expand Up @@ -252,3 +225,31 @@ workflow:
taskdep:
attrs:
task: post_anal
task_plot_stats:
attrs:
cycledefs: cycled
maxtries: 2
envars:
MACHINE: "&MACHINE;"
SCHED: "&SCHED;"
ACCOUNT: "&ACCOUNT;"
model_ver: "&model_ver;"
RUN: "&RUN;"
HOMElandda: "&HOMElandda;"
COMROOT: "&COMROOT;"
DATAROOT: "&DATAROOT;"
KEEPDATA: "&KEEPDATA;"
PDY: "&PDY;"
cyc: "&cyc;"
account: "&ACCOUNT;"
command: '&HOMElandda;/parm/task_load_modules_run_jjob.sh "plot_stats" "&HOMElandda;" "&MACHINE;"'
jobname: plot_stats
cores: 1
walltime: 00:10:00
queue: batch
join: "&LOGDIR;/plot_stats&LOGFN_SUFFIX;"
dependency:
taskdep:
attrs:
task: forecast

57 changes: 29 additions & 28 deletions parm/land_analysis_hercules.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ workflow:
group: cycled
spec: 200001030000 200001040000 24:00:00
entities:
MACHINE: "orion"
MACHINE: "hercules"
SCHED: "slurm"
ACCOUNT: "epic"
EXP_BASEDIR: "/work2/noaa/epic/{USER}/landda_test"
Expand Down Expand Up @@ -187,33 +187,6 @@ workflow:
taskdep:
attrs:
task: analysis
task_plot_stats:
attrs:
cycledefs: cycled
maxtries: 2
envars:
MACHINE: "&MACHINE;"
SCHED: "&SCHED;"
ACCOUNT: "&ACCOUNT;"
model_ver: "&model_ver;"
RUN: "&RUN;"
HOMElandda: "&HOMElandda;"
COMROOT: "&COMROOT;"
DATAROOT: "&DATAROOT;"
KEEPDATA: "&KEEPDATA;"
PDY: "&PDY;"
cyc: "&cyc;"
account: "&ACCOUNT;"
command: '&HOMElandda;/parm/task_load_modules_run_jjob.sh "plot_stats" "&HOMElandda;" "&MACHINE;"'
jobname: plot_stats
cores: 1
walltime: 00:10:00
queue: batch
join: "&LOGDIR;/plot_stats&LOGFN_SUFFIX;"
dependency:
taskdep:
attrs:
task: analysis
task_forecast:
attrs:
cycledefs: cycled
Expand Down Expand Up @@ -252,3 +225,31 @@ workflow:
taskdep:
attrs:
task: post_anal
task_plot_stats:
attrs:
cycledefs: cycled
maxtries: 2
envars:
MACHINE: "&MACHINE;"
SCHED: "&SCHED;"
ACCOUNT: "&ACCOUNT;"
model_ver: "&model_ver;"
RUN: "&RUN;"
HOMElandda: "&HOMElandda;"
COMROOT: "&COMROOT;"
DATAROOT: "&DATAROOT;"
KEEPDATA: "&KEEPDATA;"
PDY: "&PDY;"
cyc: "&cyc;"
account: "&ACCOUNT;"
command: '&HOMElandda;/parm/task_load_modules_run_jjob.sh "plot_stats" "&HOMElandda;" "&MACHINE;"'
jobname: plot_stats
cores: 1
walltime: 00:10:00
queue: batch
join: "&LOGDIR;/plot_stats&LOGFN_SUFFIX;"
dependency:
taskdep:
attrs:
task: forecast

55 changes: 28 additions & 27 deletions parm/land_analysis_orion.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -187,33 +187,6 @@ workflow:
taskdep:
attrs:
task: analysis
task_plot_stats:
attrs:
cycledefs: cycled
maxtries: 2
envars:
MACHINE: "&MACHINE;"
SCHED: "&SCHED;"
ACCOUNT: "&ACCOUNT;"
model_ver: "&model_ver;"
RUN: "&RUN;"
HOMElandda: "&HOMElandda;"
COMROOT: "&COMROOT;"
DATAROOT: "&DATAROOT;"
KEEPDATA: "&KEEPDATA;"
PDY: "&PDY;"
cyc: "&cyc;"
account: "&ACCOUNT;"
command: '&HOMElandda;/parm/task_load_modules_run_jjob.sh "plot_stats" "&HOMElandda;" "&MACHINE;"'
jobname: plot_stats
cores: 1
walltime: 00:10:00
queue: batch
join: "&LOGDIR;/plot_stats&LOGFN_SUFFIX;"
dependency:
taskdep:
attrs:
task: analysis
task_forecast:
attrs:
cycledefs: cycled
Expand Down Expand Up @@ -252,3 +225,31 @@ workflow:
taskdep:
attrs:
task: post_anal
task_plot_stats:
attrs:
cycledefs: cycled
maxtries: 2
envars:
MACHINE: "&MACHINE;"
SCHED: "&SCHED;"
ACCOUNT: "&ACCOUNT;"
model_ver: "&model_ver;"
RUN: "&RUN;"
HOMElandda: "&HOMElandda;"
COMROOT: "&COMROOT;"
DATAROOT: "&DATAROOT;"
KEEPDATA: "&KEEPDATA;"
PDY: "&PDY;"
cyc: "&cyc;"
account: "&ACCOUNT;"
command: '&HOMElandda;/parm/task_load_modules_run_jjob.sh "plot_stats" "&HOMElandda;" "&MACHINE;"'
jobname: plot_stats
cores: 1
walltime: 00:10:00
queue: batch
join: "&LOGDIR;/plot_stats&LOGFN_SUFFIX;"
dependency:
taskdep:
attrs:
task: forecast

8 changes: 8 additions & 0 deletions parm/templates/template.plot_restart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
path_data: 'PATH_DATA'
work_dir: 'WORK_DIR'
fn_data_base: 'XXFN_DATA_BASE'
fn_data_ext: 'XXFN_DATA_EXT'
soil_lvl_number: 'XXSOIL_LEVEL_NUMBER'
out_title_base: 'XXOUT_TITLE_BASE'
out_fn_base: 'XXOUT_FN_BASE'
machine: 'XXMACHINE'
50 changes: 47 additions & 3 deletions scripts/exlandda_plot_stats.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,16 @@

set -xue

YYYY=${PDY:0:4}
MM=${PDY:4:2}
DD=${PDY:6:2}
HH=${cyc}

############################################################
# Scatter Plot
# Stats Plot
############################################################

cp ${PARMlandda}/templates/template.plot_hofx.yaml plot_hofx.yaml
cp -p ${PARMlandda}/templates/template.plot_hofx.yaml plot_hofx.yaml

# Path to the directory containing the input file
INPUTFP="${DATA_HOFX}"
Expand Down Expand Up @@ -36,9 +41,48 @@ sed -i -e "s/XXMACHINE/${MACHINE}/g" plot_hofx.yaml

${USHlandda}/hofx_analysis_stats.py
if [[ $? != 0 ]]; then
echo "Scatter/Histogram plots failed"
echo "FATAL ERROR: Scatter/Histogram plots failed"
exit 33
fi

# Copy result files to COMOUT
cp -p ${PREOUTFN}* ${COMOUTplot}


############################################################
# Restart Plot
############################################################

nYYYY=${NTIME:0:4}
nMM=${NTIME:4:2}
nDD=${NTIME:6:2}
nHH=${NTIME:8:2}

cp -p ${PARMlandda}/templates/template.plot_restart.yaml plot_restart.yaml

PATH_DATA="${COMIN}"
WORK_DIR="${DATA}"
FN_DATA_BASE="ufs_land_restart.${nYYYY}-${nMM}-${nDD}_${nHH}-00-00.tile"
FN_DATA_EXT=".nc"
SOIL_LEVEL_NUMBER="1"
OUT_TITLE_BASE="Land-DA::restart::${nYYYY}-${nMM}-${nDD}_${nHH}::"
OUT_FN_BASE="landda_out_restart_${nYYYY}-${nMM}-${nDD}_${nHH}_"

sed -i "s|PATH_DATA|${PATH_DATA}|g" plot_restart.yaml
sed -i "s|WORK_DIR|${WORK_DIR}|g" plot_restart.yaml
sed -i -e "s/XXFN_DATA_BASE/${FN_DATA_BASE}/g" plot_restart.yaml
sed -i -e "s/XXFN_DATA_EXT/${FN_DATA_EXT}/g" plot_restart.yaml
sed -i -e "s/XXSOIL_LEVEL_NUMBER/${SOIL_LEVEL_NUMBER}/g" plot_restart.yaml
sed -i -e "s/XXOUT_TITLE_BASE/${OUT_TITLE_BASE}/g" plot_restart.yaml
sed -i -e "s/XXOUT_FN_BASE/${OUT_FN_BASE}/g" plot_restart.yaml
sed -i -e "s/XXMACHINE/${MACHINE}/g" plot_restart.yaml

${USHlandda}/plot_forecast_restart.py
if [[ $? != 0 ]]; then
echo "FATAL ERROR: Forecast restart plots failed"
exit 44
fi

# Copy result files to COMOUT
cp -p ${OUT_FN_BASE}* ${COMOUTplot}

Loading

0 comments on commit 96de8e0

Please sign in to comment.