sup3r.qa.visual_qa.Sup3rVisualQa
- class Sup3rVisualQa(file_paths, out_pattern, features, time_step=10, spatial_slice=slice(None, None, None), source_handler_class=None, max_workers=None, overwrite=False, **kwargs)[source]
Bases:
object
Module to plot features for visual qa
- Parameters:
file_paths (list | str) – Specifies the files to use for the plotting routine. This is either a list of h5 files generated by the forward pass module or a string pointing to h5 forward pass output which can be parsed by glob.glob
out_pattern (str) – The pattern to use for naming the plot figures. This must include {feature} and {index} so output files can be named with out_pattern.format(feature=feature, index=index). e.g. outfile_{feature}_{index}.png. The number of plot figures is determined by the time_index of the h5 files and the time_step argument. The index key refers to the plot file index from the list of all plot files generated.
features (list) – List of features to plot from the h5 files provided.
time_step (int) – Number of timesteps to average over for a single plot figure.
spatial_slice (slice) – Slice specifying the spatial range to plot. This can include a step > 1 to speed up plotting.
source_handler_class (str | None) – Name of the class to use for h5 input files. If None this defaults to MultiFileResource.
max_workers (int | None) – Max number of workers to use for plotting. If workers=1 then all plots will be created in serial.
overwrite (bool) – Whether to overwrite saved plots.
**kwargs (dict) – Dictionary of kwargs passed to matplotlib.pyplot.scatter().
Methods
get_node_cmd
(config)Get a CLI call to initialize Sup3rVisualQa and execute the Sup3rVisualQa.run() method based on an input config
plot_figure
(res, time_index, feature, ...)Plot temporal average for the given feature and with the time range specified by t_slice
run
()Create plot figures for all the features in self.features.
- run()[source]
Create plot figures for all the features in self.features. For each feature there will be n_files created, where n_files is the number of timesteps in the h5 files provided divided by self.time_step.
- plot_figure(res, time_index, feature, t_slice, s_slice, out_file)[source]
Plot temporal average for the given feature and with the time range specified by t_slice
- Parameters:
res (MultiFileResourceX) – Resource handler for the provided h5 files
time_index (pd.DateTimeIndex) – The time index for the provided h5 files
feature (str) – The feature to plot
t_slice (slice) – The slice specifying the time range to average and plot
s_slice (slice) – The slice specifying the spatial range to plot.
out_file (str) – Name of the output plot file