-
Notifications
You must be signed in to change notification settings - Fork 3
/
py_plotting.config
executable file
·170 lines (148 loc) · 9.04 KB
/
py_plotting.config
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
#!/bin/sh -e
# ================================================================================================
# NCEP EMC PYTHON PLOTTING OF CAM VERIFICATION
#
# CONTRIBUTORS: Marcel Caron, [email protected], NOAA/NWS/NCEP/EMC-VPPPGB
#
# PURPOSE: Set up configurations to plot METPLUS output statistics
#
# DESCRIPTION: This configuration file defines environment variables that are meant to be
# edited by the user and that are called by python scripts at runtime to define
# the plotting task, resulting in one or more graphics output files.
#
# BEFORE YOU BEGIN: Make sure to set up verif_plotting if you haven't already. To set up,
# clone the Github repository:
#
# $ git clone https://github.com/MarcelCaron-NOAA/verif_plotting
#
# or, if on the NOAA WCOSS supercomputer, choose any directory that will house
# verif_plotting. As an example, we'll call that directory PY_PLOT_DIR. Then on
# the command line:
#
# $ PY_PLOT_DIR="/path/to/my/verif/plotting/home/directory"
# $ mkdir -p ${PY_PLOT_DIR}/out/logs ${PY_PLOT_DIR}/data ${PY_PLOT_DIR}/ush
# $ BASE_DIR="/gpfs/dell2/emc/verification/noscrub/Marcel.Caron/verif_plotting"
# $ cp -r ${BASE_DIR}/ush/* ${PY_PLOT_DIR}/ush/.
# $ cp ${BASE_DIR}/py_plotting.config ${PY_PLOT_DIR}/.
#
# CONFIGURATION: After setting up verif_plotting, edit the exported variables below. Each
# variable is a string that will be ingested by the python code. You'll need to
# be able to point to a correctly structured metplus statistics archive (see the
# comment for Directory Settings below for details).
#
# LIMITATIONS
# In some cases, possible values for exported variables will be limited to what
# is listed in the metplus .stat files or the statistics archive you are using
# (e.g., values for FCST_LEAD or MODEL). In other cases, possible values will be
# limited to what has been predefined elsewhere in verif_plotting (e.g., values
# for EVAL_PERIOD). Finally, some settings must match certain allowable settings,
# which are defined in ${USH_DIR}/settings.py in the case_type attribute of the
# Reference() class. Two asterisks mark these latter settings in the
# comments below.
#
# CONFIGURING PLOT TYPE
# The plot type is requested via the last export variable. Replace the string with
# the desired plot type as explained in the comment. In most cases, a plot will
# include all of the listed settings; for example, the python code will attempt to
# plot all of the listed models in MODEL on the same plot, as well as all of the
# init/valid hours in FCST_INIT/VALID_HOUR and lead times in FCST_LEAD.
# Exceptions to this are any listed var_names and listed domains (VX_MASK_LIST),
# for which individual plots will be made. Listed levels are also plotted
# separately unless the plot type is stat_by_level.
#
# EXECUTION: After configuring this script, it can be run on the command line:
#
# $ /bin/sh ${PY_PLOT_DIR}/py_plotting.config
#
# ... which will set the environment variables and run the python code. The python
# code then follows these steps:
# (1) Save environment variables as global python variables. Check these variables
# and throw an error if an issue is encountered and throw warnings as needed.
# Make sure the datatype for each variable is correct
# (2) Send the settings to ${USH_DIR}/df_preprocessing.py, which pulls and prunes
# the .stat files--creating temporary data files in the process and storing
# those files in PRUNE_DIR--then loads the data as pandas dataframes, which
# are filtered several times according to user settings.
# (3) Send the dataframe and user settings to a plotting function, which creates a
# figure object, filters the data, plots the data, adjusts plot features, then
# saves the plot as a png.
#
# DEBUGGING: Part of the configuration for this script involves setting a logfile path.
# Running the script will print the logfile path for your specific task, which you
# can check for debugging. The lowest log level that is currently functional is
# "INFO". "DEBUG" statements may be included in a later implementation.
#
# ================================================================================================
set -x
# Case type settings are used to check if settings are allowed. **
export VERIF_CASE="precip"
export VERIF_TYPE="ccpa"
# Used to name the graphics ouput files. File names will start with the URL_HEADER, followed by plot
# details. Leave blank ("") to include only plot details in the file names.
export URL_HEADER="test_logo_offsets_ctl"
# Directory Settings. Make sure USH_DIR, PRUNE_DIR, and SAVE_DIR point to desired .../ush,
# .../data, and .../out directories. OUTPUT_BASE_DIR is the location of the metplus stat archive.
# The default format that plotting scripts use to look for .stat files in the archive is
# ${OUTPUT_BASE_DIR}/${VERIF_CASE}/${MODEL_NAME}/${Ym}/${MODEL_NAME}*.stat
# This format can be changed by editing the output_base_template variable in the Templates class in
# ${USH_DIR}/settings.py
export USH_DIR="/lfs/h2/emc/vpppg/noscrub/${USER}/verif_plotting/ush"
export PRUNE_DIR="/lfs/h2/emc/ptmp/${USER}/data"
export SAVE_DIR="/lfs/h2/emc/ptmp/${USER}/out"
export OUTPUT_BASE_DIR="/lfs/h2/emc/vpppg/noscrub/marcel.caron/stats_out"
# Logfile settings. Log level options are "DEBUG", "INFO", "WARNING", "ERROR", and "CRITICAL"
export LOG_METPLUS="${SAVE_DIR}/logs/verif_plotting_job_`date '+%Y%m%d-%H%M%S'`_$$.out"
export LOG_LEVEL="DEBUG"
# Version of MET listed in the metplus .stat files used to create graphics
export MET_VERSION="10.0"
# Will use statistics for all comma-separated models. Names must match the model naming convention
# in ${OUTPUT_BASE_DIR}
export MODEL="GFS, RRFS_A_CONUS, RRFS_A_NACONUS, HRRR, CONUSNEST, FV3LAMDAX"
# Will use valid or init datetimes based on the setting below. Options are "VALID" or "INIT"
export DATE_TYPE="INIT"
# Will choose a valid or init range based on a preset EVAL_PERIOD. Use "TEST" if you want to use
# the custom-defined range below. Presets are defined in ${USH_DIR}/settings.py in the Presets()
# class.
export EVAL_PERIOD="TEST"
# If EVAL_PERIOD="TEST", will use statistics from the valid or init range below. If not, ignores
# these settings. DATE_TYPE decides whether valid or init is used.
export VALID_BEG="20221201"
export VALID_END="20221220"
export INIT_BEG="20221201"
export INIT_END="20221220"
# Will use statistics for all comma-separated valid or init hours. DATE_TYPE decides whether valid
# or init is used.
export FCST_INIT_HOUR="0"
#export FCST_VALID_HOUR="0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23"
export FCST_VALID_HOUR="0,6,12,18"
# Settings below are used to select desired variable and domain. **
export FCST_LEVEL="A1"
export OBS_LEVEL="A1"
export var_name="APCP_01"
export VX_MASK_LIST="CONUS"
# Will use statistics for all comma-separated lead times
#export FCST_LEAD="0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,48,51,54,57,60"
export FCST_LEAD="3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,48,51,54,57,60,63,66,69,72,75,78,81,84,87"
# Line type in metplus .stat files used to compute desired metric(s). **
export LINE_TYPE="ctc"
# Interpolation, as listed in metplus .stat files. **
export INTERP="NEAREST"
# Will use statistics for all comma-separated thresholds. Use symbols (e.g., >=) to define
# thresholds. **
export FCST_THRESH=">=1.27"
export OBS_THRESH=">=1.27"
# Will plot all comma-separated metrics. For performance diagram, metrics must be "sratio,pod,csi".
# For ROC curve, metrics must be "farate,pod". Depending on the VERIF_CASE, VERIF_TYPE,
# and LINE_TYPE, only some settings are allowed. **
export STATS="csi"
# String of True or False. If "True", will plot bootstrap confidence intervals. Other confidence
# interval settings can be configured in ${USH_DIR}/settings.py
export CONFIDENCE_INTERVALS="False"
# Will use statistics for all comma-separated interpolation points
export INTERP_PNTS="1"
# String defining the type of plot to make. Options are "lead_average", "performance_diagram",
# "roc_curve", "stat_by_level", "threshold_average", "time_series", and "valid_hour_average".
export PLOT_TYPE="lead_average"
# Executes the desired python script. No need to edit this.
python $USH_DIR/${PLOT_TYPE}.py
exit 0