hydrofunctions


Namehydrofunctions JSON
Version 0.2.4 PyPI version JSON
download
home_pagehttps://github.com/mroberge/hydrofunctions
SummaryA suite of convenience functions for exploring water data in a Jupyter Notebook
upload_time2023-06-14 22:09:51
maintainer
docs_urlNone
authorMartin Roberge
requires_python
licenseMIT license
keywords hydrofunctions hydrology usgs stream gauge water nwis
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            ===============================
HydroFunctions
===============================

.. image:: https://img.shields.io/pypi/v/hydrofunctions.svg
        :target: https://pypi.python.org/pypi/hydrofunctions
        :alt: Visit Hydrofunctions on PyPI

.. image:: https://github.com/mroberge/hydrofunctions/actions/workflows/test.yaml/badge.svg
        :target: https://github.com/mroberge/hydrofunctions/actions/workflows/test.yaml
        :alt: Unit Testing Status

.. image:: https://codecov.io/gh/mroberge/hydrofunctions/branch/master/graph/badge.svg
        :target: https://codecov.io/gh/mroberge/hydrofunctions
        :alt: Code Coverage Status

.. image:: https://readthedocs.org/projects/hydrofunctions/badge/?version=latest
        :target: https://hydrofunctions.readthedocs.io/en/latest/?badge=latest
        :alt: Documentation Status

.. image:: https://img.shields.io/github/license/mashape/apistatus.svg
        :target: https://github.com/mroberge/hydrofunctions/blob/master/LICENSE
        :alt: MIT license

A suite of convenience functions for exploring water data in Python.

Features
--------

* Retrieves stream data from the USGS NWIS service
* Select data using multiple site numbers, by state, county codes, or a boundary box
* Preserves NWIS metadata, including NoData values
* Helpful error messages to help you write valid requests
* Extracts data into a Pandas dataframe, json, or dict
* Plot beautiful graphs in Jupyter Notebooks
   * hydrographs (or time series of any data)
   * flow duration charts
   * cycle plots to illustrate annual or diurnal cycles
   * Interactive map for finding stream gauge ID numbers
* Plotting and manipulation through Pandas dataframes
* Retrieve USGS rating curves, peak discharges, field notes, and site files for gauging stations
* Retrieve USGS daily, monthly, and annual statistics for gauging stations
* Saves data in compact, easy-to-use parquet files instead of requesting the same dataset repeatedly
* **Massive** `Users Guide`_ **that makes Hydrology AND Data Science easy!**

Still in active development! Let me know what features you want!

Read the `Users Guide`_ for more details.


Basic Usage
-----------

First, import hydrofunctions into your project. If you plan to work with Jupyter
notebooks, then go ahead and enable automatic chart display:

.. code-block:: ipython

    In  [1]: import hydrofunctions as hf
             %matplotlib inline

Create an NWIS data object to hold our request and the data we will retrieve.
We will request the instantaneous values ('iv') for site '01585200' for the
past 55 days:

.. code-block:: ipython

    In  [2]: herring = hf.NWIS('01585200', 'iv', period='P55D')
    Requested data from https://waterservices.usgs.gov/nwis/iv/?format=json%2C1.1&sites=01585200&period=P55D

You can check that the request went smoothly:

.. code-block:: ipython

    In  [3]: herring.ok
    Out [3]: True

Find out what data we received:

.. code-block:: ipython

    In  [4]: herring
    Out [4]: USGS:01585200: WEST BRANCH HERRING RUN AT IDLEWYLDE, MD
                 00060: <5 * Minutes>  Discharge, cubic feet per second
                 00065: <5 * Minutes>  Gage height, feet
             Start: 2019-05-25 01:05:00+00:00
             End:   2019-07-19 19:05:00+00:00

This tells us the name of our site and gives a list of the parameters that we
have. For each parameter it lists how frequently the data were collected, and
it shows the common name of the parameter and its units.

Create a dataframe using only our discharge data, and list the first five items:

.. code-block:: ipython

    In  [5]: herring.df('discharge').head()
    Out [5]:

*--a table with our data appears--*

    +------------------------------+---------------------------+
    |          datetimeUTC         | USGS:01585200:00060:00000 |
    +------------------------------+---------------------------+
    |   2019-05-25 01:05:00+00:00  |                1.57       |
    +------------------------------+---------------------------+
    |   2019-05-25 01:10:00+00:00  |                1.57       |
    +------------------------------+---------------------------+
    |   2019-05-25 01:15:00+00:00  |                1.51       |
    +------------------------------+---------------------------+
    |   2019-05-25 01:20:00+00:00  |                1.57       |
    +------------------------------+---------------------------+
    |   2019-05-25 01:25:00+00:00  |                1.57       |
    +------------------------------+---------------------------+

If we're using Jupyter Lab, we can plot a graph of the data using built-in methods from Pandas and mathplotlib:

.. code-block:: ipython

    In  [6]: herring.df('q').plot()
    Out [6]:

*--a stream hydrograph appears--*

.. image:: https://raw.githubusercontent.com/mroberge/hydrofunctions/master/_static/HerringHydrograph.png
   :alt: a stream hydrograph for Herring Run

Learn more:  

* `Users Guide`_


Easy Installation
-----------------

The easiest way to install Hydrofunctions is by typing this from your
command line:

.. code-block:: console

    $ pip install hydrofunctions


Hydrofunctions depends upon Pandas and numerous other scientific packages
for Python. `Anaconda <https://www.anaconda.com/products/individual>`_
is an easy, safe, open-source method for downloading everything and avoiding
conflicts with other versions of Python that might be running on your
computer.

Visit the `Installation Page <https://hydrofunctions.readthedocs.io/en/master/installation.html>`_
in the Users Guide to learn how to install
Anaconda, or if you have problems using the Easy Installation method above.


.. _`Users Guide`:  https://hydrofunctions.readthedocs.io/en/latest

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/mroberge/hydrofunctions",
    "name": "hydrofunctions",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "hydrofunctions hydrology USGS stream gauge water NWIS",
    "author": "Martin Roberge",
    "author_email": "mroberge@towson.edu",
    "download_url": "https://files.pythonhosted.org/packages/e1/fa/56308ce64ea14bee1aa9d75d8a3d0f4aaaf940e07dd0e9d5b868476b9de4/hydrofunctions-0.2.4.tar.gz",
    "platform": null,
    "description": "===============================\nHydroFunctions\n===============================\n\n.. image:: https://img.shields.io/pypi/v/hydrofunctions.svg\n        :target: https://pypi.python.org/pypi/hydrofunctions\n        :alt: Visit Hydrofunctions on PyPI\n\n.. image:: https://github.com/mroberge/hydrofunctions/actions/workflows/test.yaml/badge.svg\n        :target: https://github.com/mroberge/hydrofunctions/actions/workflows/test.yaml\n        :alt: Unit Testing Status\n\n.. image:: https://codecov.io/gh/mroberge/hydrofunctions/branch/master/graph/badge.svg\n        :target: https://codecov.io/gh/mroberge/hydrofunctions\n        :alt: Code Coverage Status\n\n.. image:: https://readthedocs.org/projects/hydrofunctions/badge/?version=latest\n        :target: https://hydrofunctions.readthedocs.io/en/latest/?badge=latest\n        :alt: Documentation Status\n\n.. image:: https://img.shields.io/github/license/mashape/apistatus.svg\n        :target: https://github.com/mroberge/hydrofunctions/blob/master/LICENSE\n        :alt: MIT license\n\nA suite of convenience functions for exploring water data in Python.\n\nFeatures\n--------\n\n* Retrieves stream data from the USGS NWIS service\n* Select data using multiple site numbers, by state, county codes, or a boundary box\n* Preserves NWIS metadata, including NoData values\n* Helpful error messages to help you write valid requests\n* Extracts data into a Pandas dataframe, json, or dict\n* Plot beautiful graphs in Jupyter Notebooks\n   * hydrographs (or time series of any data)\n   * flow duration charts\n   * cycle plots to illustrate annual or diurnal cycles\n   * Interactive map for finding stream gauge ID numbers\n* Plotting and manipulation through Pandas dataframes\n* Retrieve USGS rating curves, peak discharges, field notes, and site files for gauging stations\n* Retrieve USGS daily, monthly, and annual statistics for gauging stations\n* Saves data in compact, easy-to-use parquet files instead of requesting the same dataset repeatedly\n* **Massive** `Users Guide`_ **that makes Hydrology AND Data Science easy!**\n\nStill in active development! Let me know what features you want!\n\nRead the `Users Guide`_ for more details.\n\n\nBasic Usage\n-----------\n\nFirst, import hydrofunctions into your project. If you plan to work with Jupyter\nnotebooks, then go ahead and enable automatic chart display:\n\n.. code-block:: ipython\n\n    In  [1]: import hydrofunctions as hf\n             %matplotlib inline\n\nCreate an NWIS data object to hold our request and the data we will retrieve.\nWe will request the instantaneous values ('iv') for site '01585200' for the\npast 55 days:\n\n.. code-block:: ipython\n\n    In  [2]: herring = hf.NWIS('01585200', 'iv', period='P55D')\n    Requested data from https://waterservices.usgs.gov/nwis/iv/?format=json%2C1.1&sites=01585200&period=P55D\n\nYou can check that the request went smoothly:\n\n.. code-block:: ipython\n\n    In  [3]: herring.ok\n    Out [3]: True\n\nFind out what data we received:\n\n.. code-block:: ipython\n\n    In  [4]: herring\n    Out [4]: USGS:01585200: WEST BRANCH HERRING RUN AT IDLEWYLDE, MD\n                 00060: <5 * Minutes>  Discharge, cubic feet per second\n                 00065: <5 * Minutes>  Gage height, feet\n             Start: 2019-05-25 01:05:00+00:00\n             End:   2019-07-19 19:05:00+00:00\n\nThis tells us the name of our site and gives a list of the parameters that we\nhave. For each parameter it lists how frequently the data were collected, and\nit shows the common name of the parameter and its units.\n\nCreate a dataframe using only our discharge data, and list the first five items:\n\n.. code-block:: ipython\n\n    In  [5]: herring.df('discharge').head()\n    Out [5]:\n\n*--a table with our data appears--*\n\n    +------------------------------+---------------------------+\n    |          datetimeUTC         | USGS:01585200:00060:00000 |\n    +------------------------------+---------------------------+\n    |   2019-05-25 01:05:00+00:00  |                1.57       |\n    +------------------------------+---------------------------+\n    |   2019-05-25 01:10:00+00:00  |                1.57       |\n    +------------------------------+---------------------------+\n    |   2019-05-25 01:15:00+00:00  |                1.51       |\n    +------------------------------+---------------------------+\n    |   2019-05-25 01:20:00+00:00  |                1.57       |\n    +------------------------------+---------------------------+\n    |   2019-05-25 01:25:00+00:00  |                1.57       |\n    +------------------------------+---------------------------+\n\nIf we're using Jupyter Lab, we can plot a graph of the data using built-in methods from Pandas and mathplotlib:\n\n.. code-block:: ipython\n\n    In  [6]: herring.df('q').plot()\n    Out [6]:\n\n*--a stream hydrograph appears--*\n\n.. image:: https://raw.githubusercontent.com/mroberge/hydrofunctions/master/_static/HerringHydrograph.png\n   :alt: a stream hydrograph for Herring Run\n\nLearn more:  \n\n* `Users Guide`_\n\n\nEasy Installation\n-----------------\n\nThe easiest way to install Hydrofunctions is by typing this from your\ncommand line:\n\n.. code-block:: console\n\n    $ pip install hydrofunctions\n\n\nHydrofunctions depends upon Pandas and numerous other scientific packages\nfor Python. `Anaconda <https://www.anaconda.com/products/individual>`_\nis an easy, safe, open-source method for downloading everything and avoiding\nconflicts with other versions of Python that might be running on your\ncomputer.\n\nVisit the `Installation Page <https://hydrofunctions.readthedocs.io/en/master/installation.html>`_\nin the Users Guide to learn how to install\nAnaconda, or if you have problems using the Easy Installation method above.\n\n\n.. _`Users Guide`:  https://hydrofunctions.readthedocs.io/en/latest\n",
    "bugtrack_url": null,
    "license": "MIT license",
    "summary": "A suite of convenience functions for exploring water data in a Jupyter Notebook",
    "version": "0.2.4",
    "project_urls": {
        "Documentation": "https://hydrofunctions.readthedocs.io",
        "Homepage": "https://github.com/mroberge/hydrofunctions",
        "Issue Tracker": "https://github.com/mroberge/hydrofunctions/issues",
        "Latest": "https://github.com/mroberge/hydrofunctions/tree/develop",
        "Source": "https://github.com/mroberge/hydrofunctions"
    },
    "split_keywords": [
        "hydrofunctions",
        "hydrology",
        "usgs",
        "stream",
        "gauge",
        "water",
        "nwis"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "ed79f855b9f26e57da1a0978d28c3412e64e8a09cee13e505bfc6022186fcf8a",
                "md5": "2c0b60f654d9b6a8c96400b37192da51",
                "sha256": "a8ff9c3d6aa737634472a3e01116b876aba031c5e2d62232af0d51f921698d12"
            },
            "downloads": -1,
            "filename": "hydrofunctions-0.2.4-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "2c0b60f654d9b6a8c96400b37192da51",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 40038,
            "upload_time": "2023-06-14T22:09:49",
            "upload_time_iso_8601": "2023-06-14T22:09:49.973523Z",
            "url": "https://files.pythonhosted.org/packages/ed/79/f855b9f26e57da1a0978d28c3412e64e8a09cee13e505bfc6022186fcf8a/hydrofunctions-0.2.4-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "e1fa56308ce64ea14bee1aa9d75d8a3d0f4aaaf940e07dd0e9d5b868476b9de4",
                "md5": "bf6af3b3519ef019ecd2993d2b1a1f7c",
                "sha256": "4cfd7ef59d62206d71c36309020a201e3a37d0604e9f41a991880310be4cc0d6"
            },
            "downloads": -1,
            "filename": "hydrofunctions-0.2.4.tar.gz",
            "has_sig": false,
            "md5_digest": "bf6af3b3519ef019ecd2993d2b1a1f7c",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 4607912,
            "upload_time": "2023-06-14T22:09:51",
            "upload_time_iso_8601": "2023-06-14T22:09:51.905481Z",
            "url": "https://files.pythonhosted.org/packages/e1/fa/56308ce64ea14bee1aa9d75d8a3d0f4aaaf940e07dd0e9d5b868476b9de4/hydrofunctions-0.2.4.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-06-14 22:09:51",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "mroberge",
    "github_project": "hydrofunctions",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "tox": true,
    "lcname": "hydrofunctions"
}
        
Elapsed time: 0.07991s