hydrosignatures.hydrosignatures
#
Function for computing hydrologic signature.
Module Contents#
- class hydrosignatures.hydrosignatures.HydroSignatures#
Hydrological signatures.
- Parameters:
q_mmpt (
pandas.Series
) – Discharge in mm per unit time (the same timescale as precipitation).p_mmpt (
pandas.Series
) – Precipitation in mm per unit time (the same timescale as discharge).si_method (
str
, optional) – Seasonality index method. Eitherwalsh
ormarkham
. Default iswalsh
.fdc_slope_bins (
tuple
ofint
, optional) – The percentage bins between 1-100 to compute the slope of FDC within it, defaults to(33, 67)
.bfi_alpha (
float
, optional) – Alpha parameter for baseflow separation filter using Lyne and Hollick method. Default is0.925
.
- property values: SignaturesFloat#
Return a dictionary with the hydrological signatures.
- bfi()#
Compute Baseflow Index.
- diff(other)#
Compute absolute difference between two hydrological signatures.
- fdc()#
Compute exceedance probability (for flow duration curve).
- fdc_slope()#
Compute FDC slopes between a list of lower and upper percentiles.
- isclose(other)#
Check if the signatures are close between with a tolerance of 1e-3.
- mean_annual_flood()#
Compute mean annual flood.
- mean_monthly()#
Compute mean monthly flow (for regime curve).
- runoff_ratio()#
Compute total runoff ratio.
- seasonality_index()#
Compute seasonality index.
- streamflow_elasticity()#
Compute streamflow elasticity.
- to_dict()#
Return a dictionary with the hydrological signatures.
- to_json()#
Return a JSON string with the hydrological signatures.
- hydrosignatures.hydrosignatures.compute_ai(pet, prcp)#
- hydrosignatures.hydrosignatures.compute_ai(pet: pandas.DataFrame, prcp: pandas.DataFrame) pandas.Series
- hydrosignatures.hydrosignatures.compute_ai(pet: xarray.DataArray, prcp: xarray.DataArray) xarray.DataArray
Compute (Budyko) aridity index (PET/Prcp).
- Parameters:
pet (
pandas.DataFrame
orpandas.Series
orxarray.DataArray
) – Potential evapotranspiration time series. Each column can correspond to PET a different location. Note thatpet
andprcp
must have the same shape.prcp (
pandas.DataFrame
orpandas.Series
orxarray.DataArray
) – Precipitation time series. Each column can correspond to PET a different location. Note thatpet
andprcp
must have the same shape.
- Returns:
float
orpandas.Series
orxarray.DataArray
– The aridity index.
- hydrosignatures.hydrosignatures.compute_baseflow(discharge, alpha=0.925, n_passes=3, pad_width=10)#
Extract baseflow using the Lyne and Hollick filter (Ladson et al., 2013).
- Parameters:
discharge (
numpy.ndarray
orpandas.DataFrame
orpandas.Series
orxarray.DataArray
) – Discharge time series that must not have any missing values. It can also be a 2D array where each row is a time series.n_passes (
int
, optional) – Number of filter passes, defaults to 3. It must be an odd number greater than 3.alpha (
float
, optional) – Filter parameter that must be between 0 and 1, defaults to 0.925.pad_width (
int
, optional) – Padding width for extending the data from both ends to address the warm up issue.
- Returns:
numpy.ndarray
orpandas.DataFrame
orpandas.Series
orxarray.DataArray
– Same discharge input array-like but values replaced with computed baseflow values.
- hydrosignatures.hydrosignatures.compute_bfi(discharge, alpha=0.925, n_passes=3, pad_width=10)#
Compute the baseflow index using the Lyne and Hollick filter (Ladson et al., 2013).
- Parameters:
discharge (
numpy.ndarray
orpandas.DataFrame
orpandas.Series
orxarray.DataArray
) – Discharge time series that must not have any missing values. It can also be a 2D array where each row is a time series.n_passes (
int
, optional) – Number of filter passes, defaults to 3. It must be an odd number greater than 3.alpha (
float
, optional) – Filter parameter that must be between 0 and 1, defaults to 0.925.pad_width (
int
, optional) – Padding width for extending the data from both ends to address the warm up issue.
- Returns:
numpy.float64
– The baseflow index.
- hydrosignatures.hydrosignatures.compute_exceedance(daily, threshold=0.001)#
Compute exceedance probability from daily data.
- Parameters:
daily (
pandas.Series
orpandas.DataFrame
) – The data to be processedthreshold (
float
, optional) – The threshold to compute exceedance probability, defaults to 1e-3.
- Returns:
pandas.Series
orpandas.DataFrame
– Exceedance probability.
- hydrosignatures.hydrosignatures.compute_fdc_slope(discharge, bins, log)#
Compute FDC slopes between the given lower and upper percentiles.
- Parameters:
discharge (
pandas.Series
orpandas.DataFrame
ornumpy.ndarray
orxarray.DataArray
) – The discharge data to be processed.bins (
tuple
ofint
) – Percentile bins for computing FDC slopes between., e.g., (33, 67) returns the slope between the 33rd and 67th percentiles.log (
bool
) – Whether to use log-transformed data.
- Returns:
numpy.ndarray
– The slopes between the given percentiles.
- hydrosignatures.hydrosignatures.compute_flood_moments(streamflow)#
Compute flood moments (MAF, CV, CS) from streamflow.
- Parameters:
streamflow (
pandas.DataFrame
) – The streamflow data to be processed- Returns:
pandas.DataFrame
– Flood moments; mean annual flood (MAF), coefficient of variation (CV), and coefficient of skewness (CS).
- hydrosignatures.hydrosignatures.compute_mean_monthly(daily, index_abbr=False)#
Compute mean monthly summary from daily data.
- Parameters:
daily (
pandas.Series
orpandas.DataFrame
) – The data to be processedindex_abbr (
bool
, optional) – Whether to use abbreviated month names as index instead of numbers, defaults to False.
- Returns:
pandas.Series
orpandas.DataFrame
– Mean monthly summary.
- hydrosignatures.hydrosignatures.compute_rolling_mean_monthly(daily)#
Compute rolling mean monthly.
- hydrosignatures.hydrosignatures.compute_si_markham(data)#
Compute seasonality index based on Markham, 1970.
- hydrosignatures.hydrosignatures.compute_si_walsh(data)#
Compute seasonality index based on Walsh and Lawler, 1981 method.
- hydrosignatures.hydrosignatures.extract_extrema(ts, var_name, n_pts)#
Get local extrema in a time series.
- Parameters:
ts (
pandas.Series
) – Variable time series.var_name (
str
) – Variable name.n_pts (
int
) – Number of points to consider for detecting local extrema on both sides of each point.
- Returns:
pandas.DataFrame
– A dataframe with three columns:var_name
,peak
(bool) andtrough
(bool).