forked from NOAA-EMC/global-workflow
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJGDAS_FIT2OBS
executable file
·92 lines (70 loc) · 2.78 KB
/
JGDAS_FIT2OBS
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
#! /usr/bin/env bash
source "${HOMEgfs}/ush/preamble.sh"
source "${HOMEgfs}/ush/jjob_header.sh" -e "fit2obs" -c "base fit2obs"
##############################################
# Set variables used in the script
##############################################
export CDUMP=${RUN/enkf}
# Ignore spelling warning; nothing is misspelled
# shellcheck disable=SC2153
CDATE=$(${NDATE} -"${VBACKUP_FITS}" "${PDY}${cyc}") # set CDATE to lookback cycle for use in fit2obs package
export CDATE
vday=${CDATE:0:8}
vcyc=${CDATE:8:2}
# These are used by fit2obs, so we can't change them to the standard COM variable names
# shellcheck disable=SC2153
YMD=${vday} HH=${vcyc} generate_com -rx COM_INA:COM_ATMOS_ANALYSIS_TMPL
RUN=${CDUMP} YMD=${vday} HH=${vcyc} generate_com -rx COM_PRP:COM_OBS_TMPL
# We want to defer variable expansion, so ignore warning about single quotes
# shellcheck disable=SC2016
export COM_INF='$ROTDIR/vrfyarch/gfs.$fdy/$fzz'
export PRPI=${COM_PRP}/${RUN}.t${vcyc}z.prepbufr
# shellcheck disable=SC2153
export sig1=${COM_INA}/${RUN}.t${vcyc}z.atmanl.nc
export sfc1=${COM_INA}/${RUN}.t${vcyc}z.atmanl.nc
export CNVS=${COM_INA}/${RUN}.t${vcyc}z.cnvstat
export OUTPUT_FILETYPE=${OUTPUT_FILETYPE:-netcdf}
export FIT_DIR=${ARCDIR}/fits
[[ ! -d "${FIT_DIR}" ]] && mkdir -p "${FIT_DIR}"
export HORZ_DIR=${ARCDIR}/horiz
[[ ! -d "${HORZ_DIR}" ]] && mkdir -p "${HORZ_DIR}"
export COMLOX=${DATA}/fitx
[[ ! -d "${COMLOX}" ]] && mkdir -p "${COMLOX}"
echo "echo err_chk">"${DATA}/err_chk"; chmod 755 "${DATA}/err_chk"
echo "echo postmsg">"${DATA}/postmsg"; chmod 755 "${DATA}/postmsg"
##############################################
# Check spinup and available inputs
##############################################
# Ignore spelling warning; nothing is misspelled
# shellcheck disable=SC2153
if [[ ${CDATE} -gt ${SDATE} ]]; then
for file in ${PRPI} ${sig1} ${sfc1} ${CNVS}; do
if [[ ! -f "${file}" ]]; then
echo "FATAL ERROR: FILE MISSING: ${file}"
exit 1
fi
done
##############################################
# RUN FIT2OBS VERIFICATION
##############################################
"${SCRIPTSfit2obs}/excfs_gdas_vrfyfits.sh"
status=$?
[[ ${status} -ne 0 ]] && exit "${status}"
##############################################
# End JOB SPECIFIC work
##############################################
##############################################
# Final processing
##############################################
if [[ -e "${pgmout}" ]] ; then
cat "${pgmout}"
fi
else
echo "Too early for FIT2OBS to run. Exiting."
fi
##########################################
# Remove the Temporary working directory
##########################################
cd "${DATAROOT}" || (echo "FATAL ERROR: ${DATAROOT} does not exist. ABORT!"; exit 1)
[[ ${KEEPDATA} = "NO" ]] && rm -rf "${DATA}"
exit 0