forked from NOAA-EMC/global-workflow
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJGLOBAL_ATMOS_POST
executable file
·117 lines (94 loc) · 3.53 KB
/
JGLOBAL_ATMOS_POST
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
#! /usr/bin/env bash
source "${HOMEgfs}/ush/preamble.sh"
source "${HOMEgfs}/ush/jjob_header.sh" -e "post" -c "base post"
####################################
# Specify version numbers
####################################
export crtm_ver=${post_crtm_ver:-v2.2.6}
export gfs_ver=${gfs_ver:-v15.0.0}
export hwrf_ver=${hwrf_ver:-v11.0.5}
export g2tmpl_ver=${g2tmpl_ver:-v1.5.0}
##############################################
# Set variables used in the exglobal script
##############################################
export CDUMP=${RUN/enkf}
##############################################
# TODO: Remove this egregious HACK
##############################################
if [[ "${SDATE:-}" = "${PDY}${cyc}" ]]; then
if [[ ${post_times} = "anl" ]]; then
echo "No offline post-processing in the first half cycle for analysis"
exit 0
fi
fi
##############################################
# Begin JOB SPECIFIC work
##############################################
export APRUNP=${APRUN:-${APRUN_NP}}
export RERUN=${RERUN:-NO}
export HOMECRTM=${HOMECRTM:-${PACKAGEROOT}/lib/crtm/${crtm_ver}}
export FIXCRTM=${CRTM_FIX:-${HOMECRTM}/fix}
export PARMpost=${PARMpost:-${HOMEgfs}/parm/post}
export INLINE_POST=${WRITE_DOPOST:-".false."}
# Construct COM variables from templates
YMD=${PDY} HH=${cyc} generate_com -rx COM_ATMOS_RESTART COM_ATMOS_ANALYSIS COM_ATMOS_HISTORY COM_ATMOS_MASTER
if [[ ! -d ${COM_ATMOS_MASTER} ]]; then mkdir -m 775 -p "${COM_ATMOS_MASTER}"; fi
if [[ ${GOESF} == "YES" ]]; then
YMD=${PDY} HH=${cyc} generate_com -rx COM_ATMOS_GOES
if [[ ! -d ${COM_ATMOS_GOES} ]]; then mkdir -m 775 -p "${COM_ATMOS_GOES}"; fi
fi
for grid in '0p25' '0p50' '1p00'; do
prod_dir="COM_ATMOS_GRIB_${grid}"
GRID=${grid} YMD=${PDY} HH=${cyc} generate_com -rx "${prod_dir}:COM_ATMOS_GRIB_GRID_TMPL"
if [[ ! -d "${prod_dir}" ]]; then mkdir -m 775 -p "${!prod_dir}"; fi
done
if [ "${RUN}" = gfs ];then
export FHOUT_PGB=${FHOUT_GFS:-3} #Output frequency of gfs pgb file at 1.0 and 0.5 deg.
fi
if [ "${RUN}" = gdas ]; then
export IGEN_GFS="gfs_avn"
export IGEN_ANL="anal_gfs"
export IGEN_FCST="gfs_avn"
export IGEN_GDAS_ANL="anal_gdas"
export FHOUT_PGB=${FHOUT:-1} #Output frequency of gfs pgb file at 1.0 and 0.5 deg.
fi
if [ "${GRIBVERSION}" = grib2 ]; then
export IGEN_ANL="anal_gfs"
export IGEN_FCST="gfs_avn"
export IGEN_GFS="gfs_avn"
fi
#######################################
# Specify Restart File Name to Key Off
#######################################
# TODO Improve the name of this variable
export restart_file=${COM_ATMOS_HISTORY}/${RUN}.t${cyc}z.atm.logf
####################################
# Specify Timeout Behavior of Post
#
# SLEEP_TIME - Amount of time to wait for
# a restart file before exiting
# SLEEP_INT - Amount of time to wait between
# checking for restart files
####################################
export SLEEP_TIME=900
export SLEEP_INT=5
###############################################################
# Run relevant exglobal script
"${HOMEgfs}/scripts/ex${RUN}_atmos_post.sh"
status=$?
(( status != 0 )) && exit "${status}"
##############################################
# End JOB SPECIFIC work
##############################################
##############################################
# Final processing
##############################################
if [ -e "${pgmout}" ]; then
cat "${pgmout}"
fi
##########################################
# Remove the Temporary working directory
##########################################
cd "${DATAROOT}" || exit 1
[[ "${KEEPDATA:-NO}" = "NO" ]] && rm -rf "${DATA}"
exit 0