diff --git a/jobs/JREGIONAL_AQM_ICS b/jobs/JREGIONAL_AQM_ICS new file mode 100755 index 0000000000..3e68ba32e4 --- /dev/null +++ b/jobs/JREGIONAL_AQM_ICS @@ -0,0 +1,108 @@ +#!/bin/bash + +# +#----------------------------------------------------------------------- +# +# This script adds extra species for air quality modeling (AQM) to the +# initial conditions (ICs). +# +#----------------------------------------------------------------------- +# + +# +#----------------------------------------------------------------------- +# +# Source the variable definitions file and the bash utility functions. +# +#----------------------------------------------------------------------- +# +. $USHdir/source_util_funcs.sh +source_config_for_task "cpl_aqm_parm" ${GLOBAL_VAR_DEFNS_FP} +. $USHdir/job_preamble.sh +# +#----------------------------------------------------------------------- +# +# 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 copies/fetches to a local +directory (either from disk or HPSS) the aqm boundary conditions from +which the model needs. +========================================================================" +# +#----------------------------------------------------------------------- +# +# Set the name of and create the directory in which the output from this +# script will be placed (if it doesn't already exist). +# +#----------------------------------------------------------------------- +# +if [ $RUN_ENVIR = "nco" ]; then + export INPUT_DATA="${COMIN}" +else + export INPUT_DATA="${COMIN}${SLASH_ENSMEM_SUBDIR}/INPUT" +fi +mkdir_vrfy -p "${INPUT_DATA}" +# +#----------------------------------------------------------------------- +# +# Set the run directory +# +#----------------------------------------------------------------------- +# +DATA="${DATA:-${COMIN}${SLASH_ENSMEM_SUBDIR}}" +mkdir_vrfy -p "${DATA}" +# +#----------------------------------------------------------------------- +# +# Call the ex-script for this J-job and pass to it the necessary variables. +# +#----------------------------------------------------------------------- +# +$SCRIPTSdir/exregional_aqm_ics.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/function. +# +#----------------------------------------------------------------------- +# +{ restore_shell_opts; } > /dev/null 2>&1 + diff --git a/jobs/JREGIONAL_AQM_LBCS b/jobs/JREGIONAL_AQM_LBCS new file mode 100755 index 0000000000..aa93509931 --- /dev/null +++ b/jobs/JREGIONAL_AQM_LBCS @@ -0,0 +1,108 @@ +#!/bin/bash + +# +#----------------------------------------------------------------------- +# +# This script adds extra species for air quality modeling (AQM) to the +# lateral boundary conditions (LBCs) files. +# +#----------------------------------------------------------------------- +# + +# +#----------------------------------------------------------------------- +# +# Source the variable definitions file and the bash utility functions. +# +#----------------------------------------------------------------------- +# +. $USHdir/source_util_funcs.sh +source_config_for_task "task_get_extrn_lbcs|task_make_orog|task_make_lbcs|cpl_aqm_parm" ${GLOBAL_VAR_DEFNS_FP} +. $USHdir/job_preamble.sh +# +#----------------------------------------------------------------------- +# +# 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 copies/fetches to a local +directory (either from disk or HPSS) the aqm boundary conditions from +which the model needs. +========================================================================" +# +#----------------------------------------------------------------------- +# +# Set the name of and create the directory in which the output from this +# script will be placed (if it doesn't already exist). +# +#----------------------------------------------------------------------- +# +if [ $RUN_ENVIR = "nco" ]; then + export INPUT_DATA="${COMIN}" +else + export INPUT_DATA="${COMIN}${SLASH_ENSMEM_SUBDIR}/INPUT" +fi +mkdir_vrfy -p "${INPUT_DATA}" +# +#----------------------------------------------------------------------- +# +# Set the run directory +# +#----------------------------------------------------------------------- +# +DATA="${DATA:-${COMIN}${SLASH_ENSMEM_SUBDIR}}" +mkdir_vrfy -p "${DATA}" +# +#----------------------------------------------------------------------- +# +# Call the ex-script for this J-job and pass to it the necessary variables. +# +#----------------------------------------------------------------------- +# +$SCRIPTSdir/exregional_aqm_lbcs.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/function. +# +#----------------------------------------------------------------------- +# +{ restore_shell_opts; } > /dev/null 2>&1 + diff --git a/jobs/JREGIONAL_BIAS_CORRECTION_O3 b/jobs/JREGIONAL_BIAS_CORRECTION_O3 new file mode 100755 index 0000000000..f620bcebf4 --- /dev/null +++ b/jobs/JREGIONAL_BIAS_CORRECTION_O3 @@ -0,0 +1,101 @@ +#!/bin/bash + +# +#----------------------------------------------------------------------- +# +# This script runs BIAS-CORRECTION-O3. +# +#----------------------------------------------------------------------- +# + +# +#----------------------------------------------------------------------- +# +# Source the variable definitions file and the bash utility functions. +# +#----------------------------------------------------------------------- +# +. $USHdir/source_util_funcs.sh +source_config_for_task "cpl_aqm_parm|task_run_post" ${GLOBAL_VAR_DEFNS_FP} +. $USHdir/job_preamble.sh +# +#----------------------------------------------------------------------- +# +# 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 BIAS-CORRECTION-O3. +========================================================================" +# +#----------------------------------------------------------------------- +# +# Set the run directory. +# +#----------------------------------------------------------------------- +# +DATA="${DATA:-${COMIN}${SLASH_ENSMEM_SUBDIR}}" + +export PARMaqm_utils="${PARMaqm_utils:-${HOMEdir}/sorc/AQM-utils/parm}" + +TMP_STDAY=`${NDATE} -8760 ${PDY}${cyc} | cut -c1-8` # 1 year back +# The earliest day of training data is August 1 2020 +if [ ${TMP_STDAY} -le 20220810 ]; then + TMP_STDAY=20220810 +fi +export BC_STDAY=${BC_STDAY:-${TMP_STDAY}} +# +#----------------------------------------------------------------------- +# +# Call the ex-script for this J-job and pass to it the necessary varia- +# bles. +# +#----------------------------------------------------------------------- +# +$SCRIPTSdir/exregional_bias_correction_o3.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 + diff --git a/jobs/JREGIONAL_BIAS_CORRECTION_PM25 b/jobs/JREGIONAL_BIAS_CORRECTION_PM25 new file mode 100755 index 0000000000..f018d1633a --- /dev/null +++ b/jobs/JREGIONAL_BIAS_CORRECTION_PM25 @@ -0,0 +1,101 @@ +#!/bin/bash + +# +#----------------------------------------------------------------------- +# +# This script runs BIAS-CORRECTION-PM25. +# +#----------------------------------------------------------------------- +# + +# +#----------------------------------------------------------------------- +# +# Source the variable definitions file and the bash utility functions. +# +#----------------------------------------------------------------------- +# +. $USHdir/source_util_funcs.sh +source_config_for_task "cpl_aqm_parm|task_run_post" ${GLOBAL_VAR_DEFNS_FP} +. $USHdir/job_preamble.sh +# +#----------------------------------------------------------------------- +# +# 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 BIAS-CORRECTION-PM25. +========================================================================" +# +#----------------------------------------------------------------------- +# +# Set the run directory. +# +#----------------------------------------------------------------------- +# +DATA="${DATA:-${COMIN}${SLASH_ENSMEM_SUBDIR}}" + +export PARMaqm_utils="${PARMaqm_utils:-${HOMEdir}/sorc/AQM-utils/parm}" + +TMP_STDAY=`${NDATE} -8760 ${PDY}${cyc} | cut -c1-8` # 1 year back +# The earliest day of training data is August 1 2020 +if [ ${TMP_STDAY} -le 20220810 ]; then + TMP_STDAY=20220810 +fi +export BC_STDAY=${BC_STDAY:-${TMP_STDAY}} +# +#----------------------------------------------------------------------- +# +# Call the ex-script for this J-job and pass to it the necessary varia- +# bles. +# +#----------------------------------------------------------------------- +# +$SCRIPTSdir/exregional_bias_correction_pm25.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 + diff --git a/jobs/JREGIONAL_FIRE_EMISSION b/jobs/JREGIONAL_FIRE_EMISSION new file mode 100755 index 0000000000..454f3537ae --- /dev/null +++ b/jobs/JREGIONAL_FIRE_EMISSION @@ -0,0 +1,122 @@ +#!/bin/bash + +# +#----------------------------------------------------------------------- +# +# This script gets fire emission data files from disk or HPSS +# +#----------------------------------------------------------------------- +# + +# +#----------------------------------------------------------------------- +# +# Source the variable definitions file and the bash utility functions. +# +#----------------------------------------------------------------------- +# +. $USHdir/source_util_funcs.sh +source_config_for_task "cpl_aqm_parm" ${GLOBAL_VAR_DEFNS_FP} +. $USHdir/job_preamble.sh +# +#----------------------------------------------------------------------- +# +# 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 copies or fetches RAVE fire +emission data files from disk, or HPSS. +========================================================================" +# +#----------------------------------------------------------------------- +# +# Set the external model start time +# +#----------------------------------------------------------------------- +# +export TIME_OFFSET_HRS=${AQM_FIRE_FILE_OFFSET_HRS:-0} +yyyymmdd=${PDY} +hh=${cyc} +export FIRE_FILE_CDATE=$( $DATE_UTIL --utc --date "${yyyymmdd} ${hh} UTC - ${TIME_OFFSET_HRS} hours" "+%Y%m%d%H" ) + +# +#----------------------------------------------------------------------- +# +# Check whether FIRE EMISSION data files are available on the specified +# cycle date and time on HPSS (FIRE_FILE_CDATE). +# +#----------------------------------------------------------------------- +# +CDATE_min="2022101500" +if [ "$FIRE_FILE_CDATE" -lt "$CDATE_min" ]; then + print_info_msg " +======================================================================== +RAVE fire emission data are not available on HPSS for this date. +CDATE: \"${FIRE_FILE_CDATE}\" +CDATE_min: \"${CDATE_min}\" +========================================================================" +fi +# +#----------------------------------------------------------------------- +# +# Create the directory where the RAVE fire emission files should be stored +# +#----------------------------------------------------------------------- +# +export FIRE_EMISSION_STAGING_DIR="${COMINext}/FIRE_EMISSION" +mkdir_vrfy -p "${FIRE_EMISSION_STAGING_DIR}" +cd_vrfy ${FIRE_EMISSION_STAGING_DIR} +# +#----------------------------------------------------------------------- +# +# Call the ex-script for this J-job and pass to it the necessary variables. +# +#----------------------------------------------------------------------- +# +$SCRIPTSdir/exregional_fire_emission.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/function. +# +#----------------------------------------------------------------------- +# +{ restore_shell_opts; } > /dev/null 2>&1 + diff --git a/jobs/JREGIONAL_NEXUS_EMISSION b/jobs/JREGIONAL_NEXUS_EMISSION new file mode 100755 index 0000000000..a282a91e15 --- /dev/null +++ b/jobs/JREGIONAL_NEXUS_EMISSION @@ -0,0 +1,107 @@ +#!/bin/bash + +# +#----------------------------------------------------------------------- +# +# This script generate NEXUS emission netcdf file. +# +#----------------------------------------------------------------------- +# + +# +#----------------------------------------------------------------------- +# +# Source the variable definitions file and the bash utility functions. +# +#----------------------------------------------------------------------- +# +. $USHdir/source_util_funcs.sh +source_config_for_task "task_run_fcst|cpl_aqm_parm" ${GLOBAL_VAR_DEFNS_FP} +. $USHdir/job_preamble.sh +# +#----------------------------------------------------------------------- +# +# 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 generates the emission files +using NEXUS which will output for FV3 (in NetCDF format). +========================================================================" +# +#----------------------------------------------------------------------- +# +# Set the name of and create the directory in which the output from this +# script will be placed (if it doesn't already exist). +# +#----------------------------------------------------------------------- +# +if [ $RUN_ENVIR = "nco" ]; then + export INPUT_DATA="${COMIN}/NEXUS" +else + export INPUT_DATA="${COMIN}${SLASH_ENSMEM_SUBDIR}/NEXUS" +fi +mkdir_vrfy -p "${INPUT_DATA}" +# +#----------------------------------------------------------------------- +# +# Set the run directory +# +#----------------------------------------------------------------------- +# +DATA="${DATA:-${COMIN}${SLASH_ENSMEM_SUBDIR}}" +mkdir_vrfy -p "${DATA}" +# +#----------------------------------------------------------------------- +# +# Call the ex-script for this J-job. +# +#----------------------------------------------------------------------- +# +$SCRIPTSdir/exregional_nexus_emission.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 + diff --git a/jobs/JREGIONAL_NEXUS_GFS_SFC b/jobs/JREGIONAL_NEXUS_GFS_SFC new file mode 100755 index 0000000000..18450441ba --- /dev/null +++ b/jobs/JREGIONAL_NEXUS_GFS_SFC @@ -0,0 +1,135 @@ +#!/bin/bash + +# +#----------------------------------------------------------------------- +# +# This script gets fire emission data files from disk or HPSS +# +#----------------------------------------------------------------------- +# + +# +#----------------------------------------------------------------------- +# +# Source the variable definitions file and the bash utility functions. +# +#----------------------------------------------------------------------- +# +. $USHdir/source_util_funcs.sh +source_config_for_task "cpl_aqm_parm" ${GLOBAL_VAR_DEFNS_FP} +. $USHdir/job_preamble.sh +# +#----------------------------------------------------------------------- +# +# 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 copies or fetches GFS surface +data files from disk, or HPSS. +========================================================================" +# +#----------------------------------------------------------------------- +# +# Set the external model start time +# +#----------------------------------------------------------------------- +# +export TIME_OFFSET_HRS=${NEXUS_GFS_SFC_OFFSET_HRS:-0} +yyyymmdd=${PDY} +hh=${cyc} +export GFS_SFC_CDATE=$( $DATE_UTIL --utc --date "${yyyymmdd} ${hh} UTC - ${TIME_OFFSET_HRS} hours" "+%Y%m%d%H" ) + +# +#----------------------------------------------------------------------- +# +# Check whether GFS_SFC_CDATE data files are available on the specified +# cycle date and time on HPSS. +# +#----------------------------------------------------------------------- +# +CDATE_min="2021032100" +if [ "$GFS_SFC_CDATE" -lt "$CDATE_min" ]; then + print_info_msg " +======================================================================== +GFS surface data (NetCDF) are not available on HPSS for this date. +CDATE: \"${GFS_SFC_CDATE}\" +CDATE_min: \"${CDATE_min}\" + +Therefore, this task will be skipped and MERRA2 data will be used for +NEXUS_EMISSION. +========================================================================" + + exit 0 +fi +# +#----------------------------------------------------------------------- +# +# Create the directory where the RAVE fire emission files should be stored +# +#----------------------------------------------------------------------- +# +export GFS_SFC_STAGING_DIR="${COMINext}/GFS_SFC" +mkdir_vrfy -p "${GFS_SFC_STAGING_DIR}" +# +#----------------------------------------------------------------------- +# +# Set the run directory +# +#----------------------------------------------------------------------- +# +DATA="${DATA:-${COMIN}${SLASH_ENSMEM_SUBDIR}}" +mkdir_vrfy -p "${DATA}" +# +#----------------------------------------------------------------------- +# +# Call the ex-script for this J-job and pass to it the necessary variables. +# +#----------------------------------------------------------------------- +# +$SCRIPTSdir/exregional_nexus_gfs_sfc.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/function. +# +#----------------------------------------------------------------------- +# +{ restore_shell_opts; } > /dev/null 2>&1 + diff --git a/jobs/JREGIONAL_NEXUS_POST_SPLIT b/jobs/JREGIONAL_NEXUS_POST_SPLIT new file mode 100755 index 0000000000..535b7187b0 --- /dev/null +++ b/jobs/JREGIONAL_NEXUS_POST_SPLIT @@ -0,0 +1,99 @@ +#!/bin/bash + +# +#----------------------------------------------------------------------- +# +# Source the variable definitions file and the bash utility functions. +# +#----------------------------------------------------------------------- +# +. $USHdir/source_util_funcs.sh +source_config_for_task "cpl_aqm_parm" ${GLOBAL_VAR_DEFNS_FP} +. $USHdir/job_preamble.sh +# +#----------------------------------------------------------------------- +# +# 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 generates the emission files +using NEXUS which will output for FV3 (in NetCDF format). +========================================================================" +# +#----------------------------------------------------------------------- +# +# Set the name of and create the directory in which the output from this +# script will be placed (if it doesn't already exist). +# +#----------------------------------------------------------------------- +# +if [ $RUN_ENVIR = "nco" ]; then + export INPUT_DATA="${COMIN}" +else + export INPUT_DATA="${COMIN}${SLASH_ENSMEM_SUBDIR}/INPUT" +fi +mkdir_vrfy -p "${INPUT_DATA}" +# +#----------------------------------------------------------------------- +# +# Set the run directory +# +#----------------------------------------------------------------------- +# +DATA="${DATA:-${COMIN}${SLASH_ENSMEM_SUBDIR}}" +mkdir_vrfy -p "${DATA}" +# +#----------------------------------------------------------------------- +# +# Call the ex-script for this J-job. +# +#----------------------------------------------------------------------- +# +$SCRIPTSdir/exregional_nexus_post_split.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 + diff --git a/jobs/JREGIONAL_POINT_SOURCE b/jobs/JREGIONAL_POINT_SOURCE new file mode 100755 index 0000000000..67cdb087c0 --- /dev/null +++ b/jobs/JREGIONAL_POINT_SOURCE @@ -0,0 +1,100 @@ +#!/bin/bash + +# +#----------------------------------------------------------------------- +# +# Source the variable definitions file and the bash utility functions. +# +#----------------------------------------------------------------------- +# +. $USHdir/source_util_funcs.sh +source_config_for_task "task_make_grid|task_run_fcst|cpl_aqm_parm" ${GLOBAL_VAR_DEFNS_FP} +. $USHdir/job_preamble.sh +# +#----------------------------------------------------------------------- +# +# 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 generates the emission files +using NEXUS which will output for FV3 (in NetCDF format). +========================================================================" +# +#----------------------------------------------------------------------- +# +# Set the name of and create the directory in which the output from this +# script will be placed (if it doesn't already exist). +# +#----------------------------------------------------------------------- +# +if [ $RUN_ENVIR = "nco" ]; then + export INPUT_DATA="${COMIN}" +else + export INPUT_DATA="${COMIN}${SLASH_ENSMEM_SUBDIR}" +fi +mkdir_vrfy -p "${INPUT_DATA}" +# +#----------------------------------------------------------------------- +# +# Set the run directory +# +#----------------------------------------------------------------------- +# +DATA="${DATA:-${COMIN}${SLASH_ENSMEM_SUBDIR}}" +mkdir_vrfy -p "${DATA}" +# +# +#----------------------------------------------------------------------- +# +# Call the ex-script for this J-job. +# +#----------------------------------------------------------------------- +# +time $SCRIPTSdir/exregional_point_source.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 + diff --git a/jobs/JREGIONAL_POST_STAT_O3 b/jobs/JREGIONAL_POST_STAT_O3 new file mode 100755 index 0000000000..44182bebf5 --- /dev/null +++ b/jobs/JREGIONAL_POST_STAT_O3 @@ -0,0 +1,94 @@ +#!/bin/bash + +# +#----------------------------------------------------------------------- +# +# This script runs POST-STAT-O3. +# +#----------------------------------------------------------------------- +# + +# +#----------------------------------------------------------------------- +# +# Source the variable definitions file and the bash utility functions. +# +#----------------------------------------------------------------------- +# +. $USHdir/source_util_funcs.sh +source_config_for_task "cpl_aqm_parm|task_run_post" ${GLOBAL_VAR_DEFNS_FP} +. $USHdir/job_preamble.sh +# +#----------------------------------------------------------------------- +# +# 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 POST-STAT-O3. +========================================================================" +# +#----------------------------------------------------------------------- +# +# Set the run directory. +# +#----------------------------------------------------------------------- +# +DATA="${DATA:-${COMIN}${SLASH_ENSMEM_SUBDIR}}" + +export PARMaqm_utils="${PARMaqm_utils:-${HOMEdir}/sorc/AQM-utils/parm}" +# +#----------------------------------------------------------------------- +# +# Call the ex-script for this J-job and pass to it the necessary varia- +# bles. +# +#----------------------------------------------------------------------- +# +$SCRIPTSdir/exregional_post_stat_o3.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 + diff --git a/jobs/JREGIONAL_POST_STAT_PM25 b/jobs/JREGIONAL_POST_STAT_PM25 new file mode 100755 index 0000000000..06f6ff4113 --- /dev/null +++ b/jobs/JREGIONAL_POST_STAT_PM25 @@ -0,0 +1,94 @@ +#!/bin/bash + +# +#----------------------------------------------------------------------- +# +# This script runs POST-STAT-PM25. +# +#----------------------------------------------------------------------- +# + +# +#----------------------------------------------------------------------- +# +# Source the variable definitions file and the bash utility functions. +# +#----------------------------------------------------------------------- +# +. $USHdir/source_util_funcs.sh +source_config_for_task "cpl_aqm_parm|task_run_post" ${GLOBAL_VAR_DEFNS_FP} +. $USHdir/job_preamble.sh +# +#----------------------------------------------------------------------- +# +# 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 POST-UPP-STAT. +========================================================================" +# +#----------------------------------------------------------------------- +# +# Set the run directory. +# +#----------------------------------------------------------------------- +# +DATA="${DATA:-${COMIN}${SLASH_ENSMEM_SUBDIR}}" + +export PARMaqm_utils="${PARMaqm_utils:-${HOMEdir}/sorc/AQM-utils/parm}" +# +#----------------------------------------------------------------------- +# +# Call the ex-script for this J-job and pass to it the necessary varia- +# bles. +# +#----------------------------------------------------------------------- +# +$SCRIPTSdir/exregional_post_stat_pm25.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 + diff --git a/jobs/JREGIONAL_PRE_POST_STAT b/jobs/JREGIONAL_PRE_POST_STAT new file mode 100755 index 0000000000..fbf0880773 --- /dev/null +++ b/jobs/JREGIONAL_PRE_POST_STAT @@ -0,0 +1,92 @@ +#!/bin/bash + +# +#----------------------------------------------------------------------- +# +# This script runs PRE-POST-STAT. +# +#----------------------------------------------------------------------- +# + +# +#----------------------------------------------------------------------- +# +# Source the variable definitions file and the bash utility functions. +# +#----------------------------------------------------------------------- +# +. $USHdir/source_util_funcs.sh +source_config_for_task "cpl_aqm_parm" ${GLOBAL_VAR_DEFNS_FP} +. $USHdir/job_preamble.sh +# +#----------------------------------------------------------------------- +# +# 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 POST-UPP-STAT. +========================================================================" +# +#----------------------------------------------------------------------- +# +# Set the run directory. +# +#----------------------------------------------------------------------- +# +DATA="${DATA:-${COMIN}${SLASH_ENSMEM_SUBDIR}}" +# +#----------------------------------------------------------------------- +# +# Call the ex-script for this J-job and pass to it the necessary varia- +# bles. +# +#----------------------------------------------------------------------- +# +$SCRIPTSdir/exregional_pre_post_stat.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 + diff --git a/scripts/exregional_aqm_ics.sh b/scripts/exregional_aqm_ics.sh new file mode 100755 index 0000000000..2a6262779c --- /dev/null +++ b/scripts/exregional_aqm_ics.sh @@ -0,0 +1,150 @@ +#!/bin/bash + +# +#----------------------------------------------------------------------- +# +# Source the variable definitions file and the bash utility functions. +# +#----------------------------------------------------------------------- +# +. $USHdir/source_util_funcs.sh +source_config_for_task "cpl_aqm_parm" ${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 copies/fetches to a local direc- +tory (either from disk or HPSS) the external model files from which ini- +tial or boundary condition files for the FV3 will be generated. +========================================================================" +# +#----------------------------------------------------------------------- +# +# Check if restart file exists +# +#----------------------------------------------------------------------- +# +rst_dir=${PREV_CYCLE_DIR}/RESTART +rst_file=fv_tracer.res.tile1.nc +fv_tracer_file=${rst_dir}/${PDY}.${cyc}0000.${rst_file} +print_info_msg " + Looking for tracer restart file: \"${fv_tracer_file}\"" +if [ ! -r ${fv_tracer_file} ]; then + if [ -r ${rst_dir}/coupler.res ]; then + rst_info=( $( tail -n 1 ${rst_dir}/coupler.res ) ) + rst_date=$( printf "%04d%02d%02d%02d" ${rst_info[@]:0:4} ) + print_info_msg " + Tracer file not found. Checking available restart date: + requested date: \"${PDY}${cyc}\" + available date: \"${rst_date}\"" + if [ "${rst_date}" = "${PDY}${cyc}" ] ; then + fv_tracer_file=${rst_dir}/${rst_file} + if [ -r ${fv_tracer_file} ]; then + print_info_msg " + Tracer file found: \"${fv_tracer_file}\"" + else + print_err_msg_exit "\ + No suitable tracer restart file found." + fi + fi + fi +fi +# +#----------------------------------------------------------------------- +# +# Move to work directory +# +#----------------------------------------------------------------------- +# +DATA="${DATA}/tmp_AQM_ICS" +mkdir_vrfy -p "$DATA" +cd_vrfy $DATA +# +#----------------------------------------------------------------------- +# +# Add air quality tracer variables from previous cycle's restart output +# to atmosphere's initial condition file according to the steps below: +# +# a. Python script to manipulate the files (see comments inside for +# details) +# b. Remove checksum attribute to prevent overflow +# +# c. Rename reulting file as the expected atmospheric IC file +# +#----------------------------------------------------------------------- +# +gfs_ic_file=${INPUT_DATA}/${NET}.${cycle}${dot_ensmem}.gfs_data.tile${TILE_RGNL}.halo${NH0}.nc +wrk_ic_file=${DATA}/gfs.nc + +print_info_msg " + Adding air quality tracers to atmospheric initial condition file: + tracer file: \"${fv_tracer_file}\" + FV3 IC file: \"${gfs_ic_file}\"" + +cp_vrfy ${gfs_ic_file} ${wrk_ic_file} +python3 ${HOMEdir}/sorc/AQM-utils/python_utils/add_aqm_ics.py --fv_tracer_file "${fv_tracer_file}" --wrk_ic_file "${wrk_ic_file}" + +ncatted -a checksum,,d,s, tmp1.nc || print_err_msg_exit "\ +Call to NCATTED returned with nonzero exit code." + +mv_vrfy tmp1.nc ${gfs_ic_file} + +rm_vrfy gfs.nc + +unset fv_tracer_file +unset wrk_ic_file +# +#----------------------------------------------------------------------- +# +# Print message indicating successful completion of script. +# +#----------------------------------------------------------------------- +# + print_info_msg " +======================================================================== +Successfully added air quality tracers to atmospheric initial condition +file!!! + +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 + diff --git a/scripts/exregional_aqm_lbcs.sh b/scripts/exregional_aqm_lbcs.sh new file mode 100755 index 0000000000..b27368bbcc --- /dev/null +++ b/scripts/exregional_aqm_lbcs.sh @@ -0,0 +1,234 @@ +#!/bin/bash + +# +#----------------------------------------------------------------------- +# +# Source the variable definitions file and the bash utility functions. +# +#----------------------------------------------------------------------- +# +. $USHdir/source_util_funcs.sh +source_config_for_task "task_get_extrn_lbcs|task_make_orog|task_make_lbcs|cpl_aqm_parm" ${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 generates chemical and GEFS +lateral boundary conditions. +========================================================================" +# +# Set OpenMP variables. +# +#----------------------------------------------------------------------- +# +export KMP_AFFINITY=${KMP_AFFINITY_MAKE_LBCS} +export OMP_NUM_THREADS=${OMP_NUM_THREADS_MAKE_LBCS} +export OMP_STACKSIZE=${OMP_STACKSIZE_MAKE_LBCS} +# +#----------------------------------------------------------------------- +# +# Set run command. +# +#----------------------------------------------------------------------- +# +eval ${PRE_TASK_CMDS} + +nprocs=$(( NNODES_AQM_LBCS*PPN_AQM_LBCS )) + +if [ -z "${RUN_CMD_UTILS:-}" ] ; then + print_err_msg_exit "\ + Run command was not set in machine file. \ + Please set RUN_CMD_UTILS for your platform" +else + print_info_msg "$VERBOSE" " + All executables will be submitted with command \'${RUN_CMD_UTILS}\'." +fi + +# +#----------------------------------------------------------------------- +# +# Move to working directory +# +#----------------------------------------------------------------------- +# +DATA="${DATA}/tmp_AQM_LBCS" +mkdir_vrfy -p "$DATA" +cd_vrfy $DATA +# +#----------------------------------------------------------------------- +# +# Add chemical LBCS +# +#----------------------------------------------------------------------- +# +yyyymmdd="${PDY}" +mm="${PDY:4:2}" + +if [ "${FCST_LEN_HRS}" = "-1" ]; then + for i_cdate in "${!ALL_CDATES[@]}"; do + if [ "${ALL_CDATES[$i_cdate]}" = "${PDY}${cyc}" ]; then + FCST_LEN_HRS="${FCST_LEN_CYCL[$i_cdate]}" + break + fi + done +fi +LBC_SPEC_FCST_HRS=() +for i_lbc in $(seq ${LBC_SPEC_INTVL_HRS} ${LBC_SPEC_INTVL_HRS} $(( FCST_LEN_HRS+LBC_SPEC_INTVL_HRS )) ); do + LBC_SPEC_FCST_HRS+=("$i_lbc") +done + +if [ ${DO_AQM_CHEM_LBCS} = "TRUE" ]; then + + ext_lbcs_file=${AQM_LBCS_FILES} + chem_lbcs_fn=${ext_lbcs_file///${mm}} + + chem_lbcs_fp=${AQM_LBCS_DIR}/${chem_lbcs_fn} + if [ -f ${chem_lbcs_fp} ]; then + #Copy the boundary condition file to the current location + cp_vrfy ${chem_lbcs_fp} . + else + print_err_msg_exit "\ +The chemical LBC files do not exist: + CHEM_BOUNDARY_CONDITION_FILE = \"${chem_lbcs_fp}\"" + fi + + for hr in 0 ${LBC_SPEC_FCST_HRS[@]}; do + fhr=$( printf "%03d" "${hr}" ) + if [ -r ${INPUT_DATA}/${NET}.${cycle}${dot_ensmem}.gfs_bndy.tile7.f${fhr}.nc ]; then + ncks -A ${chem_lbcs_fn} ${INPUT_DATA}/${NET}.${cycle}${dot_ensmem}.gfs_bndy.tile7.f${fhr}.nc + fi + done + + print_info_msg " +======================================================================== +Successfully added chemical LBCs !!! +========================================================================" +fi +# +#----------------------------------------------------------------------- +# +# Add GEFS-LBCS +# +#----------------------------------------------------------------------- +# +if [ ${DO_AQM_GEFS_LBCS} = "TRUE" ]; then + + RUN_CYC="${cyc}" + + if [ ${DO_REAL_TIME} = "TRUE" ]; then + CDATE_MOD=$( $DATE_UTIL --utc --date "${PDY} ${cyc} UTC - ${EXTRN_MDL_LBCS_OFFSET_HRS} hours" "+%Y%m%d%H" ) + PDY_MOD=${CDATE_MOD:0:8} + AQM_GEFS_CYC=$( printf "%02d" ${CDATE_MOD:8:2} ) + AQM_MOFILE_FN="${AQM_GEFS_DIR}/gefs.${PDY_MOD}/${AQM_GEFS_CYC}/chem/sfcsig/geaer.t${AQM_GEFS_CYC}z.atmf" + else + AQM_GEFS_CYC=$( printf "%02d" "${AQM_GEFS_CYC}" ) + AQM_MOFILE_FN="${AQM_GEFS_DIR}/${PDY}/${AQM_GEFS_CYC}/gfs.t00z.atmf" + fi + + GEFS_CYC_DIFF=$( printf "%02d" "$(( RUN_CYC - AQM_GEFS_CYC ))" ) + NUMTS="$(( FCST_LEN_HRS / LBC_SPEC_INTVL_HRS + 1 ))" + +cat > gefs2lbc-nemsio.ini < organic matter +'aorgcj' 1.0 'numacc' 6775815. +'oc2' 2 +'aorgcj' 1.0 'numacc' 6775815. +EOF + + exec_fn="gefs2lbc_para" + exec_fp="$EXECdir/${exec_fn}" + if [ ! -f "${exec_fp}" ]; then + print_err_msg_exit "\ +The executable (exec_fp) for GEFS LBCs does not exist: + exec_fp = \"${exec_fp}\" +Please ensure that you've built this executable." + fi +# +#---------------------------------------------------------------------- +# +# Run the executable +# +#---------------------------------------------------------------------- +# + PREP_STEP + eval ${RUN_CMD_UTILS} -n ${NUMTS} ${exec_fp} ${REDIRECT_OUT_ERR} || \ + print_err_msg_exit "\ +Call to executable (exec_fp) to generate chemical and GEFS LBCs +file for RRFS-CMAQ failed: + exec_fp = \"${exec_fp}\"" + POST_STEP + + print_info_msg " +======================================================================== +Successfully added GEFS aerosol LBCs !!! +========================================================================" +# +fi +# +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 + diff --git a/scripts/exregional_bias_correction_o3.sh b/scripts/exregional_bias_correction_o3.sh new file mode 100755 index 0000000000..834be680cb --- /dev/null +++ b/scripts/exregional_bias_correction_o3.sh @@ -0,0 +1,457 @@ +#!/bin/bash + +# +#----------------------------------------------------------------------- +# +# Source the variable definitions file and the bash utility functions. +# +#----------------------------------------------------------------------- +# +. $USHdir/source_util_funcs.sh +source_config_for_task "cpl_aqm_parm" ${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 BIAS-CORRECTION-O3. +========================================================================" +# +#----------------------------------------------------------------------- +# +# Set OpenMP variables. +# +#----------------------------------------------------------------------- +# +export KMP_AFFINITY=${KMP_AFFINITY_BIAS_CORRECTION_O3} +export OMP_NUM_THREADS=${OMP_NUM_THREADS_BIAS_CORRECTION_O3} +export OMP_STACKSIZE=${OMP_STACKSIZE_BIAS_CORRECTION_O3} +# +#----------------------------------------------------------------------- +# +# Set run command. +# +#----------------------------------------------------------------------- +# +eval ${PRE_TASK_CMDS} + +if [ -z "${RUN_CMD_SERIAL:-}" ] ; then + print_err_msg_exit "\ + Run command was not set in machine file. \ + Please set RUN_CMD_SERIAL for your platform" +else + RUN_CMD_SERIAL=$(eval echo ${RUN_CMD_SERIAL}) + print_info_msg "$VERBOSE" " + All executables will be submitted with command \'${RUN_CMD_SERIAL}\'." +fi + +# +#----------------------------------------------------------------------- +# +# Move to the working directory +# +#----------------------------------------------------------------------- +# +DATA="${DATA}/tmp_BIAS_CORRECTION_O3" +rm_vrfy -rf "$DATA" +mkdir_vrfy -p "$DATA" +cd_vrfy $DATA + +set -x + +yyyy=${PDY:0:4} +yyyymm=${PDY:0:6} +yyyy_m1=${PDYm1:0:4} +yyyymm_m1=${PDYm1:0:6} +yyyy_m2=${PDYm2:0:4} +yyyymm_m2=${PDYm2:0:6} +yyyy_m3=${PDYm3:0:4} +yyyymm_m3=${PDYm3:0:6} + +# +#----------------------------------------------------------------------- +# +# Bias correction: O3 +# +#----------------------------------------------------------------------- +# +if [ "${PREDEF_GRID_NAME}" = "AQM_NA_13km" ]; then + id_domain=793 +fi + +if [ "${FCST_LEN_HRS}" = "-1" ]; then + for i_cdate in "${!ALL_CDATES[@]}"; do + if [ "${ALL_CDATES[$i_cdate]}" = "${PDY}${cyc}" ]; then + FCST_LEN_HRS="${FCST_LEN_CYCL[$i_cdate]}" + break + fi + done +fi + +#----------------------------------------------------------------------------- +# STEP 1: Retrieve AIRNOW observation data +#----------------------------------------------------------------------------- + +# Link the historical airnow data +mkdir_vrfy -p "${DATA}/data" +ln_vrfy -sf ${AQM_AIRNOW_HIST_DIR}/bcdata* "${DATA}/data" +if [ -d "${DATA}/data/bcdata.${yyyymm}" ]; then + rm_vrfy -rf "${DATA}/data/bcdata.${yyyymm}" + mkdir_vrfy -p "${DATA}/data/bcdata.${yyyymm}" + cp_vrfy -rL "${AQM_AIRNOW_HIST_DIR}/bcdata.${yyyymm}/airnow" "${DATA}/data/bcdata.${yyyymm}" + cp_vrfy -rL "${AQM_AIRNOW_HIST_DIR}/bcdata.${yyyymm}/interpolated" "${DATA}/data/bcdata.${yyyymm}" +fi + +# Retrieve real-time airnow data for the last three days +if [ "${DO_REAL_TIME}" = "TRUE" ]; then + mkdir -p ${DATA}/data/bcdata.${yyyymm_m1}/airnow/${yyyy_m1}/${PDYm1}/b008 + mkdir -p ${DATA}/data/bcdata.${yyyymm_m2}/airnow/${yyyy_m2}/${PDYm2}/b008 + mkdir -p ${DATA}/data/bcdata.${yyyymm_m3}/airnow/${yyyy_m3}/${PDYm3}/b008 + + cp_vrfy ${COMINairnow}/${yyyy_m1}/${PDYm1}/b008/xx021 ${DATA}/data/bcdata.${yyyymm_m1}/airnow/${yyyy_m1}/${PDYm1}/b008 + cp_vrfy ${COMINairnow}/${yyyy_m2}/${PDYm2}/b008/xx021 ${DATA}/data/bcdata.${yyyymm_m2}/airnow/${yyyy_m2}/${PDYm2}/b008 + cp_vrfy ${COMINairnow}/${yyyy_m3}/${PDYm3}/b008/xx021 ${DATA}/data/bcdata.${yyyymm_m3}/airnow/${yyyy_m3}/${PDYm3}/b008 +fi + +#----------------------------------------------------------------------------- +# STEP 2: Extracting PM2.5, O3, and met variables from CMAQ input and outputs +#----------------------------------------------------------------------------- + +FCST_LEN_HRS=$( printf "%03d" ${FCST_LEN_HRS} ) +ic=1 +while [ $ic -lt 120 ]; do + if [ -s ${COMIN}/${NET}.${cycle}.chem_sfc.f${FCST_LEN_HRS}.nc ]; then + echo "cycle ${cyc} post1 is done!" + break + else + (( ic=ic+1 )) + fi +done + +if [ $ic -ge 120 ]; then + print_err_msg_exit "FATAL ERROR - COULD NOT LOCATE:${NET}.${cycle}.chem_sfc.f${FCST_LEN_HRS}.nc" +fi + +# remove any pre-exit ${NET}.${cycle}.chem_sfc/met_sfc.nc for 2-stage post processing +DATA_grid="${DATA}/data/bcdata.${yyyymm}/grid" +if [ -d "${DATA_grid}/${cyc}z/${PDY}" ]; then + rm_vrfy -rf "${DATA_grid}/${cyc}z/${PDY}" +fi + +mkdir_vrfy -p "${DATA_grid}/${cyc}z/${PDY}" +ln_vrfy -sf ${COMIN}/${NET}.${cycle}.chem_sfc.*.nc ${DATA_grid}/${cyc}z/${PDY} +ln_vrfy -sf ${COMIN}/${NET}.${cycle}.met_sfc.*.nc ${DATA_grid}/${cyc}z/${PDY} + +#----------------------------------------------------------------------------- +# STEP 3: Intepolating CMAQ O3 into AIRNow sites +#----------------------------------------------------------------------------- + +mkdir_vrfy -p ${DATA}/data/coords +mkdir_vrfy -p ${DATA}/data/site-lists.interp +mkdir_vrfy -p ${DATA}/out/ozone/${yyyy} +mkdir_vrfy -p ${DATA}/data/bcdata.${yyyymm}/interpolated/ozone/${yyyy} + +cp_vrfy ${PARMaqm_utils}/bias_correction/sites.valid.ozone.20220724.12z.list ${DATA}/data/site-lists.interp +cp_vrfy ${PARMaqm_utils}/bias_correction/aqm.t12z.chem_sfc.f000.nc ${DATA}/data/coords +cp_vrfy ${PARMaqm_utils}/bias_correction/config.interp.ozone.7-vars_${id_domain}.${cyc}z ${DATA} + +PREP_STEP +eval ${RUN_CMD_SERIAL} ${EXECdir}/aqm_bias_interpolate config.interp.ozone.7-vars_${id_domain}.${cyc}z ${cyc}z ${PDY} ${PDY} ${REDIRECT_OUT_ERR} || print_err_msg_exit "Call to executable to run AQM_BIAS_INTERPOLATE returned with nonzero exit code." +POST_STEP + +cp_vrfy ${DATA}/out/ozone/${yyyy}/*nc ${DATA}/data/bcdata.${yyyymm}/interpolated/ozone/${yyyy} + +#----------------------------------------------------------------------------- +# STEP 4: Performing Bias Correction for Ozone +#----------------------------------------------------------------------------- + +mkdir_vrfy -p ${DATA}/data/sites +cp_vrfy ${PARMaqm_utils}/bias_correction/config.ozone.bias_corr_${id_domain}.${cyc}z ${DATA} + +PREP_STEP +eval ${RUN_CMD_SERIAL} ${EXECdir}/aqm_bias_correct config.ozone.bias_corr_${id_domain}.${cyc}z ${cyc}z ${BC_STDAY} ${PDY} ${REDIRECT_OUT_ERR} || print_err_msg_exit "Call to executable to run AQM_BIAS_CORRECT returned with nonzero exit code." +POST_STEP + +cp_vrfy ${DATA}/out/ozone.corrected* ${COMIN} + +if [ "${cyc}" = "12" ]; then + cp_vrfy ${DATA}/sites/sites.valid.ozone.${PDY}.${cyc}z.list ${DATA} +fi + +#----------------------------------------------------------------------------- +# STEP 5: converting netcdf to grib format +#----------------------------------------------------------------------------- + +ln_vrfy -sf ${COMIN}/ozone.corrected.${PDY}.${cyc}z.nc . + +# +cat >bias_cor.ini <bias_cor_max.ini < filesize + export XLFRTEOPTS="unit_vars=yes" + export FORT11=${NET}.${cycle}.max_${hr}hr_o3_bc.227.grib2 + export FORT12="filesize" + export FORT31= + export FORT51=${NET}-${hr}hro3-maxi.227.grib2.temp + tocgrib2super < ${PARMaqm_utils}/wmo/grib2_aqm-${hr}hro3-maxi.${cycle}.227 + + echo `ls -l ${NET}-${hr}hro3-maxi.227.grib2.temp | awk '{print $5} '` > filesize + export XLFRTEOPTS="unit_vars=yes" + export FORT11=${NET}-${hr}hro3-maxi.227.grib2.temp + export FORT12="filesize" + export FORT31= + export FORT51=awpaqm.${cycle}.${hr}ho3-max-bc.227.grib2 + tocgrib2super < ${PARMaqm_utils}/wmo/grib2_aqm-${hr}hro3-maxi.${cycle}.227 + done + + # Post Files to COMOUT + cp_vrfy awpaqm.${cycle}.*o3-max-bc.227.grib2 ${COMOUT} + + # Distribute Data + if [ "${SENDDBN_NTC}" = "YES" ] ; then + ${DBNROOT}/bin/dbn_alert ${DBNALERT_TYPE} ${NET} ${job} ${COMOUT}/awpaqm.${cycle}.1ho3-max-bc.227.grib2 + ${DBNROOT}/bin/dbn_alert ${DBNALERT_TYPE} ${NET} ${job} ${COMOUT}/awpaqm.${cycle}.8ho3-max-bc.227.grib2 + fi + fi +fi + +#------------------------------------- +rm_vrfy -rf tmpfile + +fhr=01 +while [ "${fhr}" -le "${FCST_LEN_HRS}" ]; do + fhr2d=$( printf "%02d" "${fhr}" ) + + cp_vrfy ${DATA}/${NET}.${cycle}.awpozcon_bc.f${fhr2d}.${id_domain}.grib2 ${COMOUT} + + # create GRIB file to convert to grid 227 then to GRIB2 for NDFD + cat ${DATA}/${NET}.${cycle}.awpozcon_bc.f${fhr2d}.${id_domain}.grib2 >> tmpfile + if [ "${fhr}" -le "07" ]; then + cat ${DATA}/${NET}.${cycle}.awpozcon_bc.f${fhr2d}.${id_domain}.grib2 >> tmpfile.1hr + else + wgrib2 ${DATA}/${NET}.${cycle}.awpozcon_bc.f${fhr2d}.${id_domain}.grib2 -d 1 -append -grib tmpfile.1hr + wgrib2 ${DATA}/${NET}.${cycle}.awpozcon_bc.f${fhr2d}.${id_domain}.grib2 -d 2 -append -grib tmpfile.8hr + fi + (( fhr=fhr+1 )) +done + +############### +# Convert ozone Concentration to grid 227 in GRIB2 format +############### +echo ' &NLCOPYGB IDS(180)=1, /' > ozcon_scale + +newgrib2file1=${NET}.${cycle}.ave_1hr_o3_bc.227.grib2 +newgrib2file2=${NET}.${cycle}.ave_8hr_o3_bc.227.grib2 + +grid227="lambert:265.0000:25.0000:25.0000 226.5410:1473:5079.000 12.1900:1025:5079.000" + +wgrib2 tmpfile.1hr -set_grib_type same -new_grid_winds earth -new_grid ${grid227} ${newgrib2file1} +cp_vrfy tmpfile.1hr ${COMOUT}/${NET}.${cycle}.ave_1hr_o3_bc.${id_domain}.grib2 +cp_vrfy ${NET}.${cycle}.ave_1hr_o3_bc.227.grib2 ${COMOUT} + +if [ "${cyc}" = "06" ] || [ "${cyc}" = "12" ]; then + wgrib2 tmpfile.8hr -set_grib_type same -new_grid_winds earth -new_grid ${grid227} ${newgrib2file2} + cp_vrfy tmpfile.8hr ${COMOUT}/${NET}.${cycle}.ave_8hr_o3_bc.${id_domain}.grib2 + cp_vrfy ${NET}.${cycle}.ave_8hr_o3_bc.227.grib2 ${COMOUT} +fi + +if [ "${SENDDBN}" = "YES" ] ; then + ${DBNROOT}/bin/dbn_alert MODEL AQM_CONC ${job} ${COMOUT}/${NET}.${cycle}.ave_1hr_o3_bc.227.grib2 + if [ "${cyc}" = "06" ] || [ "${cyc}" = "12" ]; then + ${DBNROOT}/bin/dbn_alert MODEL AQM_CONC ${job} ${COMOUT}/${NET}.${cycle}.ave_8hr_o3_bc.227.grib2 + fi +fi + +################################################# +# Part III: Insert WMO header to GRIB files +################################################# + +if [ "${cyc}" = "06" ] || [ "${cyc}" = "12" ]; then + # Create AWIPS GRIB data for 1hr and 8hr ave ozone + for hr in 1 8; do + echo 0 > filesize + export XLFRTEOPTS="unit_vars=yes" + export FORT11=${NET}.${cycle}.ave_${hr}hr_o3_bc.227.grib2 + export FORT12="filesize" + export FORT31= + export FORT51=grib2.${cycle}.awpcsozcon_aqm_${hr}-bc.temp + tocgrib2super < ${PARMaqm_utils}/wmo/grib2_aqm_ave_${hr}hr_o3_bc-awpozcon.${cycle}.227 + + echo `ls -l grib2.${cycle}.awpcsozcon_aqm_${hr}-bc.temp | awk '{print $5} '` > filesize + export XLFRTEOPTS="unit_vars=yes" + export FORT11=grib2.${cycle}.awpcsozcon_aqm_${hr}-bc.temp + export FORT12="filesize" + export FORT31= + export FORT51=awpaqm.${cycle}.${hr}ho3-bc.227.grib2 + tocgrib2super < ${PARMaqm_utils}/wmo/grib2_aqm_ave_${hr}hr_o3_bc-awpozcon.${cycle}.227 + + # Create AWIPS GRIB data for dailly 1-hr and 8hr max ozone + echo 0 > filesize + export XLFRTEOPTS="unit_vars=yes" + export FORT11=${NET}.${cycle}.max_${hr}hr_o3_bc.227.grib2 + export FORT12="filesize" + export FORT31= + export FORT51=${NET}.${cycle}.max_${hr}hr_o3-bc.227.grib2.temp + tocgrib2super < ${PARMaqm_utils}/wmo/grib2_aqm-${hr}hro3_bc-maxi.${cycle}.227 + + echo `ls -l ${NET}.${cycle}.max_${hr}hr_o3-bc.227.grib2.temp | awk '{print $5} '` > filesize + export XLFRTEOPTS="unit_vars=yes" + export FORT11=${NET}.${cycle}.max_${hr}hr_o3-bc.227.grib2.temp + export FORT12="filesize" + export FORT31= + export FORT51=awpaqm.${cycle}.${hr}ho3-max-bc.227.grib2 + tocgrib2super < ${PARMaqm_utils}/wmo/grib2_aqm-${hr}hro3_bc-maxi.${cycle}.227 + + # Post Files to COMOUT + cp_vrfy awpaqm.${cycle}.${hr}ho3-bc.227.grib2 ${COMOUT} + cp_vrfy awpaqm.${cycle}.${hr}ho3-max-bc.227.grib2 ${COMOUT} + + # Distribute Data + if [ "${SENDDBN}" = "YES" ]; then + ${DBNROOT}/bin/dbn_alert ${DBNALERT_TYPE} ${NET} ${job} ${COMOUT}/awpaqm.${cycle}.${hr}ho3-bc.227.grib2 + ${DBNROOT}/bin/dbn_alert ${DBNALERT_TYPE} ${NET} ${job} ${COMOUT}/awpaqm.${cycle}.${hr}ho3-max-bc.227.grib2 + fi + done +fi + +# +#----------------------------------------------------------------------- +# +# Print message indicating successful completion of script. +# +#----------------------------------------------------------------------- +# +print_info_msg " +======================================================================== +BIAS-CORRECTION-O3 completed successfully. + +Exiting script: \"${scrfunc_fn}\" +In directory: \"${scrfunc_dir}\" +========================================================================" +# +#----------------------------------------------------------------------- +# +{ restore_shell_opts; } > /dev/null 2>&1 diff --git a/scripts/exregional_bias_correction_pm25.sh b/scripts/exregional_bias_correction_pm25.sh new file mode 100755 index 0000000000..a8e3ccb53e --- /dev/null +++ b/scripts/exregional_bias_correction_pm25.sh @@ -0,0 +1,433 @@ +#!/bin/bash + +# +#----------------------------------------------------------------------- +# +# Source the variable definitions file and the bash utility functions. +# +#----------------------------------------------------------------------- +# +. $USHdir/source_util_funcs.sh +source_config_for_task "cpl_aqm_parm" ${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 BIAS-CORRECTION-PM25. +========================================================================" +# +#----------------------------------------------------------------------- +# +# Set OpenMP variables. +# +#----------------------------------------------------------------------- +# +export KMP_AFFINITY=${KMP_AFFINITY_BIAS_CORRECTION_PM25} +export OMP_NUM_THREADS=${OMP_NUM_THREADS_BIAS_CORRECTION_PM25} +export OMP_STACKSIZE=${OMP_STACKSIZE_BIAS_CORRECTION_PM25} +# +#----------------------------------------------------------------------- +# +# Set run command. +# +#----------------------------------------------------------------------- +# +eval ${PRE_TASK_CMDS} + +if [ -z "${RUN_CMD_SERIAL:-}" ] ; then + print_err_msg_exit "\ + Run command was not set in machine file. \ + Please set RUN_CMD_SERIAL for your platform" +else + RUN_CMD_SERIAL=$(eval echo ${RUN_CMD_SERIAL}) + print_info_msg "$VERBOSE" " + All executables will be submitted with command \'${RUN_CMD_SERIAL}\'." +fi + +# +#----------------------------------------------------------------------- +# +# Move to the working directory +# +#----------------------------------------------------------------------- +# +DATA="${DATA}/tmp_BIAS_CORRECTION_PM25" +rm_vrfy -rf $DATA +mkdir_vrfy -p "$DATA" +cd_vrfy $DATA + +set -x + +yyyy=${PDY:0:4} +yyyymm=${PDY:0:6} +yyyy_m1=${PDYm1:0:4} +yyyymm_m1=${PDYm1:0:6} +yyyy_m2=${PDYm2:0:4} +yyyymm_m2=${PDYm2:0:6} +yyyy_m3=${PDYm3:0:4} +yyyymm_m3=${PDYm3:0:6} + +# +#----------------------------------------------------------------------- +# +# Bias correction: PM25 +# +#----------------------------------------------------------------------- +# +if [ "${PREDEF_GRID_NAME}" = "AQM_NA_13km" ]; then + id_domain=793 +fi + +if [ "${FCST_LEN_HRS}" = "-1" ]; then + for i_cdate in "${!ALL_CDATES[@]}"; do + if [ "${ALL_CDATES[$i_cdate]}" = "${PDY}${cyc}" ]; then + FCST_LEN_HRS="${FCST_LEN_CYCL[$i_cdate]}" + break + fi + done +fi + +#----------------------------------------------------------------------------- +# STEP 1: Retrieve AIRNOW observation data +#----------------------------------------------------------------------------- + +# Link the historical airnow data +mkdir_vrfy -p "${DATA}/data" +ln_vrfy -sf ${AQM_AIRNOW_HIST_DIR}/bcdata* "${DATA}/data" +if [ -d "${DATA}/data/bcdata.${yyyymm}" ]; then + rm_vrfy -rf "${DATA}/data/bcdata.${yyyymm}" + mkdir_vrfy -p "${DATA}/data/bcdata.${yyyymm}" + cp_vrfy -rL "${AQM_AIRNOW_HIST_DIR}/bcdata.${yyyymm}/airnow" "${DATA}/data/bcdata.${yyyymm}" + cp_vrfy -rL "${AQM_AIRNOW_HIST_DIR}/bcdata.${yyyymm}/interpolated" "${DATA}/data/bcdata.${yyyymm}" +fi + +# Retrieve real-time airnow data for the last three days +if [ "${DO_REAL_TIME}" = "TRUE" ]; then + mkdir -p ${DATA}/data/bcdata.${yyyymm_m1}/airnow/${yyyy_m1}/${PDYm1}/b008 + mkdir -p ${DATA}/data/bcdata.${yyyymm_m2}/airnow/${yyyy_m2}/${PDYm2}/b008 + mkdir -p ${DATA}/data/bcdata.${yyyymm_m3}/airnow/${yyyy_m3}/${PDYm3}/b008 + + cp_vrfy ${COMINairnow}/${yyyy_m1}/${PDYm1}/b008/xx031 ${DATA}/data/bcdata.${yyyymm_m1}/airnow/${yyyy_m1}/${PDYm1}/b008 + cp_vrfy ${COMINairnow}/${yyyy_m2}/${PDYm2}/b008/xx031 ${DATA}/data/bcdata.${yyyymm_m2}/airnow/${yyyy_m2}/${PDYm2}/b008 + cp_vrfy ${COMINairnow}/${yyyy_m3}/${PDYm3}/b008/xx031 ${DATA}/data/bcdata.${yyyymm_m3}/airnow/${yyyy_m3}/${PDYm3}/b008 +fi + +#----------------------------------------------------------------------------- +# STEP 2: Extracting PM2.5, O3, and met variables from CMAQ input and outputs +#----------------------------------------------------------------------------- + +FCST_LEN_HRS=$( printf "%03d" ${FCST_LEN_HRS} ) +ic=1 +while [ $ic -lt 120 ]; do + if [ -s ${COMIN}/${NET}.${cycle}.chem_sfc.f${FCST_LEN_HRS}.nc ]; then + echo "cycle ${cyc} post1 is done!" + break + else + (( ic=ic+1 )) + fi +done + +if [ $ic -ge 120 ]; then + print_err_msg_exit "FATAL ERROR - COULD NOT LOCATE:${NET}.${cycle}.chem_sfc.f${FCST_LEN_HRS}.nc" +fi + +# remove any pre-exit ${NET}.${cycle}.chem_sfc/met_sfc.nc for 2-stage post processing +DATA_grid="${DATA}/data/bcdata.${yyyymm}/grid" +if [ -d "${DATA_grid}/${cyc}z/${PDY}" ]; then + rm_vrfy -rf "${DATA_grid}/${cyc}z/${PDY}" +fi + +mkdir_vrfy -p "${DATA_grid}/${cyc}z/${PDY}" +ln_vrfy -sf ${COMIN}/${NET}.${cycle}.chem_sfc.*.nc ${DATA_grid}/${cyc}z/${PDY} +ln_vrfy -sf ${COMIN}/${NET}.${cycle}.met_sfc.*.nc ${DATA_grid}/${cyc}z/${PDY} + +#----------------------------------------------------------------------- +# STEP 3: Intepolating CMAQ PM2.5 into AIRNow sites +#----------------------------------------------------------------------- + +mkdir_vrfy -p ${DATA}/data/coords +mkdir_vrfy -p ${DATA}/data/site-lists.interp +mkdir_vrfy -p ${DATA}/out/pm25/${yyyy} +mkdir_vrfy -p ${DATA}/data/bcdata.${yyyymm}/interpolated/pm25/${yyyy} + +cp_vrfy ${PARMaqm_utils}/bias_correction/sites.valid.pm25.20220724.12z.list ${DATA}/data/site-lists.interp +cp_vrfy ${PARMaqm_utils}/bias_correction/aqm.t12z.chem_sfc.f000.nc ${DATA}/data/coords +cp_vrfy ${PARMaqm_utils}/bias_correction/config.interp.pm2.5.5-vars_${id_domain}.${cyc}z ${DATA} + +PREP_STEP +eval ${RUN_CMD_SERIAL} ${EXECdir}/aqm_bias_interpolate config.interp.pm2.5.5-vars_${id_domain}.${cyc}z ${cyc}z ${PDY} ${PDY} ${REDIRECT_OUT_ERR} || print_err_msg_exit "Call to executable to run AQM_BIAS_INTERPOLATE returned with nonzero exit code." +POST_STEP + +cp_vrfy ${DATA}/out/pm25/${yyyy}/*nc ${DATA}/data/bcdata.${yyyymm}/interpolated/pm25/${yyyy} + +#----------------------------------------------------------------------- +# STEP 4: Performing Bias Correction for PM2.5 +#----------------------------------------------------------------------- + +mkdir_vrfy -p ${DATA}/data/sites + +cp_vrfy ${PARMaqm_utils}/bias_correction/config.pm2.5.bias_corr_${id_domain}.${cyc}z ${DATA} +cp_vrfy ${PARMaqm_utils}/bias_correction/site_blocking.pm2.5.2021.0427.2-sites.txt ${DATA} +cp_vrfy ${PARMaqm_utils}/bias_correction/bias_thresholds.pm2.5.2015.1030.32-sites.txt ${DATA} + +PREP_STEP +eval ${RUN_CMD_SERIAL} ${EXECdir}/aqm_bias_correct config.pm2.5.bias_corr_${id_domain}.${cyc}z ${cyc}z ${BC_STDAY} ${PDY} ${REDIRECT_OUT_ERR} || print_err_msg_exit "Call to executable to run AQM_BIAS_CORRECT returned with nonzero exit code." +POST_STEP + +cp_vrfy $DATA/out/pm2.5.corrected* ${COMIN} + +if [ "${cyc}" = "12" ]; then + cp_vrfy ${DATA}/sites/sites.valid.pm25.${PDY}.${cyc}z.list ${DATA} +fi + +#------------------------------------------------------------------------ +# STEP 5: converting netcdf to grib format +#------------------------------------------------------------------------ + +ln_vrfy -sf ${COMIN}/pm2.5.corrected.${PDY}.${cyc}z.nc . + +# convert from netcdf to grib2 format +cat >bias_cor.ini <bias_cor_max.ini <> tmpfile_pm25_bc + (( fhr=fhr+1 )) +done + +grid227="lambert:265.0000:25.0000:25.0000 226.5410:1473:5079.000 12.1900:1025:5079.000" +wgrib2 tmpfile_pm25_bc -set_grib_type same -new_grid_winds earth -new_grid ${grid227} ${NET}.${cycle}.grib2_pm25_bc.227 + +cp_vrfy tmpfile_pm25_bc ${COMOUT}/${NET}.${cycle}.ave_1hr_pm25_bc.${id_domain}.grib2 +cp_vrfy ${NET}.${cycle}.grib2_pm25_bc.227 ${COMOUT}/${NET}.${cycle}.ave_1hr_pm25_bc.227.grib2 +if [ "${SENDDBN}" = "YES" ]; then + ${DBNROOT}/bin/dbn_alert MODEL AQM_PM ${job} ${COMOUT}/${NET}.${cycle}.ave_1hr_pm25_bc.227.grib2 +fi + +#-------------------------------------------------------------- +# STEP 7: adding WMO header +#-------------------------------------------------------------- + +# Create AWIPS GRIB2 data for Bias-Corrected PM2.5 +if [ "${cyc}" = "06" ] || [ "${cyc}" = "12" ]; then + echo 0 > filesize + export XLFRTEOPTS="unit_vars=yes" + export FORT11=${NET}.${cycle}.grib2_pm25_bc.227 + export FORT12="filesize" + export FORT31= + export FORT51=${NET}.${cycle}.grib2_pm25_bc.227.temp + tocgrib2super < ${PARMaqm_utils}/wmo/grib2_aqm_pm25_bc.${cycle}.227 + + echo `ls -l ${NET}.${cycle}.grib2_pm25_bc.227.temp | awk '{print $5} '` > filesize + export XLFRTEOPTS="unit_vars=yes" + export FORT11=${NET}.${cycle}.grib2_pm25_bc.227.temp + export FORT12="filesize" + export FORT31= + export FORT51=awpaqm.${cycle}.1hpm25-bc.227.grib2 + tocgrib2super < ${PARMaqm_utils}/wmo/grib2_aqm_pm25_bc.${cycle}.227 + + #################################################### + rm_vrfy -f filesize + echo 0 > filesize + export XLFRTEOPTS="unit_vars=yes" + export FORT11=${NET}.${cycle}.max_1hr_pm25_bc.227.grib2 + export FORT12="filesize" + export FORT31= + export FORT51=${NET}.${cycle}.max_1hr_pm25_bc.227.grib2.temp + tocgrib2super < ${PARMaqm_utils}/wmo/grib2_aqm_max_1hr_pm25_bc.${cycle}.227 + + echo `ls -l ${NET}.${cycle}.max_1hr_pm25_bc.227.grib2.temp | awk '{print $5} '` > filesize + export XLFRTEOPTS="unit_vars=yes" + export FORT11=${NET}.${cycle}.max_1hr_pm25_bc.227.grib2.temp + export FORT12="filesize" + export FORT31= + export FORT51=awpaqm.${cycle}.daily-1hr-pm25-max-bc.227.grib2 + tocgrib2super < ${PARMaqm_utils}/wmo/grib2_aqm_max_1hr_pm25_bc.${cycle}.227 + + rm_vrfy -f filesize + # daily_24hr_ave_PM2.5 + echo 0 > filesize + export XLFRTEOPTS="unit_vars=yes" + export FORT11=${NET}.${cycle}.ave_24hr_pm25_bc.227.grib2 + export FORT12="filesize" + export FORT31= + export FORT51=${NET}.${cycle}.ave_24hr_pm25_bc.227.grib2.temp + tocgrib2super < ${PARMaqm_utils}/wmo/grib2_aqm_ave_24hrpm25_bc_awp.${cycle}.227 + + echo `ls -l ${NET}.${cycle}.ave_24hr_pm25_bc.227.grib2.temp | awk '{print $5} '` > filesize + export XLFRTEOPTS="unit_vars=yes" + export FORT11=${NET}.${cycle}.ave_24hr_pm25_bc.227.grib2.temp + export FORT12="filesize" + export FORT31= + export FORT51=awpaqm.${cycle}.24hr-pm25-ave-bc.227.grib2 + tocgrib2super < ${PARMaqm_utils}/wmo/grib2_aqm_ave_24hrpm25_bc_awp.${cycle}.227 + + # Post Files to COMOUT + cp_vrfy awpaqm.${cycle}.1hpm25-bc.227.grib2 ${COMOUT} + cp_vrfy awpaqm.${cycle}.daily-1hr-pm25-max-bc.227.grib2 ${COMOUT} + cp_vrfy awpaqm.${cycle}.24hr-pm25-ave-bc.227.grib2 ${COMOUT} + + # Distribute Data + if [ "${SENDDBN_NTC}" = "YES" ] ; then + ${DBNROOT}/bin/dbn_alert ${DBNALERT_TYPE} ${NET} ${job} ${COMOUT}/awpaqm.${cycle}.1hpm25-bc.227.grib2 + ${DBNROOT}/bin/dbn_alert ${DBNALERT_TYPE} ${NET} ${job} ${COMOUT}/awpaqm.${cycle}.daily-1hr-pm25-max-bc.227.grib2 + ${DBNROOT}/bin/dbn_alert ${DBNALERT_TYPE} ${NET} ${job} ${COMOUT}/awpaqm.${cycle}.24hr-pm25-ave-bc.227.grib2 + fi +fi + +# +#----------------------------------------------------------------------- +# +# Print message indicating successful completion of script. +# +#----------------------------------------------------------------------- +# +print_info_msg " +======================================================================== +BIAS-CORRECTION-PM25 completed successfully. + +Exiting script: \"${scrfunc_fn}\" +In directory: \"${scrfunc_dir}\" +========================================================================" +# +#----------------------------------------------------------------------- +# +{ restore_shell_opts; } > /dev/null 2>&1 diff --git a/scripts/exregional_fire_emission.sh b/scripts/exregional_fire_emission.sh new file mode 100755 index 0000000000..125a6a8623 --- /dev/null +++ b/scripts/exregional_fire_emission.sh @@ -0,0 +1,90 @@ +#!/bin/bash + +# +#----------------------------------------------------------------------- +# +# Source the variable definitions file and the bash utility functions. +# +#----------------------------------------------------------------------- +# +. $USHdir/source_util_funcs.sh +source_config_for_task "cpl_aqm_parm" ${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 copies or fetches fire emission +data files from disk or HPSS. +========================================================================" +# +#----------------------------------------------------------------------- +# +# Set up variables for call to retrieve_data.py +# +#----------------------------------------------------------------------- +# +yyyymmdd=${FIRE_FILE_CDATE:0:8} +hh=${FIRE_FILE_CDATE:8:2} +# +#----------------------------------------------------------------------- +# +# Retrieve fire files to FIRE_EMISSION_STAGING_DIR +# +#----------------------------------------------------------------------- +# +aqm_fire_file_fn="${AQM_FIRE_FILE_PREFIX}_${yyyymmdd}_t${hh}z${AQM_FIRE_FILE_SUFFIX}" + +# Check if the file exists in the designated directory +if [ -e "${AQM_FIRE_DIR}/${yyyymmdd}/${aqm_fire_file_fn}" ]; then + cp_vrfy "${AQM_FIRE_DIR}/${yyyymmdd}/${aqm_fire_file_fn}" "${FIRE_EMISSION_STAGING_DIR}" +else + # Retrieve files from HPSS + arcv_dir="/NCEPDEV/emc-naqfc/2year/Kai.Wang/RAVE_fire/RAVE_NA" + arcv_fp="${arcv_dir}/${aqm_fire_file_fn}" + + hsi_log_fn="log.hsi_get.${yyyymmdd}_${hh}" + hsi get ${arcv_fp} >& ${hsi_log_fn} || \ + print_err_msg_exit "\ +htar file reading operation (\"hsi get ...\") failed. Check the log +file hsi_log_fn in the staging directory (fire_emission_staging_dir) for +details: + fire_emission_staging_dir = \"${FIRE_EMISSION_STAGING_DIR}\" + hsi_log_fn = \"${hsi_log_fn}\"" +fi +# +#----------------------------------------------------------------------- +# +# Restore the shell options saved at the beginning of this script/function. +# +#----------------------------------------------------------------------- +# +{ restore_shell_opts; } > /dev/null 2>&1 diff --git a/scripts/exregional_nexus_emission.sh b/scripts/exregional_nexus_emission.sh new file mode 100755 index 0000000000..99c487b266 --- /dev/null +++ b/scripts/exregional_nexus_emission.sh @@ -0,0 +1,316 @@ +#!/bin/bash + +# +#----------------------------------------------------------------------- +# +# Source the variable definitions file and the bash utility functions. +# +#----------------------------------------------------------------------- +# +. $USHdir/source_util_funcs.sh +source_config_for_task "cpl_aqm_parm" ${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 NEXUS. +========================================================================" +# +#----------------------------------------------------------------------- +# +# Set OpenMP variables. +# +#----------------------------------------------------------------------- +# +export KMP_AFFINITY=${KMP_AFFINITY_NEXUS_EMISSION} +export OMP_NUM_THREADS=${OMP_NUM_THREADS_NEXUS_EMISSION} +export OMP_STACKSIZE=${OMP_STACKSIZE_NEXUS_EMISSION} +# +#----------------------------------------------------------------------- +# +# Set run command. +# +#----------------------------------------------------------------------- +# +set -x +eval ${PRE_TASK_CMDS} + +nprocs=$(( NNODES_NEXUS_EMISSION*PPN_NEXUS_EMISSION )) +ppn_run_aqm="${PPN_NEXUS_EMISSION}" +omp_num_threads_run_aqm="${OMP_NUM_THREADS_NEXUS_EMISSION}" + +if [ -z "${RUN_CMD_AQM:-}" ] ; then + print_err_msg_exit "\ + Run command was not set in machine file. \ + Please set RUN_CMD_AQM for your platform" +else + RUN_CMD_AQM=$(eval echo ${RUN_CMD_AQM}) + print_info_msg "$VERBOSE" " + All executables will be submitted with command \'${RUN_CMD_AQM}\'." +fi +# +#----------------------------------------------------------------------- +# +# Move to the NEXUS working directory +# +#----------------------------------------------------------------------- +# +DATA="${DATA}/tmp_NEXUS/${nspt}" +mkdir_vrfy -p "$DATA" + +DATAinput="${DATA}/input" +mkdir_vrfy -p "$DATAinput" + +cd_vrfy $DATA +# +#----------------------------------------------------------------------- +# +# Link GFS surface data files to the tmp directory if they exist +# +#----------------------------------------------------------------------- +# +USE_GFS_SFC="FALSE" +if [ -d "${COMINext}/GFS_SFC" ]; then + if [ "$(ls -A ${COMINext}/GFS_SFC)" ]; then + ln_vrfy -sf "${COMINext}/GFS_SFC" . + USE_GFS_SFC="TRUE" + fi +fi + +# +#----------------------------------------------------------------------- +# +# Copy the NEXUS config files to the tmp directory +# +#----------------------------------------------------------------------- +# +cp_vrfy ${EXECdir}/nexus ${DATA} +cp_vrfy ${NEXUS_FIX_DIR}/${NEXUS_GRID_FN} ${DATA}/grid_spec.nc + + +if [ "${USE_GFS_SFC}" = "TRUE" ]; then + cp_vrfy ${ARL_NEXUS_DIR}/config/cmaq_gfs_megan/*.rc ${DATA} +else + cp_vrfy ${ARL_NEXUS_DIR}/config/cmaq/*.rc ${DATA} +fi +# +#----------------------------------------------------------------------- +# +# Get the starting and ending year, month, day, and hour of the emission +# time series. +# +#----------------------------------------------------------------------- +# +mm="${PDY:4:2}" +dd="${PDY:6:2}" +hh="${cyc}" +yyyymmdd="${PDY}" + +NUM_SPLIT_NEXUS=$( printf "%02d" ${NUM_SPLIT_NEXUS} ) +if [ "${FCST_LEN_HRS}" = "-1" ]; then + for i_cdate in "${!ALL_CDATES[@]}"; do + if [ "${ALL_CDATES[$i_cdate]}" = "${PDY}${cyc}" ]; then + FCST_LEN_HRS="${FCST_LEN_CYCL[$i_cdate]}" + break + fi + done +fi + +if [ "${NUM_SPLIT_NEXUS}" = "01" ]; then + start_date=$( $DATE_UTIL --utc --date "${yyyymmdd} ${hh} UTC" "+%Y%m%d%H" ) + end_date=$( $DATE_UTIL --utc --date "${yyyymmdd} ${hh} UTC + ${FCST_LEN_HRS} hours" "+%Y%m%d%H" ) +else + len_per_split=$(( FCST_LEN_HRS / NUM_SPLIT_NEXUS )) + nsptp=$(( nspt+1 )) + + # Compute start and end dates for nexus split option + start_del_hr=$(( len_per_split * nspt )) + start_date=$( $DATE_UTIL --utc --date "${yyyymmdd} ${hh} UTC + ${start_del_hr} hours " "+%Y%m%d%H" ) + if [ "${nsptp}" = "${NUM_SPLIT_NEXUS}" ];then + end_date=$( $DATE_UTIL --utc --date "${yyyymmdd} ${hh} UTC + ${FCST_LEN_HRS} hours" "+%Y%m%d%H" ) + else + end_del_hr=$(( len_per_split * nsptp )) + end_date=$( $DATE_UTIL --utc --date "${yyyymmdd} ${hh} UTC + ${end_del_hr} hours" "+%Y%m%d%H" ) + fi +fi +# +####################################################################### +# This will be the section to set the datasets used in $workdir/NEXUS_Config.rc +# All Datasets in that file need to be placed here as it will link the files +# necessary to that folder. In the future this will be done by a get_nexus_input +# script +NEI2016="TRUE" +TIMEZONES="TRUE" +CEDS="TRUE" +HTAP2010="TRUE" +OMIHTAP="TRUE" +MASKS="TRUE" +NOAAGMD="TRUE" +SOA="TRUE" +EDGAR="TRUE" +MEGAN="TRUE" +MODIS_XLAI="TRUE" +OLSON_MAP="TRUE" +Yuan_XLAI="TRUE" +GEOS="TRUE" +AnnualScalar="TRUE" + +NEXUS_INPUT_BASE_DIR=${NEXUS_INPUT_DIR} +######################################################################## + +# +#---------------------------------------------------------------------- +# +# modify time configuration file +# +python3 ${ARL_NEXUS_DIR}/utils/python/nexus_time_parser.py -f ${DATA}/HEMCO_sa_Time.rc -s $start_date -e $end_date + +# +#--------------------------------------------------------------------- +# +# set the root directory to the temporary directory +# +python3 ${ARL_NEXUS_DIR}/utils/python/nexus_root_parser.py -f ${DATA}/NEXUS_Config.rc -d ${DATAinput} + +# +#---------------------------------------------------------------------- +# Get all the files needed (TEMPORARILY JUST COPY FROM THE DIRECTORY) +# +if [ "${NEI2016}" = "TRUE" ]; then #NEI2016 + mkdir_vrfy -p ${DATAinput}/NEI2016v1 + mkdir_vrfy -p ${DATAinput}/NEI2016v1/v2022-07 + mkdir_vrfy -p ${DATAinput}/NEI2016v1/v2022-07/${mm} + python3 ${ARL_NEXUS_DIR}/utils/python/nexus_nei2016_linker.py --src_dir ${NEXUS_INPUT_BASE_DIR} --date ${yyyymmdd} --work_dir ${DATAinput} -v "v2022-07" + python3 ${ARL_NEXUS_DIR}/utils/python/nexus_nei2016_control_tilefix.py -f ${DATA}/NEXUS_Config.rc -t ${DATA}/HEMCO_sa_Time.rc # -d ${yyyymmdd} +fi + +if [ "${TIMEZONES}" = "TRUE" ]; then # TIME ZONES + ln_vrfy -sf ${NEXUS_INPUT_BASE_DIR}/TIMEZONES ${DATAinput}/ +fi + +if [ "${MASKS}" = "TRUE" ]; then # MASKS + ln_vrfy -sf ${NEXUS_INPUT_BASE_DIR}/MASKS ${DATAinput}/ +fi + +if [ "${CEDS}" = "TRUE" ]; then #CEDS + ln_vrfy -sf ${NEXUS_INPUT_BASE_DIR}/CEDS ${DATAinput}/ +fi + +if [ "${HTAP2010}" = "TRUE" ]; then #CEDS2014 + ln_vrfy -sf ${NEXUS_INPUT_BASE_DIR}/HTAP ${DATAinput}/ +fi + +if [ "${OMIHTAP}" = "TRUE" ]; then #CEDS2014 + ln_vrfy -sf ${NEXUS_INPUT_BASE_DIR}/OMI-HTAP_2019 ${DATAinput}/ +fi + +if [ "${NOAAGMD}" = "TRUE" ]; then #NOAA_GMD + ln_vrfy -sf ${NEXUS_INPUT_BASE_DIR}/NOAA_GMD ${DATAinput}/ +fi + +if [ "${SOA}" = "TRUE" ]; then #SOA + ln_vrfy -sf ${NEXUS_INPUT_BASE_DIR}/SOA ${DATAinput}/ +fi + +if [ "${EDGAR}" = "TRUE" ]; then #EDGARv42 + ln_vrfy -sf ${NEXUS_INPUT_BASE_DIR}/EDGARv42 ${DATAinput}/ +fi + +if [ "${MEGAN}" = "TRUE" ]; then #MEGAN + ln_vrfy -sf ${NEXUS_INPUT_BASE_DIR}/MEGAN ${DATAinput}/ +fi + +if [ "${OLSON_MAP}" = "TRUE" ]; then #OLSON_MAP + ln_vrfy -sf ${NEXUS_INPUT_BASE_DIR}/OLSON_MAP ${DATAinput}/ +fi + +if [ "${Yuan_XLAI}" = "TRUE" ]; then #Yuan_XLAI + ln_vrfy -sf ${NEXUS_INPUT_BASE_DIR}/Yuan_XLAI ${DATAinput}/ +fi + +if [ "${GEOS}" = "TRUE" ]; then #GEOS + ln_vrfy -sf ${NEXUS_INPUT_BASE_DIR}/GEOS_0.5x0.625 ${DATAinput}/ +fi + +if [ "${AnnualScalar}" = "TRUE" ]; then #ANNUAL_SCALAR + ln_vrfy -sf ${NEXUS_INPUT_BASE_DIR}/AnnualScalar ${DATAinput}/ +fi + +if [ "${MODIS_XLAI}" = "TRUE" ]; then #MODIS_XLAI + ln_vrfy -sf ${NEXUS_INPUT_BASE_DIR}/MODIS_XLAI ${DATAinput}/ +fi + +if [ "${USE_GFS_SFC}" = "TRUE" ]; then # GFS INPUT + mkdir_vrfy -p ${DATAinput}/GFS_SFC + python3 ${ARL_NEXUS_DIR}/utils/python/nexus_gfs_bio.py -i ${DATA}/GFS_SFC/gfs.t??z.sfcf???.nc -o ${DATA}/GFS_SFC_MEGAN_INPUT.nc +fi + +# +#---------------------------------------------------------------------- +# +# Execute NEXUS +# +#----------------------------------------------------------------------- +# +PREP_STEP +eval ${RUN_CMD_AQM} ${EXECdir}/nexus -c NEXUS_Config.rc -r grid_spec.nc -o NEXUS_Expt_split.nc ${REDIRECT_OUT_ERR} || \ +print_err_msg_exit "\ +Call to execute nexus standalone for the FV3LAM failed." +POST_STEP + +# +#----------------------------------------------------------------------- +# +# Move NEXUS output to INPUT_DATA directory. +# +#----------------------------------------------------------------------- +# +mv_vrfy ${DATA}/NEXUS_Expt_split.nc ${INPUT_DATA}/${NET}.${cycle}${dot_ensmem}.NEXUS_Expt_split.${nspt}.nc + +# +#----------------------------------------------------------------------- +# +# Print message indicating successful completion of script. +# +#----------------------------------------------------------------------- +# +print_info_msg " +======================================================================== +NEXUS has successfully generated emissions files in netcdf format!!!! + +Exiting script: \"${scrfunc_fn}\" +In directory: \"${scrfunc_dir}\" +========================================================================" +# +#----------------------------------------------------------------------- +# +{ restore_shell_opts; } > /dev/null 2>&1 diff --git a/scripts/exregional_nexus_gfs_sfc.sh b/scripts/exregional_nexus_gfs_sfc.sh new file mode 100755 index 0000000000..ae3b788381 --- /dev/null +++ b/scripts/exregional_nexus_gfs_sfc.sh @@ -0,0 +1,166 @@ +#!/bin/bash + +# +#----------------------------------------------------------------------- +# +# Source the variable definitions file and the bash utility functions. +# +#----------------------------------------------------------------------- +# +. $USHdir/source_util_funcs.sh +source_config_for_task "cpl_aqm_parm" ${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 copies or fetches GFS surface +data files from disk or HPSS. +========================================================================" +# +#----------------------------------------------------------------------- +# +set -x +DATA="${DATA}/tmp_GFS_SFC" +mkdir_vrfy -p "$DATA" +cd_vrfy $DATA +# +#----------------------------------------------------------------------- +# +# Set up variables for call to retrieve_data.py +# +#----------------------------------------------------------------------- +# +yyyymmdd=${GFS_SFC_CDATE:0:8} +yyyymm=${GFS_SFC_CDATE:0:6} +yyyy=${GFS_SFC_CDATE:0:4} +hh=${GFS_SFC_CDATE:8:2} +if [ "${FCST_LEN_HRS}" = "-1" ]; then + for i_cdate in "${!ALL_CDATES[@]}"; do + if [ "${ALL_CDATES[$i_cdate]}" = "${PDY}${cyc}" ]; then + FCST_LEN_HRS="${FCST_LEN_CYCL[$i_cdate]}" + break + fi + done +fi +# +#----------------------------------------------------------------------- +# +# Retrieve GFS surface files to GFS_SFC_STAGING_DIR +# +#----------------------------------------------------------------------- +# +GFS_SFC_TAR_DIR="${NEXUS_GFS_SFC_ARCHV_DIR}/rh${yyyy}/${yyyymm}/${yyyymmdd}" +GFS_SFC_TAR_SUB_DIR="gfs.${yyyymmdd}/${hh}/atmos" + +GFS_SFC_LOCAL_DIR="${COMINgfs_BASEDIR}/${GFS_SFC_TAR_SUB_DIR}" +GFS_SFC_DATA_INTVL="3" + +# copy files from local directory +if [ -d ${GFS_SFC_LOCAL_DIR} ]; then + gfs_sfc_fn="gfs.t${hh}z.sfcanl.nc" + cp_vrfy "${GFS_SFC_LOCAL_DIR}/${gfs_sfc_fn}" ${GFS_SFC_STAGING_DIR} + + for fhr in $(seq -f "%03g" 0 ${GFS_SFC_DATA_INTVL} ${FCST_LEN_HRS}); do + gfs_sfc_fn="gfs.t${hh}z.sfcf${fhr}.nc" + if [ -e "${GFS_SFC_LOCAL_DIR}/${gfs_sfc_fn}" ]; then + cp_vrfy "${GFS_SFC_LOCAL_DIR}/${gfs_sfc_fn}" ${GFS_SFC_STAGING_DIR} + else + print_err_msg_exit "\ +sfc file does not exist in the directory: + GFS_SFC_LOCAL_DIR = \"${GFS_SFC_LOCAL_DIR}\" + gfs_sfc_fn = \"${gfs_sfc_fn}\"" + fi + done + +# retrieve files from HPSS +else + if [ "${yyyymmdd}" -lt "20220627" ]; then + GFS_SFC_TAR_FN_VER="prod" + elif [ "${yyyymmdd}" -lt "20221129" ]; then + GFS_SFC_TAR_FN_VER="v16.2" + else + GFS_SFC_TAR_FN_VER="v16.3" + fi + GFS_SFC_TAR_FN_PREFIX="com_gfs_${GFS_SFC_TAR_FN_VER}_gfs" + GFS_SFC_TAR_FN_SUFFIX_A="gfs_nca.tar" + GFS_SFC_TAR_FN_SUFFIX_B="gfs_ncb.tar" + + # Check if the sfcanl file exists in the staging directory + gfs_sfc_tar_fn="${GFS_SFC_TAR_FN_PREFIX}.${yyyymmdd}_${hh}.${GFS_SFC_TAR_FN_SUFFIX_A}" + gfs_sfc_tar_fp="${GFS_SFC_TAR_DIR}/${gfs_sfc_tar_fn}" + gfs_sfc_fns=("gfs.t${hh}z.sfcanl.nc") + gfs_sfc_fps="./${GFS_SFC_TAR_SUB_DIR}/gfs.t${hh}z.sfcanl.nc" + if [ "${FCST_LEN_HRS}" -lt "40" ]; then + ARCHV_LEN_HRS="${FCST_LEN_HRS}" + else + ARCHV_LEN_HRS="39" + fi + for fhr in $(seq -f "%03g" 0 ${GFS_SFC_DATA_INTVL} ${ARCHV_LEN_HRS}); do + gfs_sfc_fns+="gfs.t${hh}z.sfcf${fhr}.nc" + gfs_sfc_fps+=" ./${GFS_SFC_TAR_SUB_DIR}/gfs.t${hh}z.sfcf${fhr}.nc" + done + + # Retrieve data from A file up to FCST_LEN_HRS=39 + htar -tvf ${gfs_sfc_tar_fp} + PREP_STEP + htar -xvf ${gfs_sfc_tar_fp} ${gfs_sfc_fps} ${REDIRECT_OUT_ERR} || \ + print_err_msg_exit "htar file reading operation (\"htar -xvf ...\") failed." + POST_STEP + + # Retireve data from B file when FCST_LEN_HRS>=40 + if [ "${FCST_LEN_HRS}" -ge "40" ]; then + gfs_sfc_tar_fn="${GFS_SFC_TAR_FN_PREFIX}.${yyyymmdd}_${hh}.${GFS_SFC_TAR_FN_SUFFIX_B}" + gfs_sfc_tar_fp="${GFS_SFC_TAR_DIR}/${gfs_sfc_tar_fn}" + gfs_sfc_fns=() + gfs_sfc_fps="" + for fhr in $(seq -f "%03g" 42 ${GFS_SFC_DATA_INTVL} ${FCST_LEN_HRS}); do + gfs_sfc_fns+="gfs.t${hh}z.sfcf${fhr}.nc" + gfs_sfc_fps+=" ./${GFS_SFC_TAR_SUB_DIR}/gfs.t${hh}z.sfcf${fhr}.nc" + done + htar -tvf ${gfs_sfc_tar_fp} + PREP_STEP + htar -xvf ${gfs_sfc_tar_fp} ${gfs_sfc_fps} ${REDIRECT_OUT_ERR} || \ + print_err_msg_exit "htar file reading operation (\"htar -xvf ...\") failed." + POST_STEP + fi + # Move retrieved files to staging directory + mv_vrfy ${DATA}/${GFS_SFC_TAR_SUB_DIR}/gfs.*.nc ${GFS_SFC_STAGING_DIR} + +fi +# +#----------------------------------------------------------------------- +# +# Restore the shell options saved at the beginning of this script/function. +# +#----------------------------------------------------------------------- +# +{ restore_shell_opts; } > /dev/null 2>&1 diff --git a/scripts/exregional_nexus_post_split.sh b/scripts/exregional_nexus_post_split.sh new file mode 100755 index 0000000000..3282c8ee1a --- /dev/null +++ b/scripts/exregional_nexus_post_split.sh @@ -0,0 +1,154 @@ +#!/bin/bash + +# +#----------------------------------------------------------------------- +# +# Source the variable definitions file and the bash utility functions. +# +#----------------------------------------------------------------------- +# +. $USHdir/source_util_funcs.sh +source_config_for_task "cpl_aqm_parm" ${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 NEXUS. +========================================================================" +# +#----------------------------------------------------------------------- +# +# Set OpenMP variables. +# +#----------------------------------------------------------------------- +# +export KMP_AFFINITY=${KMP_AFFINITY_NEXUS_POST_SPLIT} +export OMP_NUM_THREADS=${OMP_NUM_THREADS_NEXUS_POST_SPLIT} +export OMP_STACKSIZE=${OMP_STACKSIZE_NEXUS_POST_SPLIT} +# +#----------------------------------------------------------------------- +# +# Set run command. +# +#----------------------------------------------------------------------- +# +eval ${PRE_TASK_CMDS} +# +#----------------------------------------------------------------------- +# +# Move to the NEXUS working directory +# +#----------------------------------------------------------------------- +# +DATA="${DATA}/tmp_NEXUS_POST_SPLIT" +mkdir_vrfy -p "$DATA" + +cd_vrfy $DATA + +mm="${PDY:4:2}" +dd="${PDY:6:2}" +hh="${cyc}" +yyyymmdd="${PDY}" + +NUM_SPLIT_NEXUS=$( printf "%02d" ${NUM_SPLIT_NEXUS} ) +if [ "${FCST_LEN_HRS}" = "-1" ]; then + for i_cdate in "${!ALL_CDATES[@]}"; do + if [ "${ALL_CDATES[$i_cdate]}" = "${PDY}${cyc}" ]; then + FCST_LEN_HRS="${FCST_LEN_CYCL[$i_cdate]}" + break + fi + done +fi +start_date=$( $DATE_UTIL --utc --date "${yyyymmdd} ${hh} UTC" "+%Y%m%d%H" ) +end_date=$( $DATE_UTIL --utc --date "${yyyymmdd} ${hh} UTC + ${FCST_LEN_HRS} hours" "+%Y%m%d%H" ) + +# +#----------------------------------------------------------------------- +# +# Copy the NEXUS config files to the tmp directory +# +#----------------------------------------------------------------------- +# +cp_vrfy ${ARL_NEXUS_DIR}/config/cmaq/HEMCO_sa_Time.rc ${DATA}/HEMCO_sa_Time.rc + +cp_vrfy ${NEXUS_FIX_DIR}/${NEXUS_GRID_FN} ${DATA}/grid_spec.nc +if [ "${NUM_SPLIT_NEXUS}" = "01" ]; then + nspt="00" + cp_vrfy ${COMIN}/NEXUS/${NET}.${cycle}${dot_ensmem}.NEXUS_Expt_split.${nspt}.nc ${DATA}/NEXUS_Expt_combined.nc +else + python3 ${ARL_NEXUS_DIR}/utils/python/concatenate_nexus_post_split.py "${COMIN}/NEXUS/${NET}.${cycle}${dot_ensmem}.NEXUS_Expt_split.*.nc" "${DATA}/NEXUS_Expt_combined.nc" +fi + +# +#----------------------------------------------------------------------- +# +# make nexus output pretty +# +#----------------------------------------------------------------------- +# +python3 ${ARL_NEXUS_DIR}/utils/python/nexus_time_parser.py -f ${DATA}/HEMCO_sa_Time.rc -s $start_date -e $end_date + +python3 ${ARL_NEXUS_DIR}/utils/python/make_nexus_output_pretty.py --src ${DATA}/NEXUS_Expt_combined.nc --grid ${DATA}/grid_spec.nc -o ${DATA}/NEXUS_Expt_pretty.nc -t ${DATA}/HEMCO_sa_Time.rc + +# +#----------------------------------------------------------------------- +# +# run MEGAN NCO script +# +#----------------------------------------------------------------------- +# +python3 ${ARL_NEXUS_DIR}/utils/combine_ant_bio.py ${DATA}/NEXUS_Expt_pretty.nc ${DATA}/NEXUS_Expt.nc + +# +#----------------------------------------------------------------------- +# +# Move NEXUS output to INPUT_DATA directory. +# +#----------------------------------------------------------------------- +# +mv_vrfy ${DATA}/NEXUS_Expt.nc ${INPUT_DATA}/${NET}.${cycle}${dot_ensmem}.NEXUS_Expt.nc +# +# Print message indicating successful completion of script. +# +#----------------------------------------------------------------------- +# +print_info_msg " +======================================================================== +NEXUS NetCDF file has been generated successfully!!!! + +Exiting script: \"${scrfunc_fn}\" +In directory: \"${scrfunc_dir}\" +========================================================================" +# +#----------------------------------------------------------------------- +# +{ restore_shell_opts; } > /dev/null 2>&1 diff --git a/scripts/exregional_point_source.sh b/scripts/exregional_point_source.sh new file mode 100755 index 0000000000..0a47f3f22f --- /dev/null +++ b/scripts/exregional_point_source.sh @@ -0,0 +1,191 @@ +#!/bin/bash + +# +#----------------------------------------------------------------------- +# +# Source the variable definitions file and the bash utility functions. +# +#----------------------------------------------------------------------- +# +. $USHdir/source_util_funcs.sh +source_config_for_task "task_make_grid|task_run_fcst|cpl_aqm_parm" ${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 PT_SOURCE. +========================================================================" +# +#----------------------------------------------------------------------- +# +# Set OpenMP variables. +# +#----------------------------------------------------------------------- +# +export KMP_AFFINITY=${KMP_AFFINITY_POINT_SOURCE} +export OMP_NUM_THREADS=${OMP_NUM_THREADS_POINT_SOURCE} +export OMP_STACKSIZE=${OMP_STACKSIZE_POINT_SOURCE} +# +#----------------------------------------------------------------------- +# +# Set run command. +# +#----------------------------------------------------------------------- +# +eval ${PRE_TASK_CMDS} + +nprocs=$(( LAYOUT_X*LAYOUT_Y )) +ppn_run_aqm="${PPN_POINT_SOURCE}" +omp_num_threads_run_aqm="${OMP_NUM_THREADS_POINT_SOURCE}" +if [ "${FCST_LEN_HRS}" = "-1" ]; then + for i_cdate in "${!ALL_CDATES[@]}"; do + if [ "${ALL_CDATES[$i_cdate]}" = "${PDY}${cyc}" ]; then + FCST_LEN_HRS="${FCST_LEN_CYCL[$i_cdate]}" + break + fi + done +fi +nstep=$(( FCST_LEN_HRS+1 )) +yyyymmddhh="${PDY}${cyc}" + +if [ -z "${RUN_CMD_AQM:-}" ] ; then + print_err_msg_exit "\ + Run command was not set in machine file. \ + Please set RUN_CMD_AQM for your platform" +else + RUN_CMD_AQM=$(eval echo ${RUN_CMD_AQM}) + print_info_msg "$VERBOSE" " + All executables will be submitted with command \'${RUN_CMD_AQM}\'." +fi + +# +#----------------------------------------------------------------------- +# +# Move to the working directory +# +#----------------------------------------------------------------------- +# +DATA="${DATA}/tmp_PT_SOURCE" +mkdir_vrfy -p "$DATA" +cd_vrfy $DATA +# +#----------------------------------------------------------------------- +# +# Set the directories for CONUS/HI/AK +# +#----------------------------------------------------------------------- +# +PT_SRC_CONUS="${PT_SRC_BASEDIR}/12US1" +PT_SRC_HI="${PT_SRC_BASEDIR}/3HI1" +PT_SRC_AK="${PT_SRC_BASEDIR}/9AK1" +# +#----------------------------------------------------------------------- +# +# Run stack-pt-mergy.py if file does not exist. +# +#----------------------------------------------------------------------- +# +if [ ! -s "${DATA}/pt-${yyyymmddhh}.nc" ]; then + python3 ${HOMEdir}/sorc/AQM-utils/python_utils/stack-pt-merge.py -s ${yyyymmddhh} -n ${nstep} -conus ${PT_SRC_CONUS} -hi ${PT_SRC_HI} -ak ${PT_SRC_AK} + + # bail if error + if [ ! -s "${DATA}/pt-${yyyymmddhh}.nc" ]; then + print_err_msg_exit "\ +The point source file \"pt-${yyyymmddhh}.nc\" was not generated." + else + print_info_msg "The intermediate file \"pt-${yyyymmddhh}.nc\" exists." + fi +fi + +# +#---------------------------------------------------------------------- +# +# Export input parameters of PT_SOURCE executable +# +#----------------------------------------------------------------------- +# +export NX=${ESGgrid_NX} +export NY=${ESGgrid_NY} +export LAYOUT_X +export LAYOUT_Y +export TOPO="${NEXUS_FIX_DIR}/${NEXUS_GRID_FN}" +export PT_IN="${DATA}/pt-${yyyymmddhh}.nc" + +# +#---------------------------------------------------------------------- +# +# Temporary output directory for PT_SOURCE executable +# +#----------------------------------------------------------------------- +# +mkdir_vrfy -p "${DATA}/PT" + +# +#---------------------------------------------------------------------- +# +# Execute PT_SOURCE +# +#----------------------------------------------------------------------- +# +PREP_STEP +eval ${RUN_CMD_AQM} ${EXECdir}/decomp-ptemis-mpi ${REDIRECT_OUT_ERR} || \ +print_err_msg_exit "\ +Call to execute PT_SOURCE for Online-CMAQ failed." +POST_STEP + +# +#----------------------------------------------------------------------- +# +# Move output to INPUT_DATA directory. +# +#----------------------------------------------------------------------- +# +mv_vrfy "${DATA}/PT" ${INPUT_DATA} + +# +#----------------------------------------------------------------------- +# +# Print message indicating successful completion of script. +# +#----------------------------------------------------------------------- +# +print_info_msg " +======================================================================== +PT_SOURCE has successfully generated output files !!!! + +Exiting script: \"${scrfunc_fn}\" +In directory: \"${scrfunc_dir}\" +========================================================================" +# +#----------------------------------------------------------------------- +# +{ restore_shell_opts; } > /dev/null 2>&1 diff --git a/scripts/exregional_post_stat_o3.sh b/scripts/exregional_post_stat_o3.sh new file mode 100755 index 0000000000..dd1c4b15e4 --- /dev/null +++ b/scripts/exregional_post_stat_o3.sh @@ -0,0 +1,303 @@ +#!/bin/bash + +# +#----------------------------------------------------------------------- +# +# Source the variable definitions file and the bash utility functions. +# +#----------------------------------------------------------------------- +# +. $USHdir/source_util_funcs.sh +source_config_for_task "cpl_aqm_parm|task_run_post" ${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 POST-STAT-O3. +========================================================================" +# +#----------------------------------------------------------------------- +# +# Set OpenMP variables. +# +#----------------------------------------------------------------------- +# +export KMP_AFFINITY=${KMP_AFFINITY_POST_STAT_O3} +export OMP_NUM_THREADS=${OMP_NUM_THREADS_POST_STAT_O3} +export OMP_STACKSIZE=${OMP_STACKSIZE_POST_STAT_O3} +# +#----------------------------------------------------------------------- +# +# Set run command. +# +#----------------------------------------------------------------------- +# +eval ${PRE_TASK_CMDS} + +if [ -z "${RUN_CMD_SERIAL:-}" ] ; then + print_err_msg_exit "\ + Run command was not set in machine file. \ + Please set RUN_CMD_SERIAL for your platform" +else + RUN_CMD_SERIAL=$(eval echo ${RUN_CMD_SERIAL}) + print_info_msg "$VERBOSE" " + All executables will be submitted with command \'${RUN_CMD_SERIAL}\'." +fi + +# +#----------------------------------------------------------------------- +# +# Move to the working directory +# +#----------------------------------------------------------------------- +# +DATA="${DATA}/tmp_POST_STAT_O3" +mkdir_vrfy -p "$DATA" +cd_vrfy $DATA + +set -x +# +#----------------------------------------------------------------------- +# +# POST-STAT: O3 +# +#----------------------------------------------------------------------- +# +if [ "${PREDEF_GRID_NAME}" = "AQM_NA_13km" ]; then + id_domain=793 +fi + +ln_vrfy -sf ${COMIN}/${NET}.${cycle}.chem_sfc.nc . + +# +cat >aqm_post.ini <> ${NET}.${cycle}.1ho3.${id_domain}.grib2 + else + wgrib2 ${DATA}/${NET}.${cycle}.awpozcon.f${fhr9}.${id_domain}.grib2 -d 1 -append -grib ${NET}.${cycle}.1ho3.${id_domain}.grib2 + wgrib2 ${DATA}/${NET}.${cycle}.awpozcon.f${fhr9}.${id_domain}.grib2 -d 2 -append -grib ${NET}.${cycle}.8ho3.${id_domain}.grib2 + fi + (( fhr=fhr+1 )) +done + +grid227="lambert:265.0000:25.0000:25.0000 226.5410:1473:5079.000 12.1900:1025:5079.000" +#grid148="lambert:263.0000:33.0000:45.0000 239.3720:442:12000.000 21.8210:265:12000.000" +grid196="mercator:20.0000 198.4750:321:2500.000:206.1310 18.0730:255:2500.000:23.0880" +grid198="nps:210.0000:60.0000 181.4290:825:5953.000 40.5300:553:5953.000" + +for grid in 227 196 198;do + gg="grid${grid}" + wgrib2 ${NET}.${cycle}.1ho3.${id_domain}.grib2 -set_grib_type c3b -new_grid_winds earth -new_grid ${!gg} ${NET}.${cycle}.1ho3.${grid}.grib2 + + if [ "${cyc}" = "06" ] || [ "${cyc}" = "12" ]; then + wgrib2 ${NET}.${cycle}.8ho3.${id_domain}.grib2 -set_grib_type c3b -new_grid_winds earth -new_grid ${!gg} ${NET}.${cycle}.8ho3.${grid}.grib2 + + for hr in 1 8; do + echo 0 > filesize + export XLFRTEOPTS="unit_vars=yes" + export FORT11=${NET}.${cycle}.${hr}ho3.${grid}.grib2 + export FORT12="filesize" + export FORT31= + export FORT51=grib2.${cycle}.${hr}awpcsozcon.${grid}.temp + tocgrib2super < ${PARMaqm_utils}/wmo/grib2_aqm_ave_${hr}hr_o3-awpozcon.${cycle}.${grid} + + echo `ls -l grib2.${cycle}.${hr}awpcsozcon.${grid}.temp | awk '{print $5} '` > filesize + export XLFRTEOPTS="unit_vars=yes" + export FORT11=grib2.${cycle}.${hr}awpcsozcon.${grid}.temp + export FORT12="filesize" + export FORT31= + export FORT51=awpaqm.${cycle}.${hr}ho3.${grid}.grib2 + tocgrib2super < ${PARMaqm_utils}/wmo/grib2_aqm_ave_${hr}hr_o3-awpozcon.${cycle}.${grid} + done + for var in 1ho3 8ho3 awpozcon;do + cp_vrfy ${DATA}/${NET}.${cycle}.${var}*grib2 ${COMOUT} + cp_vrfy ${DATA}/awpaqm.${cycle}.${var}*grib2 ${COMOUT} + done + else + for var in 1ho3 awpozcon;do + cp_vrfy ${DATA}/${NET}.${cycle}.${var}*grib2 ${COMOUT} + done + fi +done + +#------------------------------------------------------------ +# o3_post_maxi +#------------------------------------------------------------ +if [ "${cyc}" = "06" ] || [ "${cyc}" = "12" ]; then + + ln_vrfy -sf ${COMIN}/${NET}.${cycle}.chem_sfc.nc a.nc + + export chk=1 + export chk1=1 + # today 00z file exists otherwise chk=0 + +cat >aqm_max.ini < filesize + export XLFRTEOPTS="unit_vars=yes" + export FORT11=${NET}.${cycle}.max_${hr}hr_o3.${grid}.grib2 + export FORT12="filesize" + export FORT31= + export FORT51=aqm-${hr}hro3-maxi.${grid}.grib2.temp + tocgrib2super < ${PARMaqm_utils}/wmo/grib2_aqm-${hr}hro3-maxi.${cycle}.${grid} + echo `ls -l aqm-${hr}hro3-maxi.${grid}.grib2.temp | awk '{print $5} '` > filesize + export XLFRTEOPTS="unit_vars=yes" + export FORT11=aqm-${hr}hro3-maxi.${grid}.grib2.temp + export FORT12="filesize" + export FORT31= + export FORT51=awpaqm.${cycle}.${hr}ho3-max.${grid}.grib2 + tocgrib2super < ${PARMaqm_utils}/wmo/grib2_aqm-${hr}hro3-maxi.${cycle}.${grid} + done + + cp_vrfy awpaqm.${cycle}.*o3-max.${grid}.grib2 ${COMOUT} + if [ "${SENDDBN_NTC}" = "YES" ]; then + ${DBNROOT}/bin/dbn_alert ${DBNALERT_TYPE} ${NET} ${job} ${COMOUT}/awpaqm.${cycle}.1ho3-max.${grid}.grib2 + ${DBNROOT}/bin/dbn_alert ${DBNALERT_TYPE} ${NET} ${job} ${COMOUT}/awpaqm.${cycle}.8ho3-max.${grid}.grib2 + fi + done +fi + +# +#----------------------------------------------------------------------- +# +# Print message indicating successful completion of script. +# +#----------------------------------------------------------------------- +# +print_info_msg " +======================================================================== +POST-STAT-O3 completed successfully. + +Exiting script: \"${scrfunc_fn}\" +In directory: \"${scrfunc_dir}\" +========================================================================" +# +#----------------------------------------------------------------------- +# +{ restore_shell_opts; } > /dev/null 2>&1 diff --git a/scripts/exregional_post_stat_pm25.sh b/scripts/exregional_post_stat_pm25.sh new file mode 100755 index 0000000000..633be77614 --- /dev/null +++ b/scripts/exregional_post_stat_pm25.sh @@ -0,0 +1,303 @@ +#!/bin/bash + +# +#----------------------------------------------------------------------- +# +# Source the variable definitions file and the bash utility functions. +# +#----------------------------------------------------------------------- +# +. $USHdir/source_util_funcs.sh +source_config_for_task "cpl_aqm_parm|task_run_post" ${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 POST-STAT-PM25. +========================================================================" +# +#----------------------------------------------------------------------- +# +# Set OpenMP variables. +# +#----------------------------------------------------------------------- +# +export KMP_AFFINITY=${KMP_AFFINITY_POST_STAT_PM25} +export OMP_NUM_THREADS=${OMP_NUM_THREADS_POST_STAT_PM25} +export OMP_STACKSIZE=${OMP_STACKSIZE_POST_STAT_PM25} +# +#----------------------------------------------------------------------- +# +# Set run command. +# +#----------------------------------------------------------------------- +# +eval ${PRE_TASK_CMDS} + +if [ -z "${RUN_CMD_SERIAL:-}" ] ; then + print_err_msg_exit "\ + Run command was not set in machine file. \ + Please set RUN_CMD_SERIAL for your platform" +else + RUN_CMD_SERIAL=$(eval echo ${RUN_CMD_SERIAL}) + print_info_msg "$VERBOSE" " + All executables will be submitted with command \'${RUN_CMD_SERIAL}\'." +fi + +# +#----------------------------------------------------------------------- +# +# Move to the working directory +# +#----------------------------------------------------------------------- +# +DATA="${DATA}/tmp_POST_STAT_PM25" +mkdir_vrfy -p "$DATA" +cd_vrfy $DATA + +set -x + +# +#----------------------------------------------------------------------- +# +# POST-STAT: PM25 +# +#----------------------------------------------------------------------- +# + +if [ "${PREDEF_GRID_NAME}" = "AQM_NA_13km" ]; then + id_domain=793 +fi + +#--------------------------------------------------------------- +# aqm_pm25_post +#--------------------------------------------------------------- + +ln_vrfy -sf ${COMIN}/${NET}.${cycle}.chem_sfc.nc . + +cat >aqm_post.ini <> ${NET}.${cycle}.1hpm25.${id_domain}.grib2 + +export grid227="lambert:265.0000:25.0000:25.0000 226.5410:1473:5079.000 12.1900:1025:5079.000" +#export grid148="lambert:263.0000:33.0000:45.0000 239.3720:442:12000.000 21.8210:265:12000.000" +export grid196="mercator:20.0000 198.4750:321:2500.000:206.1310 18.0730:255:2500.000:23.0880" +export grid198="nps:210.0000:60.0000 181.4290:825:5953.000 40.5300:553:5953.000" + +for grid in 227 196 198; do + gg="grid${grid}" + wgrib2 ${NET}.${cycle}.1hpm25.${id_domain}.grib2 -set_grib_type c3b -new_grid_winds earth -new_grid ${!gg} ${NET}.${cycle}.1hpm25.${grid}.grib2 +done + +cp_vrfy ${DATA}/${NET}.${cycle}*pm25*.grib2 ${COMOUT} + +# Create AWIPS GRIB2 data for Bias-Corrected PM2.5 +if [ "${cyc}" = "06" ] || [ "${cyc}" = "12" ]; then + for grid in 227 198 196; do + echo 0 > filesize + export XLFRTEOPTS="unit_vars=yes" + export FORT11=${NET}.${cycle}.1hpm25.${grid}.grib2 + export FORT12="filesize" + export FORT31= + export FORT51=${NET}.${cycle}.1hpm25.${grid}.grib2.temp + tocgrib2super < ${PARMaqm_utils}/wmo/grib2_aqm_1hpm25.${cycle}.${grid} + + echo `ls -l ${NET}.${cycle}.grib2_pm25.${grid}.temp | awk '{print $5} '` > filesize + export XLFRTEOPTS="unit_vars=yes" + export FORT11=${NET}.${cycle}.1hpm25.${grid}.grib2.temp + export FORT12="filesize" + export FORT31= + export FORT51=awpaqm.${cycle}.1hpm25.${grid}.grib2 + tocgrib2super < ${PARMaqm_utils}/wmo/grib2_aqm_1hpm25.${cycle}.${grid} + + # Post Files to COMOUT + cp_vrfy awpaqm.${cycle}.1hpm25.${grid}.grib2 ${COMOUT} + + # Distribute Data + if [ "${SENDDBN_NTC}" = "YES" ] ; then + ${DBNROOT}/bin/dbn_alert ${DBNALERT_TYPE} ${NET} ${job} ${COMOUT}/awpaqm.${cycle}.1hpm25.${grid}.grib2 + ${DBNROOT}/bin/dbn_alert ${DBNALERT_TYPE} ${NET} ${job} ${COMOUT}/awpaqm.${cycle}.daily-1hr-pm25-max.${grid}.grib2 + fi + done +fi + +#--------------------------------------------------------------- +# aqm_pm25_post_maxi +#--------------------------------------------------------------- +if [ "${cyc}" = "06" ] || [ "${cyc}" = "12" ]; then + + ln_vrfy -sf ${COMIN}/${NET}.${cycle}.chem_sfc.nc a.nc + + export chk=1 + export chk1=1 + # today 00z file exists otherwise chk=0 + +cat >aqm_max.ini < filesize + export XLFRTEOPTS="unit_vars=yes" + export FORT11=${NET}.${cycle}.1hpm25-max.${grid}.grib2 + export FORT12="filesize" + export FORT31= + export FORT51=${NET}.${cycle}.max_1hr_pm25.${grid}.grib2.temp + tocgrib2super < ${PARMaqm_utils}/wmo/grib2_aqm_max_1hr_pm25.${cycle}.${grid} + + echo `ls -l ${NET}.${cycle}.max_1hr_pm25.${grid}.grib2.temp | awk '{print $5} '` > filesize + export XLFRTEOPTS="unit_vars=yes" + export FORT11=${NET}.${cycle}.max_1hr_pm25.${grid}.grib2.temp + export FORT12="filesize" + export FORT31= + export FORT51=awpaqm.${cycle}.daily-1hr-pm25-max.${grid}.grib2 + tocgrib2super < ${PARMaqm_utils}/wmo/grib2_aqm_max_1hr_pm25.${cycle}.${grid} + + rm_vrfy -f filesize + echo 0 > filesize + export XLFRTEOPTS="unit_vars=yes" + export FORT11=${NET}.${cycle}.24hrpm25-ave.${grid}.grib2 + export FORT12="filesize" + export FORT31= + export FORT51=${NET}.${cycle}.24hrpm25-ave.${grid}.grib2.temp + tocgrib2super < ${PARMaqm_utils}/wmo/grib2_aqm_ave_24hrpm25_awp.${cycle}.${grid} + + echo `ls -l ${NET}.${cycle}.24hrpm25-ave.${grid}.grib2.temp | awk '{print $5} '` > filesize + export XLFRTEOPTS="unit_vars=yes" + export FORT11=${NET}.${cycle}.24hrpm25-ave.${grid}.grib2.temp + export FORT12="filesize" + export FORT31= + export FORT51=awpaqm.${cycle}.24hr-pm25-ave.${grid}.grib2 + tocgrib2super < ${PARMaqm_utils}/wmo/grib2_aqm_ave_24hrpm25_awp.${cycle}.${grid} + + cp_vrfy ${DATA}/${NET}.${cycle}.ave_24hr_pm25*.grib2 ${COMOUT} + cp_vrfy ${DATA}/${NET}.${cycle}.max_1hr_pm25*.grib2 ${COMOUT} + cp_vrfy awpaqm.${cycle}.daily-1hr-pm25-max.${grid}.grib2 ${COMOUT} + cp_vrfy awpaqm.${cycle}.24hr-pm25-ave.${grid}.grib2 ${COMOUT} + + if [ "$SENDDBN" = "YES" ]; then + ${DBNROOT}/bin/dbn_alert MODEL AQM_MAX ${job} ${COMOUT}/${NET}.${cycle}.ave_24hr_pm25.${grid}.grib2 + ${DBNROOT}/bin/dbn_alert MODEL AQM_MAX ${job} ${COMOUT}/${NET}.${cycle}.max_1hr_pm25.${grid}.grib2 + fi + done +fi + +# +#----------------------------------------------------------------------- +# +# Print message indicating successful completion of script. +# +#----------------------------------------------------------------------- +# +print_info_msg " +======================================================================== +POST-STAT-PM25 completed successfully. + +Exiting script: \"${scrfunc_fn}\" +In directory: \"${scrfunc_dir}\" +========================================================================" +# +#----------------------------------------------------------------------- +# +{ restore_shell_opts; } > /dev/null 2>&1 diff --git a/scripts/exregional_pre_post_stat.sh b/scripts/exregional_pre_post_stat.sh new file mode 100755 index 0000000000..6541dcb75b --- /dev/null +++ b/scripts/exregional_pre_post_stat.sh @@ -0,0 +1,154 @@ +#!/bin/bash + +# +#----------------------------------------------------------------------- +# +# Source the variable definitions file and the bash utility functions. +# +#----------------------------------------------------------------------- +# +. $USHdir/source_util_funcs.sh +source_config_for_task "cpl_aqm_parm" ${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 POST-UPP-STAT. +========================================================================" +# +#----------------------------------------------------------------------- +# +# Set OpenMP variables. +# +#----------------------------------------------------------------------- +# +export KMP_AFFINITY=${KMP_AFFINITY_PRE_POST_STAT} +export OMP_NUM_THREADS=${OMP_NUM_THREADS_PRE_POST_STAT} +export OMP_STACKSIZE=${OMP_STACKSIZE_PRE_POST_STAT} +# +#----------------------------------------------------------------------- +# +# Set run command. +# +#----------------------------------------------------------------------- +# +eval ${PRE_TASK_CMDS} +# +#----------------------------------------------------------------------- +# +# Move to the working directory +# +#----------------------------------------------------------------------- +# +DATA="${DATA}/tmp_PRE_POST_STAT" +rm_vrfy -r $DATA +mkdir_vrfy -p "$DATA" +cd_vrfy $DATA + +if [ "${FCST_LEN_HRS}" = "-1" ]; then + for i_cdate in "${!ALL_CDATES[@]}"; do + if [ "${ALL_CDATES[$i_cdate]}" = "${PDY}${cyc}" ]; then + FCST_LEN_HRS="${FCST_LEN_CYCL[$i_cdate]}" + break + fi + done +fi + +ist=1 +while [ "$ist" -le "${FCST_LEN_HRS}" ]; do + hst=$( printf "%03d" "${ist}" ) + + rm_vrfy -f ${DATA}/tmp*nc + rm_vrfy -f ${DATA}/${NET}.${cycle}.chem_sfc_f${hst}*nc + rm_vrfy -f ${DATA}/${NET}.${cycle}.met_sfc_f${hst}*nc + + ncks -v lat,lon,o3_ave,no_ave,no2_ave,pm25_ave -d pfull,63,63 ${COMIN}/${NET}.${cycle}.dyn.f${hst}.nc ${DATA}/tmp2a.nc + + ncks -C -O -x -v pfull ${DATA}/tmp2a.nc ${DATA}/tmp2b.nc + + ncwa -a pfull ${DATA}/tmp2b.nc ${DATA}/tmp2c.nc + + ncrename -v o3_ave,o3 -v no_ave,no -v no2_ave,no2 -v pm25_ave,PM25_TOT ${DATA}/tmp2c.nc + + mv_vrfy ${DATA}/tmp2c.nc ${DATA}/${NET}.${cycle}.chem_sfc.f${hst}.nc + + ncks -v dswrf,hpbl,tmp2m,ugrd10m,vgrd10m,spfh2m ${COMIN}/${NET}.${cycle}.phy.f${hst}.nc ${DATA}/${NET}.${cycle}.met_sfc.f${hst}.nc + + (( ist=ist+1 )) +done + +ist=1 +while [ "${ist}" -le "${FCST_LEN_HRS}" ]; do + hst=$( printf "%03d" "${ist}" ) + ic=0 + while [ $ic -lt 900 ]; do + if [ -s ${DATA}/${NET}.${cycle}.chem_sfc.f${hst}.nc ]; then + echo "${DATA}/${NET}.${cycle}.chem_sfc.f${hst}.nc" "exist!" + break + else + sleep 10 + (( ic=ic+1 )) + fi + done + (( ist=ist+1 )) +done + +ncecat ${DATA}/${NET}.${cycle}.chem_sfc.f*.nc ${DATA}/${NET}.${cycle}.chem_sfc.nc + +# +#----------------------------------------------------------------------- +# +# Move output to COMIN directory. +# +#----------------------------------------------------------------------- +# +mv_vrfy ${DATA}/${NET}.${cycle}.met_sfc.f*.nc ${COMIN} +mv_vrfy ${DATA}/${NET}.${cycle}.chem_sfc.f*.nc ${COMIN} +mv_vrfy ${DATA}/${NET}.${cycle}.chem_sfc.nc ${COMIN} +# +#----------------------------------------------------------------------- +# +# Print message indicating successful completion of script. +# +#----------------------------------------------------------------------- +# +print_info_msg " +======================================================================== +PRE-POST-STAT completed successfully. + +Exiting script: \"${scrfunc_fn}\" +In directory: \"${scrfunc_dir}\" +========================================================================" +# +#----------------------------------------------------------------------- +# +{ restore_shell_opts; } > /dev/null 2>&1