pyValEIA.plots.swarm_stat_plots

Functions to plot Swarm skill score statistical outcomes.

Functions

lss_plot_Swarm(model1, model2, eia_type, date_range[, ...])

Plot LSS vs CSI or PC 4 panels (one for each LSS).

one_model_lss_plot_Swarm(model1, eia_type, date_range)

Plot LSS vs CSI or PC 4 panels (one for each LSS) for 1 model alone.

map_hist_panel(ax, model[, bin_lons, DayNight, LT_range])

Plot histogram maps on a panel.

plot_hist_quad_maps(model_states, sat, eia_type, ...)

Plot histograms for each Hit, Miss, False Pos, and Cor Neg.

HMFC_percent_panel(model_states, df_table, fig, ax, ...)

Plot percentages of H/(H+M), M/(H+M), F/(F+C), C/(C+F) as 4 quadrants.

HMFC_percent_figure(model1, model2, eia_type[, ...])

Plot full figure using HMFC_percent_panel.

plot_2hist_quad_maps(model_states, model2_states, sat, ...)

Plot histogram maps for each score: Hit, Miss, False Pos, and Cor Neg.

map_2hist_panel(ax, model, model2[, bin_lons, ...])

Plot histogram maps on a panel for 2 models.

Module Contents

pyValEIA.plots.swarm_stat_plots.lss_plot_Swarm(model1, model2, eia_type, date_range, model1_name='Model1', model2_name='Model2', PorC='PC', DayNight=True, LT_range=None, coin=True, lssylim=None, lssxlim=None)[source]

Plot LSS vs CSI or PC 4 panels (one for each LSS).

Parameters:
model1DataFrame

first model DataFrame built by multiday_states_report

model2DataFrame

second model DataFrame built by multiday_states_report

eia_typestr

desired eia type for fig title

date_rangedatetime range

For plotting title purposes

model1_namestr kwarg

first model name for labelling purposes

model2_namestr kwarg

second model name for labelling purposes

PorCstr kwarg

Percent correct or Critical success index for x axes

DayNightbool kwarg

True (default) if panels should have separate markers for day and night otherwise (false) all are plotted together

LT_rangelist-like or NoneType

Range of day night local time, or None for default of [7, 19] (default=None)

coinbool kwarg

If True, coin LSS will be plotted for comparison (default) if false, coin LSS will not be plotted

lssylimlist-like or NoneType

y axis limit, defaults to [-1,1] if None is provided (default=None)

lssxlimlist-like or NoneType

y axis limit, defaults to [0,1] if None is provided (default=None)

Returns:
figfig handle

4 panel figure (one for each LSS)

See also

io.load.multiday_states_report

Notes

LSS can range outside of +/-1

pyValEIA.plots.swarm_stat_plots.one_model_lss_plot_Swarm(model1, eia_type, date_range, model_name='Model', PorC='PC', DayNight=True, LT_range=None, coin=True)[source]

Plot LSS vs CSI or PC 4 panels (one for each LSS) for 1 model alone.

Parameters:
model1DataFrame

model DataFrame built by multiday_states_report

eia_typestr

desired eia type for fig title

date_rangedatetime range

For plotting title purposes

model_namestr kwarg

first model name for labelling purposes

PorCstr kwarg

Percent correct or Critical success index for x axes

DayNightbool kwarg

True (default) if panels should have separate markers for day and night otherwise (false) all are plotted together

LT_rangelist-like or NoneType

Range of day night local time, or if None is supplied, [7, 19] is used to specify 07:00-19:00 LT for daytime and 19:00-07:00 LT for nighttime (default=None)

coinbool kwarg

If True, coin LSS will be plotted for comparison (default) if false, coin LSS will not be plotted

Returns:
figfig handle

4 panel figure (one for each LSS)

See also

io.load.multiday_states_report

Notes

LSS is only useful in comparison to another model, therefore, coin set to True is highly recommended!

pyValEIA.plots.swarm_stat_plots.map_hist_panel(ax, model, bin_lons=37, DayNight=True, LT_range=None)[source]

Plot histogram maps on a panel.

Parameters:
axplt axis

matplotlib.plt axis

modelDataFrame

DataFrame of model data including skill and local times built by states_report_swarm

bin_lonsint

Number of bins between -180 and 180 deg geo lon (default=37)

DayNightbool

True if panels should have separate markers for day and night or False for all to be plotted together (default=True)

LT_rangelist-like or NoneType

Range of day night local time, or if None is supplied, [7, 19] is used to specify 07:00-19:00 LT for daytime and 19:00-07:00 LT for nighttime (default=None)

Returns:
axplt axis

original axis with data plotted

hist_axplt axis

twinx axis to ax with histogram plotted

pyValEIA.plots.swarm_stat_plots.plot_hist_quad_maps(model_states, sat, eia_type, date_range, bin_lons=37, model_name='Model', fosi=16, hist_ylim=None, LT_range=None)[source]

Plot histograms for each Hit, Miss, False Pos, and Cor Neg.

Parameters:
model_statespd.DataFrame

DataFrame of model data including skill and local times built by multiday_states_report

satstr

swarm satellite ‘A’, ‘B’, or ‘C’

eia_typestr

eia state e.g. EIA, Peak, etc. depending on what is considered a hit

date_rangepd.DateRange

range of dates for title purposes

bin_lonsint

Number of bins between -180 and 180 deg geo lon (default=37)

model_namestr

name of model for title purposes (default=’Model’)

fosiint

font size for plot (default=16)

hist_ylimlist-like or NoneType

y range (counts) for hist plot, if None uses [0, 15] (default=None)

LT_rangelist-like or NoneType

Range of day night local time, or if None is supplied, [7, 19] is used to specify 07:00-19:00 LT for daytime and 19:00-07:00 LT for nighttime (default=None)

Returns:
figfigure handle

fig with 4 panels of hist maps

See also

io.load.multiday_states_report
pyValEIA.plots.swarm_stat_plots.HMFC_percent_panel(model_states, df_table, fig, ax, eia_type, colors=None)[source]

Plot percentages of H/(H+M), M/(H+M), F/(F+C), C/(C+F) as 4 quadrants.

Parameters:
model_statespd.DataFrame

DataFrame of model data including skill and local times built by multiday_states_report

df_tablepd.DataFrame

Decision table build by decision_table_sat

figfigure

Figure for plotting on

eia_typestr

String designating which EIA type is being reported

colorslist of strings or NoneType

colors to be plotted for each satellite (default=None)

Returns
——
figfigure

the resulting figure

See also

io.load.multiday_states_report
stats.tables.decision_table_sat
pyValEIA.plots.swarm_stat_plots.HMFC_percent_figure(model1, model2, eia_type, model1_name='Model1', model2_name='Model2', col1='orange', col2='purple', fosi=16)[source]

Plot full figure using HMFC_percent_panel.

Parameters:
model1pd.DataFrame

First model DataFrame built by states_report_swarm

model2pd.DataFrame

Second model DataFrame built by states_report_swarm

eia_typestr

Desired eia type for fig title

model1_namestr

First model name for labelling purposes (default=’Model1’)

model2_namestr

Second model name for labelling purposes (default=’Model2’)

col1str

Plotting color for Model1 (default=’orange’)

col2str

plotting color for Model 2 (default=’purple’)

fosiint

font size for plot

Returns:
figfigure

Figure handle

Notes

This figure has a lot going on. When you look at it, think of each quadrant as a separate plot defined by Hit, Miss, Correct Negative, and False Positive as labelled. The percentages are the percent the model got correct or incorrect based on event states For example, for Hits, ther percentage is Hit/(Hit + Miss) where Hit+Miss is the total in the event states, the panel below that Miss/(Hit+Miss) is equivalent to 100% - Hit/(Hit + Miss), so those sectors are conjugate to each other For quick viewing, there are 4 shaded regions. These represent when a model is doing better than a coin toss. Ideally, False positives and Misses would have a low % and Hits and Correct Negatives have a higher percentage

pyValEIA.plots.swarm_stat_plots.plot_2hist_quad_maps(model_states, model2_states, sat, eia_type, date_range, bin_lons=37, model_name='Model', model2_name='Model2', fosi=16, hist_ylim=None, LT_range=None)[source]

Plot histogram maps for each score: Hit, Miss, False Pos, and Cor Neg.

Parameters:
model_statesdataframe

dataframe of model data including skill and local times built by states_report_swarm

satstr

swarm satellite ‘A’, ‘B’, or ‘C’

eia_typestr

eia state e.g. EIA, Peak, etc. depending on what is considered a hit

date_rangepandas daterange

range of dates for title purposes

bin_lonsint kwarg

number of bins between -180 and 180 deg geo lon default 37 np.linspace(-180, 180, bin_lons)

model_namestr kwarg

name of model for title purposes default ‘Model’

fosiint kwarg

font size for plot default 16

hist_ylimlist-like or NoneType

y range (counts) for hist plot, or None for default of [0, 15] (default=None)

LT_rangelist-like or NoneType

Range of day night local time, or None for default of [7, 19] (default=None)

Returns:
figfigure handle

fig with 4 panels of hist maps

pyValEIA.plots.swarm_stat_plots.map_2hist_panel(ax, model, model2, bin_lons=37, DayNight=True, LT_range=None)[source]

Plot histogram maps on a panel for 2 models.

Parameters:
axplt axis

matplotlib.plt axis

modeldataframe

dataframe of model data including skill and local times built by states_report_swarm

bin_lonsint kwarg

number of bins between -180 and 180 deg geo lon np.linspace(-180, 180, bin_lons)

DayNightbool kwarg

True (default) if panels should have separate markers for day and night otherwise (false) all are plotted together

LT_rangelist-like or NoneType

Range of day night local time, or None for default of [7, 19] (default=None)

Returns:
axplt axis

original axis with data plotted

hist_axplt axis

twinx axis to ax with histogram plotted