Skip to content

Commit

Permalink
update restart plot part
Browse files Browse the repository at this point in the history
  • Loading branch information
chan-hoo committed Dec 3, 2024
1 parent 6cf57ea commit 2035252
Show file tree
Hide file tree
Showing 4 changed files with 72 additions and 58 deletions.
3 changes: 3 additions & 0 deletions jobs/JLANDDA_FORECAST
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,9 @@ mkdir -p ${COMOUT}

# RESTART directory in COMOUT
mkdir -p ${COMOUT}/RESTART
# plot directory in COMOUT
export COMOUTplot="${COMOUTplot:-${COMOUT}/plot}"
mkdir -p ${COMOUTplot}

# Create a teomporary share directory
export DATA_SHARE="${DATA_SHARE:-${DATAROOT}/DATA_SHARE/${PDY}}"
Expand Down
2 changes: 2 additions & 0 deletions scripts/exlandda_analysis.sh
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,9 @@ if [[ -d output/DA/hofx ]]; then
ln -nsf ${COMOUThofx}/* ${DATA_HOFX}
fi

###########################################################
# WE2E test
###########################################################
if [[ "${WE2E_TEST}" == "YES" ]]; then
path_fbase="${FIXlandda}/test_base/we2e_com/${RUN}.${PDY}"
fn_sfc="${FILEDATE}.sfc_data.tile"
Expand Down
4 changes: 3 additions & 1 deletion scripts/exlandda_forecast.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ export ESMF_RUNTIME_PROFILE_OUTPUT="SUMMARY"
export PSM_RANKS_PER_CONTEXT=4
export PSM_SHAREDCONTEXTS=1


NTIME=$($NDATE ${DATE_CYCLE_FREQ_HR} $PDY$cyc)

YYYY=${PDY:0:4}
Expand Down Expand Up @@ -398,7 +397,10 @@ elif [ "${APP}" = "ATML" ]; then
done
fi


###########################################################
# WE2E test
###########################################################
if [[ "${WE2E_TEST}" == "YES" ]]; then
path_fbase="${FIXlandda}/test_base/we2e_com/${RUN}.${PDY}/RESTART"
fn_res="ufs_land_restart.${nYYYY}-${nMM}-${nDD}_${nHH}-00-00.tile"
Expand Down
121 changes: 64 additions & 57 deletions scripts/exlandda_plot_stats.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,25 +15,29 @@ nMM=${NTIME:4:2}
nDD=${NTIME:6:2}
nHH=${NTIME:8:2}

DO_PLOT_STATS="NO"
DO_PLOT_TIME_HISTORY="NO"
DO_PLOT_RESTART="YES"

############################################################
# Stats Plot
############################################################

# Field variable
field_var="OMA"
# Field Range for scatter plot: [Low,High]
field_range_low=-300
field_range_high=300
# Number of bins in histogram plot
nbins=100
# Plot type (scatter/histogram/both)
plottype="both"
# Figure title
title_fig="GHCN Snow Depth (mm)::Obs-Ana::${PDY}"
# Prefix of output file name
output_prefix="hofx_oma_${PDY}"

cat > plot_hofx.yaml <<EOF
if [ "${DO_PLOT_STATS}" = "YES" ]; then
# Field variable
field_var="OMA"
# Field Range for scatter plot: [Low,High]
field_range_low=-300
field_range_high=300
# Number of bins in histogram plot
nbins=100
# Plot type (scatter/histogram/both)
plottype="both"
# Figure title
title_fig="GHCN Snow Depth (mm)::Obs-Ana::${PDY}"
# Prefix of output file name
output_prefix="hofx_oma_${PDY}"
cat > plot_hofx.yaml <<EOF
hofx_files: '${DATA_HOFX}'
field_var: '${field_var}'
field_range: [${field_range_low},${field_range_high}]
Expand All @@ -43,30 +47,31 @@ title_fig: '${title_fig}'
output_prefix: '${output_prefix}'
machine: '${MACHINE}'
EOF

${USHlandda}/hofx_analysis_stats.py
if [ $? -ne 0 ]; then
err_exit "Scatter/Histogram plots failed"

${USHlandda}/hofx_analysis_stats.py
if [ $? -ne 0 ]; then
err_exit "Scatter/Histogram plots failed"
fi

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

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


############################################################
# Time-history Plot
############################################################

fn_data_anal_prefix="analysis_"
fn_data_anal_suffix=".log"
fn_data_fcst_prefix="forecast_"
fn_data_fcst_suffix=".log"
out_title_anal_base="Land-DA::Analysis::QC SnowDepthGHCN::"
out_fn_anal_base="landda_timehistory_"
out_title_time="Land-DA::Wall-clock time"
out_fn_time="landda_timehistory_wtime"

cat > plot_timehistory.yaml <<EOF
if [ "${DO_PLOT_TIME_HISTORY}" = "YES" ]; then
fn_data_anal_prefix="analysis_"
fn_data_anal_suffix=".log"
fn_data_fcst_prefix="forecast_"
fn_data_fcst_suffix=".log"
out_title_anal_base="Land-DA::Analysis::QC SnowDepthGHCN::"
out_fn_anal_base="landda_timehistory_"
out_title_time="Land-DA::Wall-clock time"
out_fn_time="landda_timehistory_wtime"

cat > plot_timehistory.yaml <<EOF
path_data: '${LOGDIR}'
work_dir: '${DATA}'
fn_data_anal_prefix: '${fn_data_anal_prefix}'
Expand All @@ -81,27 +86,28 @@ out_title_time: '${out_title_time}'
out_fn_time: '${out_fn_time}'
EOF

${USHlandda}/plot_analysis_timehistory.py
if [ $? -ne 0 ]; then
err_exit "Time-history plots failed"
fi
${USHlandda}/plot_analysis_timehistory.py
if [ $? -ne 0 ]; then
err_exit "Time-history plots failed"
fi

# Copy result files to COMOUT
cp -p ${out_fn_anal_base}* ${COMOUTplot}
cp -p ${out_fn_time}* ${COMOUTplot}
# Copy result files to COMOUT
cp -p ${out_fn_anal_base}* ${COMOUTplot}
cp -p ${out_fn_time}* ${COMOUTplot}
fi


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

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}_"

cat > plot_restart.yaml <<EOF
###########################################################
if [ "${DO_PLOT_RESTART}" = "YES" ]; then
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}_"

cat > plot_restart.yaml <<EOF
path_data: '${COMIN}/RESTART'
work_dir: '${DATA}'
fn_data_base: '${fn_data_base}'
Expand All @@ -112,11 +118,12 @@ out_fn_base: '${out_fn_base}'
machine: '${MACHINE}'
EOF

${USHlandda}/plot_forecast_restart.py
if [ $? -ne 0 ]; then
err_exit "Forecast restart plots failed"
fi
${USHlandda}/plot_forecast_restart.py
if [ $? -ne 0 ]; then
err_exit "Forecast restart plots failed"
fi

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

0 comments on commit 2035252

Please sign in to comment.