ewatercycle.analysis.hydrograph
Analysis methods for eWaterCycle.
Module Contents
- class ewatercycle.analysis.hydrograph.Metric
Bases:
ProtocolA HydroErr metric function.
HydroErr attaches the full name and the abbreviation of each metric to its function object at import time, so they are invisible to type checkers.
- ewatercycle.analysis.hydrograph.metric_functions
- ewatercycle.analysis.hydrograph.metric_map
- ewatercycle.analysis.hydrograph.hydrograph(discharge: pandas.DataFrame | pandas.Series | xarray.DataArray | xarray.Dataset, *, reference: str, precipitation: pandas.DataFrame | pandas.Series | xarray.DataArray | xarray.Dataset | None = None, dpi: int | None = None, title: str | None = None, discharge_units: str = 'm$^3$ s$^{-1}$', precipitation_units: str = 'mm day$^{-1}$', figsize: tuple[float, float] = (10, 10), filename: os.PathLike | str | None = None, nbars: int | None = None, metrics_list: list[object] | None = None, selected_year: int | None = None, **kwargs) tuple[matplotlib.figure.Figure, tuple[matplotlib.axes.Axes, matplotlib.axes.Axes]]
Plot a hydrograph.
This utility function makes it convenient to create a hydrograph from a set of discharge data from a pandas.DataFrame or xarray.Dataset. A column must
be marked as the reference, so that the agreement metrics can be calculated.
Optionally, the corresponding precipitation data can be plotted for comparison.
- Parameters:
discharge – Data containing time series of discharge data to be plotted.
reference – Name of the reference data, must correspond to a column in the discharge dataframe. Metrics are calculated between the reference column and each of the other columns.
precipitation – Optional dataframe containing time series of precipitation data to be plotted from the top of the hydrograph.
dpi – DPI for the plot.
title – Title of the hydrograph.
discharge_units – Units for the discharge data.
precipitation_units – Units for the precipitation data.
figsize – With, height of the plot in inches.
filename – If specified, a copy of the plot will be saved to this path.
nbars – Number of bars to use for downsampling precipitation.
metrics_list – List of metrics to calculate and display in the table below the hydrograph. If not specified, a default set of metrics is used.
selected_year – Slices a single year from the data
**kwargs – Options to pass to the matplotlib plotting function
- Returns:
First tuple member is a matplotlib figure, the second is a tuple of axes.