-
Notifications
You must be signed in to change notification settings - Fork 176
/
Copy pathexglobal_atmos_analysis_calc.sh
executable file
·197 lines (166 loc) · 6.28 KB
/
exglobal_atmos_analysis_calc.sh
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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
#! /usr/bin/env bash
################################################################################
#### UNIX Script Documentation Block
# . .
# Script name: exglobal_atmos_analysis_calc.sh
# Script description: Runs non-diagnostic file tasks after GSI analysis is performed
#
# Author: Cory Martin Org: NCEP/EMC Date: 2020-03-03
#
# Abstract: This script wraps up analysis-related tasks after GSI exits successfully
#
# $Id$
#
# Attributes:
# Language: POSIX shell
#
################################################################################
# Set environment.
source "$HOMEgfs/ush/preamble.sh"
# Directories.
pwd=$(pwd)
export FIXgsm=${FIXgsm:-$HOMEgfs/fix/am}
# Base variables
CDUMP=${CDUMP:-"gdas"}
GDUMP=${GDUMP:-"gdas"}
# Utilities
export NCP=${NCP:-"/bin/cp"}
export NMV=${NMV:-"/bin/mv"}
export NLN=${NLN:-"/bin/ln -sf"}
export CHGRP_CMD=${CHGRP_CMD:-"chgrp ${group_name:-rstprod}"}
export NCLEN=${NCLEN:-$HOMEgfs/ush/getncdimlen}
COMPRESS=${COMPRESS:-gzip}
UNCOMPRESS=${UNCOMPRESS:-gunzip}
APRUNCFP=${APRUNCFP:-""}
# Diagnostic files options
netcdf_diag=${netcdf_diag:-".true."}
binary_diag=${binary_diag:-".false."}
# IAU
DOIAU=${DOIAU:-"NO"}
export IAUFHRS=${IAUFHRS:-"6"}
# Dependent Scripts and Executables
export NTHREADS_CALCINC=${NTHREADS_CALCINC:-1}
export APRUN_CALCINC=${APRUN_CALCINC:-${APRUN:-""}}
export APRUN_CALCANL=${APRUN_CALCANL:-${APRUN:-""}}
export APRUN_CHGRES=${APRUN_CALCANL:-${APRUN:-""}}
export CALCANLEXEC=${CALCANLEXEC:-$HOMEgfs/exec/calc_analysis.x}
export CHGRESNCEXEC=${CHGRESNCEXEC:-$HOMEgfs/exec/enkf_chgres_recenter_nc.x}
export CHGRESINCEXEC=${CHGRESINCEXEC:-$HOMEgfs/exec/interp_inc.x}
export NTHREADS_CHGRES=${NTHREADS_CHGRES:-1}
CALCINCPY=${CALCINCPY:-$HOMEgfs/ush/calcinc_gfs.py}
CALCANLPY=${CALCANLPY:-$HOMEgfs/ush/calcanl_gfs.py}
DOGAUSFCANL=${DOGAUSFCANL-"NO"}
GAUSFCANLSH=${GAUSFCANLSH:-$HOMEgfs/ush/gaussian_sfcanl.sh}
export GAUSFCANLEXE=${GAUSFCANLEXE:-$HOMEgfs/exec/gaussian_sfcanl.x}
NTHREADS_GAUSFCANL=${NTHREADS_GAUSFCANL:-1}
APRUN_GAUSFCANL=${APRUN_GAUSFCANL:-${APRUN:-""}}
# OPS flags
RUN=${RUN:-""}
SENDECF=${SENDECF:-"NO"}
SENDDBN=${SENDDBN:-"NO"}
# Guess files
GPREFIX=${GPREFIX:-""}
ATMG03=${ATMG03:-${COM_ATMOS_HISTORY_PREV}/${GPREFIX}atmf003.nc}
ATMG04=${ATMG04:-${COM_ATMOS_HISTORY_PREV}/${GPREFIX}atmf004.nc}
ATMG05=${ATMG05:-${COM_ATMOS_HISTORY_PREV}/${GPREFIX}atmf005.nc}
ATMGES=${ATMGES:-${COM_ATMOS_HISTORY_PREV}/${GPREFIX}atmf006.nc}
ATMG07=${ATMG07:-${COM_ATMOS_HISTORY_PREV}/${GPREFIX}atmf007.nc}
ATMG08=${ATMG08:-${COM_ATMOS_HISTORY_PREV}/${GPREFIX}atmf008.nc}
ATMG09=${ATMG09:-${COM_ATMOS_HISTORY_PREV}/${GPREFIX}atmf009.nc}
# Analysis files
export APREFIX=${APREFIX:-""}
SFCANL=${SFCANL:-${COM_ATMOS_ANALYSIS}/${APREFIX}sfcanl.nc}
DTFANL=${DTFANL:-${COM_ATMOS_ANALYSIS}/${APREFIX}dtfanl.nc}
ATMANL=${ATMANL:-${COM_ATMOS_ANALYSIS}/${APREFIX}atmanl.nc}
# Increment files
ATMINC=${ATMINC:-${COM_ATMOS_ANALYSIS}/${APREFIX}atminc.nc}
# Set script / GSI control parameters
DOHYBVAR=${DOHYBVAR:-"NO"}
lrun_subdirs=${lrun_subdirs:-".true."}
if [ $DOHYBVAR = "YES" ]; then
l_hyb_ens=.true.
export l4densvar=${l4densvar:-".false."}
export lwrite4danl=${lwrite4danl:-".false."}
else
l_hyb_ens=.false.
export l4densvar=.false.
export lwrite4danl=.false.
fi
# Set 4D-EnVar specific variables
if [ $DOHYBVAR = "YES" -a $l4densvar = ".true." -a $lwrite4danl = ".true." ]; then
ATMA03=${ATMA03:-${COM_ATMOS_ANALYSIS}/${APREFIX}atma003.nc}
ATMI03=${ATMI03:-${COM_ATMOS_ANALYSIS}/${APREFIX}atmi003.nc}
ATMA04=${ATMA04:-${COM_ATMOS_ANALYSIS}/${APREFIX}atma004.nc}
ATMI04=${ATMI04:-${COM_ATMOS_ANALYSIS}/${APREFIX}atmi004.nc}
ATMA05=${ATMA05:-${COM_ATMOS_ANALYSIS}/${APREFIX}atma005.nc}
ATMI05=${ATMI05:-${COM_ATMOS_ANALYSIS}/${APREFIX}atmi005.nc}
ATMA07=${ATMA07:-${COM_ATMOS_ANALYSIS}/${APREFIX}atma007.nc}
ATMI07=${ATMI07:-${COM_ATMOS_ANALYSIS}/${APREFIX}atmi007.nc}
ATMA08=${ATMA08:-${COM_ATMOS_ANALYSIS}/${APREFIX}atma008.nc}
ATMI08=${ATMI08:-${COM_ATMOS_ANALYSIS}/${APREFIX}atmi008.nc}
ATMA09=${ATMA09:-${COM_ATMOS_ANALYSIS}/${APREFIX}atma009.nc}
ATMI09=${ATMI09:-${COM_ATMOS_ANALYSIS}/${APREFIX}atmi009.nc}
fi
################################################################################
################################################################################
# Preprocessing
mkdata=NO
if [ ! -d $DATA ]; then
mkdata=YES
mkdir -p $DATA
fi
cd $DATA || exit 99
################################################################################
# Clean the run-directory
rm -rf dir.*
##############################################################
# If analysis increment is written by GSI, produce an analysis file here
if [ $DO_CALC_ANALYSIS == "YES" ]; then
# link analysis and increment files
$NLN $ATMANL siganl
$NLN $ATMINC siginc.nc
if [ $DOHYBVAR = "YES" -a $l4densvar = ".true." -a $lwrite4danl = ".true." ]; then
$NLN $ATMA03 siga03
$NLN $ATMI03 sigi03.nc
$NLN $ATMA04 siga04
$NLN $ATMI04 sigi04.nc
$NLN $ATMA05 siga05
$NLN $ATMI05 sigi05.nc
$NLN $ATMA07 siga07
$NLN $ATMI07 sigi07.nc
$NLN $ATMA08 siga08
$NLN $ATMI08 sigi08.nc
$NLN $ATMA09 siga09
$NLN $ATMI09 sigi09.nc
fi
# link guess files
$NLN $ATMG03 sigf03
$NLN $ATMGES sigf06
$NLN $ATMG09 sigf09
[[ -f $ATMG04 ]] && $NLN $ATMG04 sigf04
[[ -f $ATMG05 ]] && $NLN $ATMG05 sigf05
[[ -f $ATMG07 ]] && $NLN $ATMG07 sigf07
[[ -f $ATMG08 ]] && $NLN $ATMG08 sigf08
# Link hourly backgrounds (if present)
if [ -f $ATMG04 -a -f $ATMG05 -a -f $ATMG07 -a -f $ATMG08 ]; then
nhr_obsbin=1
fi
$CALCANLPY
export err=$?; err_chk
else
echo "Neither increment nor analysis are generated by external utils"
fi
##############################################################
# Create gaussian grid surface analysis file at middle of window
if [ $DOGAUSFCANL = "YES" ]; then
export APRUNSFC=$APRUN_GAUSFCANL
export OMP_NUM_THREADS_SFC=$NTHREADS_GAUSFCANL
$GAUSFCANLSH
export err=$?; err_chk
fi
echo "${CDUMP} ${PDY}${cyc} atmanl and sfcanl done at $(date)" > "${COM_ATMOS_ANALYSIS}/${APREFIX}loganl.txt"
################################################################################
# Postprocessing
cd $pwd
[[ $mkdata = "YES" ]] && rm -rf $DATA
exit $err