wrtds-py
A Python implementation of WRTDS (Weighted Regressions on Time, Discharge, and Season), the USGS method for estimating long-term trends in river water quality.
Documentation: https://mullenkamp.github.io/wrtds-py/
Source Code: https://github.com/mullenkamp/wrtds-py
Overview
This package is a Python transcription of the USGS R package EGRET. It uses pandas DataFrames as the base data structure with scipy for optimization and interpolation and matplotlib for plotting.
Key features:
- Weighted censored regression — locally weighted MLE with tricube kernels on time, discharge, and season
- Flow normalization — isolate water-quality trends from discharge variability
- WRTDS-K — AR(1) residual interpolation for improved daily estimates
- Trend analysis — pairwise, group, and time-series decomposition (CQTC/QTC)
- Bootstrap confidence intervals — block resampling with bias correction
- Plotting — data overview, annual histories, contour surfaces, and diagnostics
Installation
pip install wrtds
Requires Python >= 3.10.
Quick Example
import pandas as pd
from wrtds import WRTDS
daily = pd.read_csv('daily.csv', parse_dates=['Date'])
sample = pd.read_csv('sample.csv', parse_dates=['Date'])
w = WRTDS(daily, sample, info={'station_name': 'Choptank River'})
w.fit()
w.kalman()
print(w.table_results())
print(w.run_pairs(year1=1985, year2=2010))
w.plot_conc_hist()
See the Quickstart for a full walkthrough.
Development
We use uv to manage the development environment.
uv sync # install dependencies
uv run pytest # run tests
License
This project is licensed under the terms of the Apache Software License 2.0.
Metadata
Release files for wrtds 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| wrtds-0.1.0.tar.gz | 30.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| wrtds-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 67.6 kB
Release files / wrtds-0.1.0.tar.gz
| Download URL | wrtds-0.1.0.tar.gz |
|---|---|
| Size | 30.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9976b67a387c1882eb8a48a6de150d6b502949c7fc419d6efa596e1af5c71d61
|
|
BLAKE2b-256 checksum How to use checksums |
bfef4ff59009254951448def2b065e99eda9c483d3bc375349a27011186e0c03
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.8.7
|
Release files / wrtds-0.1.0-py3-none-any.whl
| Download URL | wrtds-0.1.0-py3-none-any.whl |
|---|---|
| Size | 37.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4454d61afc04e95b6f2498f45d4fe92c2d12d3a6ac26da5ff880bd5caab2437f
|
|
BLAKE2b-256 checksum How to use checksums |
2b9ad5d1b5473ffe956a1fe934895d120c81af5aab62ef11cf7835892c6ad4e7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.8.7
|