Reference

Class for Providentia library mode

class providentia.library.Providentia(config, **kwargs)[source]

Bases: object

Class for Providentia Library mode

apply_filter()[source]

Method to apply filters to data.

colourbar(fig, plot_ax, stat, speci, plot_type)[source]

Wrapper method to make a colourbar.

Parameters

figmatplotlib.figure.Figure

Figure object to which the colourbar will be added.

plot_axmatplotlib.axes.Axes

Axis for the main plot.

statstr

Statistic to display in the colourbar.

specistr

Species for which the colourbar applies.

plot_typestr

Plot type, used to fetch plot characteristics.

Returns

matplotlib.axes.Axes

Axis object of the created colourbar.

dashboard(**kwargs)[source]

Wrapper function for initialising Dashboard class

Parameters

**kwargsdict

Optional command-line arguments that override default configuration values.

data(format='nc')[source]

Wrapper method return data / metadata in specific format.

Parameters

formatstr, optional

File format, defaults to ‘nc’.

Returns

datanumpy.ndarray or xarray.Dataset

Data returned in the requested format.

download(**kwargs)[source]

Wrapper function for initialising Download class

Parameters

**kwargsdict

Optional command-line arguments that override default configuration values.

filter_station(station)[source]

Wrapper method to filter specific station/s.

Parameters

stationstr

Station reference

have_valid_config()[source]

Helper method for determining if a valid .conf file has been read

Returns

bool

True if a valid configuration file has been read, False otherwise.

interpolate(**kwargs)[source]

Wrapper function for initialising Interpolation class

Parameters

**kwargsdict

Optional command-line arguments that override default configuration values.

legend(plot_type, data_labels=None, set_obs=True)[source]

Wrapper method to make legend.

Parameters

plot_typestr

Plot type for which the legend will be generated.

data_labelslist, optional

Data arrays to plot, by default None.

set_obsbool, optional

Indicates if observations appear on the legend, by default True.

Returns

dict

Legend handles for the plot.

load()[source]

Wrapper method to load data into memory, apply initial filtering, and mark data as initialized.

loaded_data()[source]

Helper method for determining if data has been read

Returns

bool

True if data has been loaded, False otherwise.

plot(plot, data_labels=None, labela='', labelb='', title=None, xlabel=None, ylabel=None, cb=True, legend=True, set_obs_legend=True, map_extent=None, annotate=False, bias=False, domain=False, hidedata=False, logx=False, logy=False, multispecies=False, regression=False, smooth=False, threshold=False, gerrity=False, plot_options=None, save=False, return_plot=False, format=None, width=None, height=None, networkspeci=None, save_data=False, save_data_path='saved_data', tests_generate_output=False)[source]

Wrapper method to make a Providentia plot.

Parameters

plotstr

Plot type.

data_labelslist of str, optional

Data arrays to plot, defaults to None.

labelastr, optional

Label of first dataset, defaults to ‘’.

labelbstr, optional

Label of second dataset (if defined then a bias plot is made), defaults to ‘’.

titlestr, optional

Axes title, defaults to None.

xlabelstr, optional

Label on x axes, defaults to None.

ylabelstr, optional

Label on y axes, defaults to None.

cbbool, optional

Indicates if colorbar appears on plot, defaults to True.

legendbool, optional

Indicates if legend appears on plot, defaults to True.

set_obs_legendbool, optional

Indicates if observations appear on legend, defaults to True.

map_extentlist, optional

Map extent, defaults to None.

annotatebool or list, optional

Indicates if there are annotations or a list of statistics to annotate, defaults to False.

biasbool, optional

Indicates if data is biased, defaults to False.

domainbool, optional

Indicates if domain shows in maps, defaults to False.

hidedatabool, optional

Indicates if data points are hidden in plot, defaults to False.

logxbool, optional

Indicates if the scale of the x axis is log, defaults to False.

logybool, optional

Indicates if the scale of the y axis is log, defaults to False.

multispeciesbool, optional

Indicates if plot has multispecies, defaults to False.

regressionbool, optional

Indicates if scatter plot has regression line/s, defaults to False.

smoothbool, int, float, optional

Indicates if timeseries has smooth line/s or the smoothing window, defaults to False.

thresholdbool, optional

Indicates if plot has threshold line/s, defaults to False.

gerritybool, optional

Indicates if plot shows Gerrity scores per station

plot_optionslist, optional

List with plot options, defaults to None.

savebool or str, optional

Indicates if you want to save the figure, defaults to False.

return_plotbool, optional

Indicates if you want to get the figure object, defaults to False.

formatdict, optional

Format to overwrite the plot characteristics, defaults to None.

widthint or float, optional

Figure width, defaults to None.

heightint or float, optional

Figure height, defaults to None.

networkspecistr, optional

Selected networkspeci for non-multispecies plots

save_datastr, optional

Indicates if you want to save data to CSV

save_data_pathstr, optional

Path to save data, defaults to folder saved_data

tests_generate_outputbool, optional

Indicates if tests need to regenerate CSV files with plot data

Returns

matplotlib.figure.Figure or None

Returns the figure object if return_plot is True. Otherwise, displays the plot or saves it to file.

print_config(conf=None, config=None)[source]

Print selected configuration file to the console.

Parameters

confstr, optional

Configuration file name, defaults to None.

configstr, optional

Alternative Configuration file name, defaults to None. If both conf and config are None, the currently loaded configuration file is printed.

report(**kwargs)[source]

Wrapper function for initialising Report class

Parameters

**kwargsdict

Optional command-line arguments that override default configuration values.

reset(initialise=False)[source]

Wrapper method to reset filter data.

Parameters

initialisebool, optional

Indicates whether to reset data to initial state when class was initialised

save(fname='', format='nc')[source]

Wrapper method to save current data/ metadata in memory.

Parameters

fnamestr, optional

File name, defaults to ‘’.

formatstr, optional

File format, defaults to ‘nc’.

statistic(stat, labela='', labelb='', per_station=False, period=None, chunk=None)[source]

Wrapper method to calculate statistic/s.

Parameters

statstr

Statistic to calculate.

labelastr, optional

Label of first dataset, by default ‘’.

labelbstr, optional

Label of second dataset (if defined then a bias statistic is calculated), by default ‘’.

per_stationbool, optional

Indicates if the statistic should be calculated per station or integrated for all stations, by default False.

periodstr, optional

Period to group data into for calculation of statistics. Current options: ‘hour’, ‘dayofweek’, ‘month’.

chunkstr, optional

Chunked temporal window to calculate statistics for. Current options: ‘daily’, ‘monthly’, ‘annual’.

Returns

np.ndarray

Calculated statistic values.

variable(var='')[source]

Wrapper method to return a specific data/metadata variable.

Parameters

varstr, optional

Variable name to read, defaults to ‘’.

Returns

numpy.ndarray

Data of the requested variable. Returns None if variable is undefined or not available.