-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
382 additions
and
0 deletions.
There are no files selected for viewing
34 changes: 34 additions & 0 deletions
34
...ons/short_range/UserScript_fcstRRFS_fcstOnly_Reformat_Aggregate_Plot/plot_spread_skill.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
#!/usr/bin/env python3 | ||
|
||
|
||
import os | ||
import time | ||
import logging | ||
import yaml | ||
import metcalcpy.util.read_env_vars_in_config as readconfig | ||
# from metplotpy.plots import line as Line | ||
from metplotpy.plots.line import line | ||
|
||
def main(): | ||
|
||
# Read in the YAML configuration file. Environment variables in | ||
# the configuration file are supported. | ||
try: | ||
input_config_file = os.getenv("PLOTTING_YAML_CONFIG_NAME", "spread_skill_ecnt.yaml") | ||
settings = readconfig.parse_config(input_config_file) | ||
logging.info(settings) | ||
except yaml.YAMLError as exc: | ||
logging.error(exc) | ||
|
||
try: | ||
plot = line.Line(settings) | ||
plot.save_to_file() | ||
# plot.show_in_browser() | ||
plot.write_html() | ||
plot.write_output_file() | ||
# plot.line_logger.info(f"Finished creating line plot: {datetime.now()}") | ||
except ValueError as val_er: | ||
print(val_er) | ||
|
||
if __name__ == "__main__": | ||
main() |
348 changes: 348 additions & 0 deletions
348
...s/short_range/UserScript_fcstRRFS_fcstOnly_Reformat_Aggregate_Plot/spread_skill_ecnt.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,348 @@ | ||
alpha: 0.05 | ||
box_avg: 'False' | ||
box_boxwex: 0.2 | ||
box_notch: 'False' | ||
box_outline: 'True' | ||
box_pts: 'False' | ||
caption_align: 0.0 | ||
caption_col: '#333333' | ||
caption_offset: 3.0 | ||
caption_size: 0.8 | ||
caption_weight: 1 | ||
cex: 1 | ||
|
||
colors: | ||
# Colors for each line that will be generated. | ||
# Accessible colors https://davidmathlogic.com/colorblind/#%23D81B60-%231E88E5-%23FFC107-%23004D40 | ||
- '#D41159' # reddish | ||
- '#4B0092' # purple-ish | ||
- '#1Aff1A' # lime green-ish | ||
|
||
|
||
con_series: | ||
- 1 | ||
- 1 | ||
- 1 | ||
|
||
create_html: 'False' | ||
|
||
# Two derived series (lines) are supported (i.e. difference or ratio lines: DIFF or RATIO). | ||
derived_series_1: | ||
# Generate the ratio line of the ECNT spread_plus_oerr/rmse for temperature and the | ||
# The first line is the top portion (left side) of the ratio, the second is the bottom (right side), and the | ||
# third line indicates the type of derived line (i.e. RATIO or DIFF). This is a list of lists, so remember | ||
# to have two '-' at the start of the first line ( - - 'model var stat') | ||
# RRFS_GEFS_GF.SPP.SPPT model. | ||
- - RRFS_GEFS_GF.SPP.SPPT TMP SPREAD_PLUS_OERR | ||
- RRFS_GEFS_GF.SPP.SPPT TMP RMSE | ||
- RATIO | ||
|
||
derived_series_2: [] | ||
|
||
dump_points_1: 'False' | ||
dump_points_2: 'False' | ||
event_equal: 'False' | ||
fcst_var_val_1: | ||
# Specify the variable name and the statistic(s) of interest. | ||
# This will generate one line of the spread_plus_oerr values for TMP and a | ||
# line of rmse values for TMP. | ||
TMP: | ||
- SPREAD_PLUS_OERR | ||
- RMSE | ||
|
||
fcst_var_val_2: {} | ||
|
||
fixed_vars_vals_input: | ||
# Additional parameters/restrictions applied to the data. | ||
# Limit to Z2 fcst level and these fcst_valid_beg times. | ||
fcst_lev: | ||
- 'Z2' | ||
fcst_valid_beg: | ||
- '2022-05-06 00:00:00' | ||
- '2022-05-06 01:00:00' | ||
- '2022-05-06 02:00:00' | ||
- '2022-05-06 03:00:00' | ||
- '2022-05-06 04:00:00' | ||
- '2022-05-06 05:00:00' | ||
- '2022-05-06 06:00:00' | ||
- '2022-05-06 07:00:00' | ||
- '2022-05-06 08:00:00' | ||
- '2022-05-06 09:00:00' | ||
- '2022-05-06 10:00:00' | ||
- '2022-05-06 11:00:00' | ||
- '2022-05-06 12:00:00' | ||
- '2022-05-06 13:00:00' | ||
- '2022-05-06 14:00:00' | ||
- '2022-05-06 15:00:00' | ||
- '2022-05-06 16:00:00' | ||
- '2022-05-06 17:00:00' | ||
- '2022-05-06 18:00:00' | ||
- '2022-05-06 19:00:00' | ||
- '2022-05-06 20:00:00' | ||
- '2022-05-06 21:00:00' | ||
- '2022-05-06 22:00:00' | ||
- '2022-05-06 23:00:00' | ||
- '2022-05-07 00:00:00' | ||
- '2022-05-07 01:00:00' | ||
- '2022-05-07 02:00:00' | ||
- '2022-05-07 03:00:00' | ||
- '2022-05-07 04:00:00' | ||
- '2022-05-07 05:00:00' | ||
- '2022-05-07 06:00:00' | ||
- '2022-05-07 07:00:00' | ||
- '2022-05-07 08:00:00' | ||
- '2022-05-07 09:00:00' | ||
- '2022-05-07 10:00:00' | ||
- '2022-05-07 11:00:00' | ||
- '2022-05-07 12:00:00' | ||
|
||
grid_col: '#cccccc' | ||
grid_lty: 3 | ||
grid_lwd: 1 | ||
grid_on: 'True' | ||
grid_x: listX | ||
|
||
# Labels for the x-axis | ||
indy_label: | ||
- '0' | ||
- '3' | ||
- '4' | ||
- '5' | ||
- '6' | ||
- '8' | ||
- '9' | ||
- '10' | ||
- '11' | ||
- '12' | ||
- '14' | ||
- '15' | ||
- '16' | ||
- '17' | ||
- '18' | ||
- '19' | ||
- '20' | ||
- '21' | ||
- '22' | ||
- '23' | ||
- '24' | ||
- '26' | ||
- '27' | ||
- '28' | ||
- '29' | ||
- '30' | ||
- '32' | ||
- '33' | ||
- '34' | ||
- '35' | ||
|
||
# Stagger the points so overlapping points don't obscure one another | ||
indy_stagger_1: 'True' | ||
indy_stagger_2: 'True' | ||
|
||
# Values for the x-axis | ||
indy_vals: | ||
- '0' | ||
- '30000' | ||
- '40000' | ||
- '50000' | ||
- '60000' | ||
- '80000' | ||
- '90000' | ||
- '100000' | ||
- '110000' | ||
- '120000' | ||
- '140000' | ||
- '150000' | ||
- '160000' | ||
- '170000' | ||
- '180000' | ||
- '190000' | ||
- '200000' | ||
- '210000' | ||
- '220000' | ||
- '230000' | ||
- '240000' | ||
- '260000' | ||
- '270000' | ||
- '280000' | ||
- '290000' | ||
- '300000' | ||
- '320000' | ||
- '330000' | ||
- '340000' | ||
- '350000' | ||
|
||
# Specify the variable corresponding to the x-axis | ||
indy_var: fcst_lead | ||
|
||
legend_box: o | ||
legend_inset: | ||
x: 0.0 | ||
y: -0.25 | ||
legend_ncol: -1 | ||
legend_size: 0.8 | ||
line_type: None | ||
|
||
# Explicitly set only the statistics for the derived series line | ||
# (without the accompanying variable name) | ||
list_stat_1: | ||
- SPREAD_PLUS_OERR | ||
- RMSE | ||
list_stat_2: [] | ||
|
||
mar: | ||
- 8 | ||
- 4 | ||
- 5 | ||
- 4 | ||
method: bca | ||
mgp: | ||
- 1 | ||
- 1 | ||
- 0 | ||
num_iterations: 1 | ||
num_threads: -1 | ||
plot_caption: Caption | ||
plot_ci: | ||
- std | ||
- std | ||
- std | ||
|
||
# Turn on/off displaying the lines | ||
plot_disp: | ||
- 'True' | ||
- 'True' | ||
- 'True' | ||
|
||
|
||
plot_filename: !ENV '${METPLUS_OUTPUT}/output/spread_skill_ecnt.png' | ||
plot_height: 8.5 | ||
plot_res: 72 | ||
plot_stat: median | ||
plot_type: png16m | ||
plot_units: in | ||
plot_width: 11.0 | ||
|
||
# Optional, uncomment and set to directory to store the .points1 file | ||
# that is used by METviewer (created when dump_points_1 is set to True) | ||
# if dump_points_1 is True and this is uncommented, the points1 file | ||
# will be saved in the default location (i.e. where the input data file is stored). | ||
#points_path: /path/to | ||
|
||
random_seed: null | ||
|
||
# Define the style of the line | ||
series_line_style: | ||
- '-' # solid | ||
- '--' # dashes | ||
- ':' # dots | ||
|
||
|
||
|
||
series_line_width: | ||
- 1 | ||
- 1 | ||
- 1 | ||
|
||
series_order: | ||
# The order in which to apply settings for line width, line style, colors, symbols, etc. | ||
# A convenience for experimenting with which color/line style/symbol combination works best for | ||
# a particular line. | ||
- 1 | ||
- 2 | ||
- 3 | ||
|
||
|
||
series_symbols: | ||
- . # circle | ||
- "s" # square | ||
- ^ # triangle up | ||
|
||
|
||
series_type: | ||
# b=lines + markers, l=lines only p=markers only | ||
- b | ||
- b | ||
- b | ||
|
||
series_val_1: | ||
# value of interest, in this case, the model, RRFS_GEFS_GF.SPP.SPPT | ||
model: | ||
- 'RRFS_GEFS_GF.SPP.SPPT' | ||
series_val_2: {} | ||
|
||
show_nstats: 'False' | ||
show_signif: | ||
- 'False' | ||
- 'False' | ||
- 'False' | ||
|
||
|
||
stat_input: !ENV '${METPLUS_OUTPUT}/output/ensemble_stat_ecnt.data' | ||
sync_yaxes: 'False' | ||
title: Ensemble spread skill line plots ECNT data (reformatted MET data) | ||
title_align: 0.5 | ||
title_offset: -2 | ||
title_size: 1.4 | ||
title_weight: 2.0 | ||
# Use empty list to use automatically generated legend labels | ||
user_legend: [] | ||
# comment above and uncomment below to use user-specified legend labels | ||
#user_legend: ['ECNT SPREAD_PLUS_OERR for RRFS_GEFS_GF.SPP.SPPT TMP ', 'ECNT RMSE for for RRFS_GEFS_GF.SPP.SPPT TMP', 'RATIO(RRFS_GEFS_GF.SPP.SPPT TMP SPREAD_PLUS_OERR/RMSE)'] | ||
variance_inflation_factor: 'False' | ||
vert_plot: 'False' | ||
x2lab_align: 0.5 | ||
x2lab_offset: -0.5 | ||
x2lab_size: 0.8 | ||
x2lab_weight: 1 | ||
x2tlab_horiz: 0.5 | ||
x2tlab_orient: 1 | ||
x2tlab_perp: 1 | ||
x2tlab_size: 0.8 | ||
xaxis: fcst lead (hr) | ||
xaxis_reverse: 'False' | ||
xlab_align: 0.5 | ||
xlab_offset: 2 | ||
xlab_size: 1 | ||
xlab_weight: 1 | ||
xlim: [] | ||
xtlab_decim: 0 | ||
xtlab_horiz: 0.5 | ||
xtlab_orient: 1 | ||
xtlab_perp: -0.75 | ||
xtlab_size: 1 | ||
y2lab_align: 0.5 | ||
y2lab_offset: 1 | ||
y2lab_size: 1 | ||
y2lab_weight: 1 | ||
y2lim: [] | ||
y2tlab_horiz: 0.5 | ||
y2tlab_orient: 1 | ||
y2tlab_perp: 1 | ||
y2tlab_size: 1.0 | ||
yaxis_1: Statistic value (or ratio of statistic values) | ||
yaxis_2: '' | ||
ylab_align: 0.5 | ||
ylab_offset: -2 | ||
ylab_size: 1 | ||
ylab_weight: 1 | ||
ylim: [] | ||
ytlab_horiz: 0.5 | ||
ytlab_orient: 1 | ||
ytlab_perp: 0.5 | ||
ytlab_size: 1 | ||
|
||
show_legend: | ||
# 0 for don't show, 1 to show | ||
- 1 | ||
- 1 | ||
- 1 | ||
|
||
|
||
# Default logging is ERROR and to stdout. Omit the log_filename and log_level setting name and value if | ||
# to use default settings. | ||
log_filename: !ENV '${METPLUS_OUTPUT}/output/spread_skill_ecnt.log' | ||
log_level: INFO | ||
|
||
# 0-value on the x-axis is to the far left. | ||
start_from_zero: True |