ewatercycle.analysis

Analysis methods for eWaterCycle.

Package Contents

ewatercycle.analysis.hydrograph(discharge: pandas.DataFrame, *, reference: str, precipitation: pandas.DataFrame | None = None, dpi: int | None = None, title: str = 'Hydrograph', 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, **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. 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 – Dataframe 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.

  • **kwargs – Options to pass to the matplotlib plotting function

Returns:

First tuple member is a matplotlib figure, the second is a tuple of axes.