pybaseflow 0.1.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- pybaseflow/__init__.py +46 -0
- pybaseflow/data/README.md +13 -0
- pybaseflow/data/fish_river.csv +732 -0
- pybaseflow/estimate.py +302 -0
- pybaseflow/io.py +112 -0
- pybaseflow/separation.py +915 -0
- pybaseflow/tracer.py +131 -0
- pybaseflow/utils.py +73 -0
- pybaseflow-0.1.0.dist-info/METADATA +68 -0
- pybaseflow-0.1.0.dist-info/RECORD +12 -0
- pybaseflow-0.1.0.dist-info/WHEEL +5 -0
- pybaseflow-0.1.0.dist-info/top_level.txt +1 -0
pybaseflow/__init__.py
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"""pybaseflow — a comprehensive Python toolkit for baseflow separation."""
|
|
2
|
+
|
|
3
|
+
__version__ = "0.1.0"
|
|
4
|
+
|
|
5
|
+
import csv
|
|
6
|
+
from datetime import date
|
|
7
|
+
from pathlib import Path
|
|
8
|
+
|
|
9
|
+
import numpy as np
|
|
10
|
+
|
|
11
|
+
from pybaseflow.separation import * # noqa: F401,F403
|
|
12
|
+
from pybaseflow.estimate import * # noqa: F401,F403
|
|
13
|
+
from pybaseflow.utils import * # noqa: F401,F403
|
|
14
|
+
from pybaseflow.tracer import cmb, estimate_endmembers, calibrate_eckhardt_from_cmb # noqa: F401
|
|
15
|
+
|
|
16
|
+
_DATA_DIR = Path(__file__).parent / 'data'
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
def load_sample_data():
|
|
20
|
+
"""Load the bundled Fish River sample dataset.
|
|
21
|
+
|
|
22
|
+
Returns daily discharge for USGS site 01013500 (Fish River near Fort Kent,
|
|
23
|
+
Maine) for 2019-2020.
|
|
24
|
+
|
|
25
|
+
Returns:
|
|
26
|
+
dict: Dictionary with keys:
|
|
27
|
+
- 'dates': numpy array of datetime.date objects
|
|
28
|
+
- 'Q': numpy array of discharge in ft³/s
|
|
29
|
+
- 'site_id': '01013500'
|
|
30
|
+
- 'units': 'ft3/s'
|
|
31
|
+
"""
|
|
32
|
+
path = _DATA_DIR / 'fish_river.csv'
|
|
33
|
+
dates = []
|
|
34
|
+
values = []
|
|
35
|
+
with open(path, newline='') as f:
|
|
36
|
+
reader = csv.DictReader(f)
|
|
37
|
+
for row in reader:
|
|
38
|
+
dates.append(date.fromisoformat(row['date']))
|
|
39
|
+
val = row['discharge_cfs']
|
|
40
|
+
values.append(float(val) if val else np.nan)
|
|
41
|
+
return {
|
|
42
|
+
'dates': np.array(dates),
|
|
43
|
+
'Q': np.array(values, dtype=np.float64),
|
|
44
|
+
'site_id': '01013500',
|
|
45
|
+
'units': 'ft3/s',
|
|
46
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# Sample Data
|
|
2
|
+
|
|
3
|
+
## fish_river.csv
|
|
4
|
+
|
|
5
|
+
- **USGS Site**: 01013500 — Fish River near Fort Kent, Maine
|
|
6
|
+
- **Period**: 2019-01-01 to 2020-12-31 (731 days)
|
|
7
|
+
- **Parameter**: Daily mean discharge (ft³/s), NWIS parameter code 00060
|
|
8
|
+
- **Source**: USGS National Water Information System (NWIS), https://waterdata.usgs.gov/nwis
|
|
9
|
+
- **License**: US Government public domain
|
|
10
|
+
|
|
11
|
+
This is a clean, unregulated headwater gauge with a strong seasonal signal
|
|
12
|
+
(snowmelt peaks in spring, baseflow-dominated in late summer/fall), making
|
|
13
|
+
it a good test case for baseflow separation methods.
|