A library for fitting multi-segment stage-discharge rating curves.
Project description
ratingcurve
A Python library for fitting stage-discharge rating curves.
Use ratingcurve
to fit streamflow ratings with a segmented power law,
which is the the most common model used by USGS.
At this time, the library is for research and is not ready for operation.
Installation
Install using pip
pip install ratingcurve
or conda
# acreate a new environment
conda create -n ratingcurve
conda activate ratingcurve
conda install -c conda-forge ratingcurve
# add environment to jupyter
python -m ipykernel install --user --name=ratingcurve
Getting Started
The segmented-power-law-demo.ipynb
notebook demonstrates basic use of the package.
You can try it out in Google Colab
or locally using the environment created in the previous step
conda activate base # or your prefered jupyter lab environment
jupyter lab
then open the notebook and select the ratingcurve
kernel that was installed earlier.
A simple example is given below.
from ratingcurve.ratingmodel import PowerLawRating
from ratingcurve import data
# load tutorial data
df = data.load('green channel')
# setup model
segments = 2
powerrating = PowerLawRating(q=df['q'],
h=df['stage'],
q_sigma=df['q_sigma'],
segments=segments)
# fit model, then simulate the rating
with powerrating:
mean_field = pm.fit(n=150_000)
trace = mean_field.sample(5000)
powerrating.plot(trace)
See the notebooks for more examples.
Disclaimer
This software is preliminary or provisional and is subject to revision. It is being provided to meet the need for timely best science. The software has not received final approval by the U.S. Geological Survey (USGS). No warranty, expressed or implied, is made by the USGS or the U.S. Government as to the functionality of the software and related material nor shall the fact of release constitute any such warranty. The software is provided on the condition that neither the USGS nor the U.S. Government shall be held liable for any damages resulting from the authorized or unauthorized use of the software.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for ratingcurve-0.3.4-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8d3ced06167ea7999ac5f754710fabd2ed34f9c4d587458e01e578ff01540ef7 |
|
MD5 | 9944ed885ab45a1a5100b357f9986c88 |
|
BLAKE2b-256 | 9b446dad9a719216e842769d5e17deb0c416b64879889531f8d46697e4a574bc |