-
Notifications
You must be signed in to change notification settings - Fork 119
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[develop] Add process lightning task (#644)
This PR adds the process lightning task to the SRW App from the NOAA-GSL RRFS_dev1 branch. The process lightning task is part of the RRFS configuration of the SRW App. --------- Co-authored-by: Edward Snyder <Edward.Snyder@noaa.com>
- Loading branch information
1 parent
b17dbf8
commit aaa41c6
Showing
7 changed files
with
339 additions
and
5 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
#!/bin/bash | ||
|
||
# | ||
#----------------------------------------------------------------------- | ||
# | ||
# This J-JOB script runs the NetCDF lightning observation preprocess | ||
# for the FV3-LAM model | ||
# | ||
#----------------------------------------------------------------------- | ||
# | ||
# | ||
#----------------------------------------------------------------------- | ||
# | ||
# Source the variable definitions file and the bash utility functions. | ||
# | ||
#----------------------------------------------------------------------- | ||
# | ||
. ${USHdir}/source_util_funcs.sh | ||
source_config_for_task "task_process_lightning" ${GLOBAL_VAR_DEFNS_FP} | ||
. ${USHdir}/job_preamble.sh "TRUE" | ||
# | ||
#----------------------------------------------------------------------- | ||
# | ||
# Save current shell options (in a global array). Then set new options | ||
# for this script/function. | ||
# | ||
#----------------------------------------------------------------------- | ||
# | ||
{ save_shell_opts; . $USHdir/preamble.sh; } > /dev/null 2>&1 | ||
# | ||
#----------------------------------------------------------------------- | ||
# | ||
# Get the full path to the file in which this script/function is located | ||
# (scrfunc_fp), the name of that file (scrfunc_fn), and the directory in | ||
# which the file is located (scrfunc_dir). | ||
# | ||
#----------------------------------------------------------------------- | ||
# | ||
scrfunc_fp=$( $READLINK -f "${BASH_SOURCE[0]}" ) | ||
scrfunc_fn=$( basename "${scrfunc_fp}" ) | ||
scrfunc_dir=$( dirname "${scrfunc_fp}" ) | ||
# | ||
#----------------------------------------------------------------------- | ||
# | ||
# Print message indicating entry into script. | ||
# | ||
#----------------------------------------------------------------------- | ||
# | ||
print_info_msg " | ||
======================================================================== | ||
Entering script: \"${scrfunc_fn}\" | ||
In directory: \"${scrfunc_dir}\" | ||
This is the J-job script for the task that runs a lightning preprocess for | ||
the specified cycle. | ||
========================================================================" | ||
# | ||
#----------------------------------------------------------------------- | ||
# | ||
# Create the working directory under the cycle directory. | ||
# | ||
#----------------------------------------------------------------------- | ||
# | ||
if [ "${CYCLE_TYPE}" == "spinup" ]; then | ||
DATA="${DATA:-${COMIN}/process_lightning_spinup}" | ||
else | ||
DATA="${DATA:-${COMIN}/process_lightning}" | ||
fi | ||
mkdir_vrfy -p ${DATA} | ||
# | ||
#----------------------------------------------------------------------- | ||
# | ||
# Call the ex-script for this J-job and pass to it the necessary varia- | ||
# bles. | ||
# | ||
#----------------------------------------------------------------------- | ||
# | ||
$SCRIPTSdir/exregional_process_lightning.sh || print_err_msg_exit "\ | ||
Call to ex-script corresponding to J-job \"${scrfunc_fn}\" failed." | ||
# | ||
#----------------------------------------------------------------------- | ||
# | ||
# Run job postamble. | ||
# | ||
#----------------------------------------------------------------------- | ||
# | ||
job_postamble | ||
# | ||
#----------------------------------------------------------------------- | ||
# | ||
# Restore the shell options saved at the beginning of this script/func- | ||
# tion. | ||
# | ||
#----------------------------------------------------------------------- | ||
# | ||
{ restore_shell_opts; } > /dev/null 2>&1 |
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,193 @@ | ||
#!/bin/bash | ||
|
||
# | ||
#----------------------------------------------------------------------- | ||
# | ||
# Source the variable definitions file and the bash utility functions. | ||
# | ||
#----------------------------------------------------------------------- | ||
# | ||
. $USHdir/source_util_funcs.sh | ||
source_config_for_task "task_process_lightning" ${GLOBAL_VAR_DEFNS_FP} | ||
# | ||
#----------------------------------------------------------------------- | ||
# | ||
# Save current shell options (in a global array). Then set new options | ||
# for this script/function. | ||
# | ||
#----------------------------------------------------------------------- | ||
# | ||
{ save_shell_opts; . $USHdir/preamble.sh; } > /dev/null 2>&1 | ||
# | ||
#----------------------------------------------------------------------- | ||
# | ||
# Get the full path to the file in which this script/function is located | ||
# (scrfunc_fp), the name of that file (scrfunc_fn), and the directory in | ||
# which the file is located (scrfunc_dir). | ||
# | ||
#----------------------------------------------------------------------- | ||
# | ||
scrfunc_fp=$( readlink -f "${BASH_SOURCE[0]}" ) | ||
scrfunc_fn=$( basename "${scrfunc_fp}" ) | ||
scrfunc_dir=$( dirname "${scrfunc_fp}" ) | ||
# | ||
#----------------------------------------------------------------------- | ||
# | ||
# Print message indicating entry into script. | ||
# | ||
#----------------------------------------------------------------------- | ||
# | ||
print_info_msg " | ||
======================================================================== | ||
Entering script: \"${scrfunc_fn}\" | ||
In directory: \"${scrfunc_dir}\" | ||
This is the ex-script for the task that runs lightning preprocessing | ||
with FV3 for the specified cycle. | ||
========================================================================" | ||
# | ||
#----------------------------------------------------------------------- | ||
# | ||
# Extract from CDATE the starting year, month, day, and hour of the | ||
# forecast. These are needed below for various operations. | ||
# | ||
#----------------------------------------------------------------------- | ||
# | ||
START_DATE=$(echo "${PDY} ${cyc}") | ||
YYYYMMDDHH=$(date +%Y%m%d%H -d "${START_DATE}") | ||
|
||
# | ||
#----------------------------------------------------------------------- | ||
# | ||
# Get into working directory | ||
# | ||
#----------------------------------------------------------------------- | ||
# | ||
print_info_msg "$VERBOSE" " | ||
Getting into working directory for lightning process ..." | ||
|
||
cd_vrfy ${DATA} | ||
|
||
pregen_grid_dir=$DOMAIN_PREGEN_BASEDIR/${PREDEF_GRID_NAME} | ||
|
||
print_info_msg "$VERBOSE" "pregen_grid_dir is $pregen_grid_dir" | ||
|
||
# | ||
#----------------------------------------------------------------------- | ||
# | ||
# link or copy background and grid files | ||
# | ||
#----------------------------------------------------------------------- | ||
|
||
cp_vrfy ${pregen_grid_dir}/fv3_grid_spec fv3sar_grid_spec.nc | ||
|
||
#----------------------------------------------------------------------- | ||
# | ||
# Link to the NLDN data | ||
# | ||
#----------------------------------------------------------------------- | ||
run_lightning=false | ||
filenum=0 | ||
|
||
for incr in $(seq -25 5 5) ; do | ||
filedate=$(date +"%y%j%H%M" -d "${START_DATE} ${incr} minutes ") | ||
filename=${LIGHTNING_ROOT}/${filedate}0005r | ||
if [ -r ${filename} ]; then | ||
((filenum += 1 )) | ||
ln -sf ${filename} ./NLDN_lightning_${filenum} | ||
run_lightning=true | ||
else | ||
echo " ${filename} does not exist" | ||
fi | ||
done | ||
|
||
echo "found GLD360 files: ${filenum}" | ||
|
||
#----------------------------------------------------------------------- | ||
# | ||
# copy bufr table from fix directory | ||
# | ||
#----------------------------------------------------------------------- | ||
BUFR_TABLE=${FIXgsi}/prepobs_prep_RAP.bufrtable | ||
|
||
cp_vrfy $BUFR_TABLE prepobs_prep.bufrtable | ||
|
||
#----------------------------------------------------------------------- | ||
# | ||
# Build namelist and run executable | ||
# | ||
# analysis_time : process obs used for this analysis date (YYYYMMDDHH) | ||
# NLDN_filenum : number of NLDN lighting observation files | ||
# IfAlaska : logic to decide if to process Alaska lightning obs | ||
# bkversion : grid type (background will be used in the analysis) | ||
# = 0 for ARW (default) | ||
# = 1 for FV3LAM | ||
#----------------------------------------------------------------------- | ||
|
||
cat << EOF > namelist.lightning | ||
&setup | ||
analysis_time = ${YYYYMMDDHH}, | ||
NLDN_filenum = ${filenum}, | ||
grid_type = "${PREDEF_GRID_NAME}", | ||
obs_type = "nldn_nc" | ||
/ | ||
EOF | ||
|
||
# | ||
#----------------------------------------------------------------------- | ||
# | ||
# Copy the executable to the run directory. | ||
# | ||
#----------------------------------------------------------------------- | ||
# | ||
exec_fn="process_Lightning.exe" | ||
exec_fp="$EXECdir/${exec_fn}" | ||
|
||
if [ ! -f "${exec_fp}" ]; then | ||
print_err_msg_exit "\ | ||
The executable specified in exec_fp does not exist: | ||
exec_fp = \"${exec_fp}\" | ||
Build lightning process and rerun." | ||
fi | ||
# | ||
# | ||
#----------------------------------------------------------------------- | ||
# | ||
# Run the process | ||
# | ||
#----------------------------------------------------------------------- | ||
# | ||
|
||
if [[ "$run_lightning" == true ]]; then | ||
PREP_STEP | ||
eval ${RUN_CMD_UTILS} ${exec_fp} ${REDIRECT_OUT_ERR} || \ | ||
print_err_msg_exit "\ | ||
Call to executable (exec_fp) to run lightning (nc) process returned | ||
with nonzero exit code: | ||
exec_fp = \"${exec_fp}\"" | ||
POST_STEP | ||
fi | ||
|
||
# | ||
#----------------------------------------------------------------------- | ||
# | ||
# Print message indicating successful completion of script. | ||
# | ||
#----------------------------------------------------------------------- | ||
# | ||
print_info_msg " | ||
======================================================================== | ||
LIGHTNING PROCESS completed successfully!!! | ||
Exiting script: \"${scrfunc_fn}\" | ||
In directory: \"${scrfunc_dir}\" | ||
========================================================================" | ||
# | ||
#----------------------------------------------------------------------- | ||
# | ||
# Restore the shell options saved at the beginning of this script/func- | ||
# tion. | ||
# | ||
#----------------------------------------------------------------------- | ||
# | ||
{ restore_shell_opts; } > /dev/null 2>&1 |
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
Oops, something went wrong.