-
Notifications
You must be signed in to change notification settings - Fork 179
/
Copy pathexgfs_atmos_vminmon.sh
executable file
·116 lines (90 loc) · 3.3 KB
/
exgfs_atmos_vminmon.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
#! /usr/bin/env bash
source "$HOMEgfs/ush/preamble.sh"
################################################################################
#### UNIX Script Documentation Block
# . .
# Script name: exgfs_vrfminmon.sh
# Script description: Runs data extract/validation for GSI normalization diag data
#
# Author: Ed Safford Org: NP23 Date: 2015-04-10
#
# Abstract: This script runs the data extract/validation portion of the
# MinMon package.
#
# Condition codes
# 0 - no problem encountered
# >0 - some problem encountered
#
################################################################################
########################################
# Set environment
########################################
export RUN_ENVIR=${RUN_ENVIR:-nco}
export NET=${NET:-gfs}
export RUN=${RUN:-gfs}
export envir=${envir:-prod}
########################################
# Command line arguments
########################################
export PDY=${1:-${PDY:?}}
export cyc=${2:-${cyc:?}}
########################################
# Directories
########################################
export DATA=${DATA:-$(pwd)}
########################################
# Filenames
########################################
gsistat=${gsistat:-$COMIN/gfs.t${cyc}z.gsistat}
export mm_gnormfile=${gnormfile:-${M_FIXgfs}/gfs_minmon_gnorm.txt}
export mm_costfile=${costfile:-${M_FIXgfs}/gfs_minmon_cost.txt}
########################################
# Other variables
########################################
export MINMON_SUFFIX=${MINMON_SUFFIX:-GFS}
export PDATE=${PDY}${cyc}
export NCP=${NCP:-/bin/cp}
export pgm=exgfs_vrfminmon.sh
if [[ ! -d ${DATA} ]]; then
mkdir $DATA
fi
cd $DATA
######################################################################
data_available=0
if [[ -s ${gsistat} ]]; then
data_available=1
#------------------------------------------------------------------
# Copy the $MINMON_SUFFIX.gnorm_data.txt file to the working directory
# It's ok if it doesn't exist; we'll create a new one if needed.
#------------------------------------------------------------------
if [[ -s ${M_TANKverf}/gnorm_data.txt ]]; then
$NCP ${M_TANKverf}/gnorm_data.txt gnorm_data.txt
elif [[ -s ${M_TANKverfM1}/gnorm_data.txt ]]; then
$NCP ${M_TANKverfM1}/gnorm_data.txt gnorm_data.txt
fi
#------------------------------------------------------------------
# Run the child sccripts.
#------------------------------------------------------------------
${USHminmon}/minmon_xtrct_costs.pl ${MINMON_SUFFIX} ${PDY} ${cyc} ${gsistat} dummy
rc_costs=$?
echo "rc_costs = $rc_costs"
${USHminmon}/minmon_xtrct_gnorms.pl ${MINMON_SUFFIX} ${PDY} ${cyc} ${gsistat} dummy
rc_gnorms=$?
echo "rc_gnorms = $rc_gnorms"
${USHminmon}/minmon_xtrct_reduct.pl ${MINMON_SUFFIX} ${PDY} ${cyc} ${gsistat} dummy
rc_reduct=$?
echo "rc_reduct = $rc_reduct"
fi
#####################################################################
# Postprocessing
err=0
if [[ ${data_available} -ne 1 ]]; then
err=1
elif [[ $rc_costs -ne 0 ]]; then
err=$rc_costs
elif [[ $rc_gnorms -ne 0 ]]; then
err=$rc_gnorms
elif [[ $rc_reduct -ne 0 ]]; then
err=$rc_reduct
fi
exit ${err}