This release has been yanked by its maintainers, and will be ignored by installers, except when explicitly specified.
Reason given by maintainers: renamed to baseflowx
pybaseflow
A comprehensive Python toolkit for baseflow separation from streamflow hydrographs.
pybaseflow implements 17 baseflow separation methods spanning four paradigms: recursive digital filters, graphical/interval methods, recession-based methods, and tracer-based methods. It also provides parameter estimation, USGS data retrieval, and a CMB-to-Eckhardt calibration bridge.
This project builds on the baseflow package by Xie et al. (2020), which implemented methods described in "Evaluation of typical methods for baseflow separation in the contiguous United States" (Journal of Hydrology, 583, 124628). pybaseflow extends that work with new methods (PART, CMB, BFlow, IHACRES), a unified filter architecture, modern packaging, and USGS data integration.
This project is funded by CIROH.
Install
pip install pybaseflow
Quick Start
import pybaseflow
# Load bundled sample data (USGS 01013500, Fish River, Maine)
data = pybaseflow.load_sample_data()
Q = data['Q']
# Run a single method
b = pybaseflow.eckhardt(Q, a=0.98, BFImax=0.8)
# Or fetch your own data from USGS NWIS
from pybaseflow.io import fetch_usgs
data = fetch_usgs('01013500', '2019-01-01', '2020-12-31')
Methods
Recursive Digital Filters
All recursive digital filters share a generalized core:
b[t] = alpha * b[t-1] + beta * (Q[t] + gamma * Q[t-1])
gamma=0 family (linear reservoir based):
| Method | Function | Reference |
|---|---|---|
| Boughton | boughton(Q, a, C) |
Boughton, 1993 |
| Chapman-Maxwell | chapman_maxwell(Q, a) |
Chapman & Maxwell, 1996 |
| Eckhardt | eckhardt(Q, a, BFImax) |
Eckhardt, 2005 |
| EWMA | ewma(Q, e) |
Tularam & Ilahee, 2008 |
| Furey-Gupta | furey(Q, a, A) |
Furey & Gupta, 2001 |
| WHAT | what(Q, BFImax, a) |
Lim et al., 2005 (alias for Eckhardt) |
gamma=1 family (signal processing based):
| Method | Function | Reference |
|---|---|---|
| Lyne-Hollick | lh(Q) / lh_multi(Q, num_pass=3) |
Lyne & Hollick, 1979; Nathan & McMahon, 1990 |
| Chapman | chapman(Q, a) |
Chapman, 1991 |
| Willems | willems(Q, a, w) |
Willems, 2009 |
Variable gamma (hybrid):
| Method | Function | Reference |
|---|---|---|
| IHACRES | ihacres(Q, a, C, alpha_s) |
Jakeman & Hornberger, 1993 |
Graphical / Recession-Based Methods
| Method | Function | Reference |
|---|---|---|
| UKIH | ukih(Q, b_LH) |
UKIH, 1980 |
| Local minimum | local(Q, b_LH, area) |
Sloto & Crouse, 1996 |
| Fixed interval | fixed(Q, area) |
Sloto & Crouse, 1996 |
| Sliding interval | slide(Q, area) |
Sloto & Crouse, 1996 |
| PART | part(Q, area) |
Rutledge, 1998 |
Tracer-Based Methods
| Method | Function | Reference |
|---|---|---|
| Conductivity Mass Balance | cmb(Q, SC) |
Stewart et al., 2007 |
Recession Analysis
| Function | Description |
|---|---|
bflow(Q) |
BFlow 3-pass filter + recession analysis (Arnold & Allen, 1999) |
bn77(Q, ...) |
Brutsaert-Nieber drought flow identification (Cheng et al., 2016) |
Parameter Estimation
import pybaseflow
data = pybaseflow.load_sample_data()
Q = data['Q']
# Estimate recession coefficient from the hydrograph
strict = pybaseflow.strict_baseflow(Q)
a = pybaseflow.recession_coefficient(Q, strict)
# Use the estimated recession coefficient with any filter
b = pybaseflow.eckhardt(Q, a, BFImax=0.8)
b = pybaseflow.chapman_maxwell(Q, a)
b = pybaseflow.willems(Q, a, w=0.5)
CMB Calibration Bridge
Use specific conductance data to calibrate Eckhardt's BFImax:
from pybaseflow.tracer import calibrate_eckhardt_from_cmb
cal = calibrate_eckhardt_from_cmb(Q, SC)
b = pybaseflow.eckhardt(Q, cal['a'], cal['BFImax'])
BFlow / SWAT Integration
result = pybaseflow.bflow(Q)
print(f"ALPHA_BF = {result['alpha_factor']:.4f}") # for SWAT calibration
print(f"BFI = {result['BFI']:.3f}")
print(f"Baseflow days = {result['baseflow_days']:.1f}")
USGS Data Retrieval
from pybaseflow.io import fetch_usgs
# Fetch daily discharge
data = fetch_usgs('01013500', '2015-01-01', '2020-12-31')
Q = data['values']
# Fetch specific conductance (for CMB)
sc_data = fetch_usgs('01013500', '2015-01-01', '2020-12-31', parameter='sc')
License
MIT
Release files for pybaseflow 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pybaseflow-0.1.1.tar.gz | 24.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pybaseflow-0.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 47.9 kB
Release files / pybaseflow-0.1.1.tar.gz
| Download URL | pybaseflow-0.1.1.tar.gz |
|---|---|
| Size | 24.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e8eddba19f1f79e7bf7c4cd621916983db761066ddfe9f7d1656c647b4c0061c
|
|
BLAKE2b-256 checksum How to use checksums |
4651bcb332177437b9eac2f3fa8696bcaae840487cc93ee20a2519434555320d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.10.12
|
Release files / pybaseflow-0.1.1-py3-none-any.whl
| Download URL | pybaseflow-0.1.1-py3-none-any.whl |
|---|---|
| Size | 23.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e62681bee7330abb291a821f632069387d6d6c3a8778647a7fe5e1ec2ca81417
|
|
BLAKE2b-256 checksum How to use checksums |
18b1dcd480ec07573c6dcc47e81bca5cc89ecdb8680adf672c1502063ab53b58
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.10.12
|