forked from ufs-community/land-DA_workflow
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add new task to plot analysis (ufs-community#107)
* remove ptime ntime from rocoto yaml * add ptime ntime to j-job * load task modules from job card level * add a new task plot_stats * add plot_stats to xml * fix typo * fix conda issue * change wtime * comment out print * simplify python script * change cmap for scatter plot * fix typo * fix another typo in python script * update doc * change colormap * adjust colormap * adjust blue colormap * set xlimit of histogram adjustable * change coastline res to 50m * remove unnecessary line from gitignore
- Loading branch information
Showing
19 changed files
with
409 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,109 @@ | ||
#!/bin/bash | ||
|
||
date | ||
export PS4='+ $SECONDS + ' | ||
set -xue | ||
# | ||
#----------------------------------------------------------------------- | ||
# | ||
# Set the NCO standard environment variables (Table 1, pp.4) | ||
# | ||
#----------------------------------------------------------------------- | ||
# | ||
export USHlandda="${HOMElandda}/ush" | ||
export EXEClandda="${HOMElandda}/exec" | ||
export PARMlandda="${HOMElandda}/parm" | ||
export FIXlandda="${HOMElandda}/fix" | ||
export SCRIPTSlandda="${HOMElandda}/scripts" | ||
# | ||
#----------------------------------------------------------------------- | ||
# | ||
# Define job and jobid by default for rocoto | ||
# | ||
#----------------------------------------------------------------------- | ||
# | ||
WORKFLOW_MANAGER="${WORKFLOW_MANAGER:-rocoto}" | ||
if [ "${WORKFLOW_MANAGER}" = "rocoto" ]; then | ||
if [ "${SCHED}" = "slurm" ]; then | ||
job=${SLURM_JOB_NAME} | ||
pid=${SLURM_JOB_ID} | ||
elif [ "${SCHED}" = "pbspro" ]; then | ||
job=${PBS_JOBNAME} | ||
pid=${PBS_JOBID} | ||
else | ||
job="task" | ||
pid=$$ | ||
fi | ||
jobid="${job}.${PDY}${cyc}.${pid}" | ||
fi | ||
# | ||
#----------------------------------------------------------------------- | ||
# | ||
# Create a temp working directory (DATA) and cd into it. | ||
# | ||
#----------------------------------------------------------------------- | ||
# | ||
export DATA="${DATA:-${DATAROOT}/${jobid}}" | ||
mkdir -p $DATA | ||
cd $DATA | ||
# | ||
#----------------------------------------------------------------------- | ||
# | ||
# Define NCO environment variables and set COM type definitions. | ||
# | ||
#----------------------------------------------------------------------- | ||
# | ||
export NET="${NET:-landda}" | ||
export RUN="${RUN:-landda}" | ||
|
||
# Run setpdy to initialize PDYm and PDYp variables | ||
export cycle="${cycle:-t${cyc}z}" | ||
setpdy.sh | ||
. ./PDY | ||
|
||
[[ "$WORKFLOW_MANAGER" = "rocoto" ]] && export COMROOT=$COMROOT | ||
if [ "${MACHINE}" = "WCOSS2" ]; then | ||
export COMIN="${COMIN:-$(compath.py -o ${NET}/${model_ver}/${RUN}.${PDY})}" | ||
export COMOUT="${COMOUT:-$(compath.py -o ${NET}/${model_ver}/${RUN}.${PDY})}" | ||
else | ||
export COMIN="${COMIN:-${COMROOT}/${NET}/${model_ver}/${RUN}.${PDY}}" | ||
export COMOUT="${COMOUT:-${COMROOT}/${NET}/${model_ver}/${RUN}.${PDY}}" | ||
fi | ||
|
||
mkdir -p ${COMOUT} | ||
export COMOUTplot="${COMOUTplot:-${COMOUT}/plot}" | ||
mkdir -p ${COMOUTplot} | ||
|
||
# Create a teomporary share directory | ||
export DATA_SHARE="${DATA_SHARE:-${DATAROOT}/DATA_SHARE/${PDY}}" | ||
mkdir -p ${DATA_SHARE} | ||
export DATA_HOFX="${DATA_HOFX:-${DATAROOT}/DATA_SHARE/hofx}" | ||
mkdir -p ${DATA_HOFX} | ||
|
||
# | ||
#----------------------------------------------------------------------- | ||
# | ||
# Call the ex-script for this J-job. | ||
# | ||
#----------------------------------------------------------------------- | ||
# | ||
export pgmout="${DATA}/OUTPUT.$$" | ||
env | ||
|
||
${SCRIPTSlandda}/exlandda_plot_stats.sh | ||
export err=$?; err_chk | ||
|
||
if [ -e "$pgmout" ]; then | ||
cat $pgmout | ||
fi | ||
# | ||
#----------------------------------------------------------------------- | ||
# | ||
# Whether or not working directory DATA should be kept. | ||
# | ||
#----------------------------------------------------------------------- | ||
# | ||
if [ "${KEEPDATA}" = "NO" ]; then | ||
rm -rf ${DATA} | ||
fi | ||
date |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
prepend_path("MODULEPATH", os.getenv("modulepath_spack_stack")) | ||
|
||
load(pathJoin("stack-intel", stack_intel_ver)) | ||
load(pathJoin("stack-intel-oneapi-mpi", stack_intel_oneapi_mpi_ver)) | ||
|
||
load(pathJoin("prod_util", prod_util_ver)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
prepend_path("MODULEPATH", os.getenv("modulepath_spack_stack")) | ||
|
||
load(pathJoin("stack-intel", stack_intel_ver)) | ||
load(pathJoin("stack-intel-oneapi-mpi", stack_intel_oneapi_mpi_ver)) | ||
|
||
load(pathJoin("prod_util", prod_util_ver)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
hofx_files: 'INPUTFP' | ||
field_var: 'XXFIELDVAR' | ||
field_range: [XXFRLOW,XXFRHIGH] | ||
nbins: XXNBINS | ||
plottype: 'XXPLOTTYPE' | ||
title_fig: 'XXFIGTITLE' | ||
output_prefix: 'XXPREOUTFN' | ||
machine: 'XXMACHINE' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
#!/bin/sh | ||
|
||
set -xue | ||
|
||
############################################################ | ||
# Scatter Plot | ||
############################################################ | ||
|
||
cp ${PARMlandda}/templates/template.plot_hofx.yaml plot_hofx.yaml | ||
|
||
# Path to the directory containing the input file | ||
INPUTFP="${DATA_HOFX}" | ||
# Field variable | ||
FIELDVAR="OMA" | ||
# Field Range for scatter plot: [Low,High] | ||
FRLOW=-300 | ||
FRHIGH=300 | ||
# Number of bins in histogram plot | ||
NBINS=100 | ||
# Plot type (scatter/histogram/both) | ||
PLOTTYPE="both" | ||
# Figure title | ||
FIGTITLE="GHCN Snow Depth (mm)::Obs-Ana::${PDY}" | ||
# Prefix of output file name | ||
PREOUTFN="hofx_oma_${PDY}" | ||
|
||
sed -i "s|INPUTFP|${INPUTFP}|g" plot_hofx.yaml | ||
sed -i -e "s/XXFIELDVAR/${FIELDVAR}/g" plot_hofx.yaml | ||
sed -i -e "s/XXFRLOW/${FRLOW}/g" plot_hofx.yaml | ||
sed -i -e "s/XXFRHIGH/${FRHIGH}/g" plot_hofx.yaml | ||
sed -i -e "s/XXNBINS/${NBINS}/g" plot_hofx.yaml | ||
sed -i -e "s/XXPLOTTYPE/${PLOTTYPE}/g" plot_hofx.yaml | ||
sed -i -e "s/XXFIGTITLE/${FIGTITLE}/g" plot_hofx.yaml | ||
sed -i -e "s/XXPREOUTFN/${PREOUTFN}/g" plot_hofx.yaml | ||
sed -i -e "s/XXMACHINE/${MACHINE}/g" plot_hofx.yaml | ||
|
||
${USHlandda}/hofx_analysis_stats.py | ||
if [[ $? != 0 ]]; then | ||
echo "Scatter/Histogram plots failed" | ||
exit 33 | ||
fi | ||
|
||
# Copy result files to COMOUT | ||
cp -p ${PREOUTFN}* ${COMOUTplot} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.