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 | Provenance | Actions |
|---|---|---|---|---|
| wrtds-0.1.0.tar.gz | 30.3 kB | Without provenance | Details for wrtds-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| wrtds-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for wrtds-0.1.0-py3-none-any.whl |
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
|
Security for wrtds 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.