forked from NOAA-GSL/UPP
-
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 the task of smoke emission preprocessing" (NOAA-EMC#441)
- Loading branch information
Showing
10 changed files
with
560 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,170 @@ | ||
#!/bin/bash | ||
# | ||
#----------------------------------------------------------------------- | ||
# | ||
# This J-JOB script runs the radar reflectivity preprocess | ||
# for the FV3-LAM model | ||
# | ||
#----------------------------------------------------------------------- | ||
# | ||
#----------------------------------------------------------------------- | ||
# | ||
# Source the variable definitions file and the bash utility functions. | ||
# | ||
#----------------------------------------------------------------------- | ||
# | ||
. ${GLOBAL_VAR_DEFNS_FP} | ||
. $USHDIR/source_util_funcs.sh | ||
|
||
# | ||
#----------------------------------------------------------------------- | ||
# | ||
# 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 | ||
# | ||
#----------------------------------------------------------------------- | ||
# | ||
# 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 radar reflectivity | ||
preprocess with FV3 for the specified cycle. | ||
========================================================================" | ||
# | ||
#----------------------------------------------------------------------- | ||
# | ||
# Create the working directory under the cycle directory. | ||
# | ||
#----------------------------------------------------------------------- | ||
# | ||
if [ ${CYCLE_TYPE} == "spinup" ]; then | ||
workdir=${CYCLE_DIR}/process_smoke_spinup | ||
else | ||
workdir=${CYCLE_DIR}/process_smoke | ||
fi | ||
rm -fr ${workdir} | ||
mkdir_vrfy -p ${workdir} | ||
# | ||
# | ||
# | ||
gridspec_dir=${NWGES_BASEDIR}/grid_spec | ||
# | ||
#----------------------------------------------------------------------- | ||
# | ||
# Set the name of and create the directory in which the output from this | ||
# script will be saved for long time (if that directory doesn't already exist). | ||
# Usually ics_dir under tmpnwprd should be purged fairly soon after cycle done | ||
# | ||
#----------------------------------------------------------------------- | ||
# | ||
rave_nwges_dir=${NWGES_DIR}/RAVE_INTP | ||
mkdir_vrfy -p "${rave_nwges_dir}" | ||
#----------------------------------------------------------------------- | ||
# | ||
# Call the ex-script for this J-job and pass to it the necessary varia- | ||
# bles. | ||
# | ||
#----------------------------------------------------------------------- | ||
# | ||
cd_vrfy ${workdir} | ||
python -u ${SCRIPTSDIR}/preprocess_smoke.py \ | ||
"${FIRE_RRFS_ROOT}/${PREDEF_GRID_NAME}/fixed" \ | ||
"${FIRE_RAVE_DIR}" \ | ||
"${rave_nwges_dir}" \ | ||
"${PREDEF_GRID_NAME}" \ | ||
print_err_msg_exit "\ | ||
Call to pyscript \"${scrfunc_fn}\" failed." | ||
|
||
ECHO=/bin/echo | ||
AWK="/bin/gawk --posix" | ||
SED=/bin/sed | ||
DATE=/bin/date | ||
|
||
START_DATE=$(echo "${CDATE}" | sed 's/\([[:digit:]]\{2\}\)$/ \1/') | ||
YYYYMMDDHH=$(date +%Y%m%d%H -d "${START_DATE}") | ||
YYYYMMDD=${YYYYMMDDHH:0:8} | ||
HH=${YYYYMMDDHH:8:2} | ||
echo ${YYYYMMDD} | ||
echo ${HH} | ||
|
||
current_day=`${DATE} -d "${YYYYMMDD}"` | ||
HH=${HH} | ||
current_hh=`${DATE} -d ${HH} +"%H"` | ||
prev_hh=`${DATE} -d "$current_hh -24 hour" +"%H"` | ||
previous_day=`${DATE} '+%C%y%m%d' -d "$current_day-1 days"` | ||
previous_day=${previous_day}${prev_hh} | ||
output_filename=SMOKE_RRFS_data_${YYYYMMDDHH}00.nc | ||
#output_filename=SMOKE_RRFS_data_${previous_day}00.nc | ||
echo ${previous_day} | ||
echo ${output_filename} | ||
|
||
#cd_vrfy /mnt/lfs4/BMC/gsd-fv3-dev/FIRE_RRFS_ROOT/RAVE_INTP2 | ||
cd_vrfy ${rave_nwges_dir} | ||
echo ${rave_nwges_dir} | ||
|
||
# Convert START_TIME from 'YYYYMMDDHH' format to Unix date format, e.g. "Fri May 6 19:50:23 GMT 2005" | ||
if [ `${ECHO} "${previous_day}" | ${AWK} '/^[[:digit:]]{10}$/'` ]; then | ||
previous_day=`${ECHO} "${previous_day}" | ${SED} 's/\([[:digit:]]\{2\}\)$/ \1/'` | ||
else | ||
${ECHO} "ERROR: start time, '${previous_day}', is not in 'yyyymmddhh' or 'yyyymmdd hh' format" | ||
exit 1 | ||
fi | ||
previous_day=`${DATE} -d "${previous_day}"` | ||
echo ${previous_day} | ||
|
||
nfiles=24 | ||
files2cat=() | ||
for i in $(seq 0 $(($nfiles - 1)) ) | ||
do | ||
timestr=`date +%Y%m%d%H -d "$previous_day + $i hours"` | ||
echo ${timestr} | ||
files2cat[$i]=${PREDEF_GRID_NAME}_intp_${timestr}00_${timestr}00.nc | ||
done | ||
echo ${files2cat[*]} | ||
ncrcat ${files2cat[*]} ${output_filename} | ||
|
||
# | ||
#----------------------------------------------------------------------- | ||
# | ||
# Print exit message. | ||
# | ||
#----------------------------------------------------------------------- | ||
# | ||
print_info_msg " | ||
======================================================================== | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#%Module | ||
module use /contrib/miniconda3/modulefiles | ||
module load miniconda3/4.5.12 | ||
setenv SRW_ENV /scratch1/BMC/acomp/Johana/miniconda/envs/interpol_esmpy |
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,4 @@ | ||
#%Module | ||
module use /contrib/miniconda3/modulefiles | ||
module load miniconda3/4.5.12 | ||
setenv SRW_ENV /home/Johana.Romero-Alvarez/miniconda3/envs/interpol_esmpy |
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.