ewatercycle.analysis package

ewatercycle.analysis.hydrograph(discharge: pandas.DataFrame, *, reference: str, precipitation: Optional[pandas.DataFrame] = None, dpi: Optional[int] = None, title: str = 'Hydrograph', discharge_units: str = 'm$^3$ s$^{-1}$', precipitation_units: str = 'mm day$^{-1}$', figsize: Tuple[float, float] = (10, 10), filename: Optional[Union[PathLike, str]] = None, nbars: Optional[int] = None, **kwargs) Tuple[matplotlib.pyplot.Figure, Tuple[matplotlib.pyplot.Axes, matplotlib.pyplot.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 (pd.DataFrame) – Dataframe containing time series of discharge data to be plotted.

  • reference (str) – 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 (pd.DataFrame, optional) – Optional dataframe containing time series of precipitation data to be plotted from the top of the hydrograph.

  • dpi (int, optional) – DPI for the plot.

  • title (str, optional) – Title of the hydrograph.

  • discharge_units (str, optional) – Units for the discharge data.

  • precipitation_units (str, optional) – Units for the precipitation data.

  • figsize ((float, float), optional) – With, height of the plot in inches.

  • filename (str or Path, optional) – If specified, a copy of the plot will be saved to this path.

  • nbars (Int, optional) – Number of bars to use for downsampling precipitation.

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

Returns

  • fig (matplotlib.figure.Figure)

  • ax, ax_tbl (tuple of matplotlib.axes.Axes)