ratingcurve


Nameratingcurve JSON
Version 1.0.1 PyPI version JSON
download
home_page
SummaryA library for fitting multi-segment stage-discharge rating curves.
upload_time2024-03-06 21:42:57
maintainer
docs_urlNone
author
requires_python>=3.9
licenseLicense ======= Unless otherwise noted, this project is in the public domain in the United States because it contains materials that originally came from the United States Geological Survey, an agency of the United States Department of Interior. For more information, see the official USGS copyright policy at https://www.usgs.gov/information-policies-and-instructions/copyrights-and-credits Additionally, we waive copyright and related rights in the work worldwide through the CC0 1.0 Universal public domain dedication. CC0 1.0 Universal Summary ------------------------- This is a human-readable summary of the [Legal Code (read the full text)][1]. ### No Copyright The person who associated a work with this deed has dedicated the work to the public domain by waiving all of his or her rights to the work worldwide under copyright law, including all related and neighboring rights, to the extent allowed by law. You can copy, modify, distribute and perform the work, even for commercial purposes, all without asking permission. ### Other Information In no way are the patent or trademark rights of any person affected by CC0, nor are the rights that other persons may have in the work or in how the work is used, such as publicity or privacy rights. Unless expressly stated otherwise, the person who associated a work with this deed makes no warranties about the work, and disclaims liability for all uses of the work, to the fullest extent permitted by applicable law. When using or citing the work, you should not imply endorsement by the author or the affirmer. [1]: https://creativecommons.org/publicdomain/zero/1.0/legalcode
keywords usgs streamflow rating curve
VCS
bugtrack_url
requirements pymc pandas pytensor patsy
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # ratingcurve
*A Python package for fitting hydrologic rating curves.*

In hydrology, a rating curve is a mathematical relationship between streamflow and water surface elevation (stage).
Because stage is much easier to measure than streamflow, almost all streamflow timeseries are generated from rating curves.
For the most part, those rating curves are still fit manually by drawing a curve to the data,
which can be time consuming and subjective.
To improve that process, the U.S. Geological Survey (USGS), among others, is evaluating methods for automating that fitting. 
Several automated methods currently exist, but each parameterizes the rating curve slightly differently,
and because of the nature of the problem, those slight differences can greatly affect performance.
To help the community evaluate different parameterizations,
we created the `ratingcurve` package, which implements our best parameterization for others to try.
Furthermore, the implementation uses [PyMC](https://www.pymc.io/welcome.html), a general purpose library for probabilistic modeling, 
which makes it easier for others to modify the model to test different parameterizations or fitting algorithms.
If you can improve upon our parameterization, USGS might use your algorithm to generate streamflow timeseries at thousands of locations around the United States.
The package includes simple demonstrations and test datasets to get you started.

Please report any bugs, suggest enhancements, or ask questions by creating an [issue](https://github.com/thodson-usgs/ratingcurve/issues).
  
## Installation
Install using pip
```sh
pip install ratingcurve
```
or conda
```sh
conda install -c conda-forge ratingcurve
```

## Basic Usage
This [`tutorial`](https://github.com/thodson-usgs/ratingcurve/blob/main/docs/notebooks/segmented-power-law-tutorial.ipynb) demonstrates basic usage of fitting and plottig a rating curve

[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/thodson-usgs/ratingcurve/blob/main/docs/notebooks/segmented-power-law-tutorial.ipynb)
[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/thodson-usgs/ratingcurve/main?labpath=docs%2Fnotebooks%2Fsegmented-power-law-tutorial.ipynb)

```python
from ratingcurve.ratings import PowerLawRating
from ratingcurve import data

# load tutorial data
df = data.load('green channel')

# initialize the model
powerrating = PowerLawRating(segments=2)
                                   
# fit the model
trace = powerrating.fit(q=df['q'],
                        h=df['stage'], 
                        q_sigma=df['q_sigma'])
powerrating.plot()
```
![example plot](https://github.com/thodson-usgs/ratingcurve/blob/main/docs/assets/green-channel-rating-plot.png?raw=true)


Once fit, easily generate a rating table that can be imported into other applications.
```python
powerrating.table()
```

For more, see the [documentation](https://thodson-usgs.github.io/ratingcurve/meta/intro.html).

## 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.

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "ratingcurve",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": "Timothy Hodson <thodson@usgs.gov>",
    "keywords": "USGS,streamflow,rating curve",
    "author": "",
    "author_email": "",
    "download_url": "https://files.pythonhosted.org/packages/c4/12/c859a61edc7a4eabf52651c430c75b6cb719ce2f6a61c4f8101c382edebf/ratingcurve-1.0.1.tar.gz",
    "platform": null,
    "description": "# ratingcurve\n*A Python package for fitting hydrologic rating curves.*\n\nIn hydrology, a rating curve is a mathematical relationship between streamflow and water surface elevation (stage).\nBecause stage is much easier to measure than streamflow, almost all streamflow timeseries are generated from rating curves.\nFor the most part, those rating curves are still fit manually by drawing a curve to the data,\nwhich can be time consuming and subjective.\nTo improve that process, the U.S. Geological Survey (USGS), among others, is evaluating methods for automating that fitting. \nSeveral automated methods currently exist, but each parameterizes the rating curve slightly differently,\nand because of the nature of the problem, those slight differences can greatly affect performance.\nTo help the community evaluate different parameterizations,\nwe created the `ratingcurve` package, which implements our best parameterization for others to try.\nFurthermore, the implementation uses [PyMC](https://www.pymc.io/welcome.html), a general purpose library for probabilistic modeling, \nwhich makes it easier for others to modify the model to test different parameterizations or fitting algorithms.\nIf you can improve upon our parameterization, USGS might use your algorithm to generate streamflow timeseries at thousands of locations around the United States.\nThe package includes simple demonstrations and test datasets to get you started.\n\nPlease report any bugs, suggest enhancements, or ask questions by creating an [issue](https://github.com/thodson-usgs/ratingcurve/issues).\n  \n## Installation\nInstall using pip\n```sh\npip install ratingcurve\n```\nor conda\n```sh\nconda install -c conda-forge ratingcurve\n```\n\n## Basic Usage\nThis [`tutorial`](https://github.com/thodson-usgs/ratingcurve/blob/main/docs/notebooks/segmented-power-law-tutorial.ipynb) demonstrates basic usage of fitting and plottig a rating curve\n\n[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/thodson-usgs/ratingcurve/blob/main/docs/notebooks/segmented-power-law-tutorial.ipynb)\n[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/thodson-usgs/ratingcurve/main?labpath=docs%2Fnotebooks%2Fsegmented-power-law-tutorial.ipynb)\n\n```python\nfrom ratingcurve.ratings import PowerLawRating\nfrom ratingcurve import data\n\n# load tutorial data\ndf = data.load('green channel')\n\n# initialize the model\npowerrating = PowerLawRating(segments=2)\n                                   \n# fit the model\ntrace = powerrating.fit(q=df['q'],\n                        h=df['stage'], \n                        q_sigma=df['q_sigma'])\npowerrating.plot()\n```\n![example plot](https://github.com/thodson-usgs/ratingcurve/blob/main/docs/assets/green-channel-rating-plot.png?raw=true)\n\n\nOnce fit, easily generate a rating table that can be imported into other applications.\n```python\npowerrating.table()\n```\n\nFor more, see the [documentation](https://thodson-usgs.github.io/ratingcurve/meta/intro.html).\n\n## Disclaimer\n\nThis software is preliminary or provisional and is subject to revision. \nIt is being provided to meet the need for timely best science.\nThe software has not received final approval by the U.S. Geological Survey (USGS).\nNo 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. \nThe 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.\n",
    "bugtrack_url": null,
    "license": "License =======  Unless otherwise noted, this project is in the public domain in the United States because it contains materials that originally came from the United States Geological Survey, an agency of the United States Department of Interior. For more information, see the official USGS copyright policy at https://www.usgs.gov/information-policies-and-instructions/copyrights-and-credits  Additionally, we waive copyright and related rights in the work worldwide through the CC0 1.0 Universal public domain dedication.   CC0 1.0 Universal Summary -------------------------  This is a human-readable summary of the [Legal Code (read the full text)][1].   ### No Copyright  The person who associated a work with this deed has dedicated the work to the public domain by waiving all of his or her rights to the work worldwide under copyright law, including all related and neighboring rights, to the extent allowed by law.  You can copy, modify, distribute and perform the work, even for commercial purposes, all without asking permission.   ### Other Information  In no way are the patent or trademark rights of any person affected by CC0, nor are the rights that other persons may have in the work or in how the work is used, such as publicity or privacy rights.  Unless expressly stated otherwise, the person who associated a work with this deed makes no warranties about the work, and disclaims liability for all uses of the work, to the fullest extent permitted by applicable law. When using or citing the work, you should not imply endorsement by the author or the affirmer.    [1]: https://creativecommons.org/publicdomain/zero/1.0/legalcode ",
    "summary": "A library for fitting multi-segment stage-discharge rating curves.",
    "version": "1.0.1",
    "project_urls": {
        "homepage": "https://github.com/thodson-usgs/ratingcurve",
        "repository": "https://github.com/thodson-usgs/ratingcurve.git"
    },
    "split_keywords": [
        "usgs",
        "streamflow",
        "rating curve"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "3e11dfe0f5eb19a8ee3808eed6eb51a413f04bcf66287622dcabb4fb6f2f68e8",
                "md5": "cbabec90ed43361607efefcd42b98793",
                "sha256": "b00dabf1c6991d06ec42bab1607105787b2e9c11c333ddee886cce1573b28399"
            },
            "downloads": -1,
            "filename": "ratingcurve-1.0.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "cbabec90ed43361607efefcd42b98793",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 46352,
            "upload_time": "2024-03-06T21:42:56",
            "upload_time_iso_8601": "2024-03-06T21:42:56.535787Z",
            "url": "https://files.pythonhosted.org/packages/3e/11/dfe0f5eb19a8ee3808eed6eb51a413f04bcf66287622dcabb4fb6f2f68e8/ratingcurve-1.0.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "c412c859a61edc7a4eabf52651c430c75b6cb719ce2f6a61c4f8101c382edebf",
                "md5": "130a23d8c86326124295920d560d790c",
                "sha256": "2f0a0097cee1c7ff5f1e09800182d55d6aba8100a338618f8a726db5a1ff65a5"
            },
            "downloads": -1,
            "filename": "ratingcurve-1.0.1.tar.gz",
            "has_sig": false,
            "md5_digest": "130a23d8c86326124295920d560d790c",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 90384,
            "upload_time": "2024-03-06T21:42:57",
            "upload_time_iso_8601": "2024-03-06T21:42:57.788213Z",
            "url": "https://files.pythonhosted.org/packages/c4/12/c859a61edc7a4eabf52651c430c75b6cb719ce2f6a61c4f8101c382edebf/ratingcurve-1.0.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-03-06 21:42:57",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "thodson-usgs",
    "github_project": "ratingcurve",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [
        {
            "name": "pymc",
            "specs": [
                [
                    ">=",
                    "5.0.0"
                ]
            ]
        },
        {
            "name": "pandas",
            "specs": []
        },
        {
            "name": "pytensor",
            "specs": []
        },
        {
            "name": "patsy",
            "specs": []
        }
    ],
    "lcname": "ratingcurve"
}
        
Elapsed time: 0.17784s