Skip to main content

A suite of convenience functions for exploring water data in a Jupyter Notebook.

Project description

Visit Hydrofunctions on PyPI Unit Testing Status Code Coverage Status Documentation Status 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 and enable automatic chart display:

>>> import hydrofunctions as hf
>>> %matplotlib inline

Create NWIS data object to hold our request and the data we will retrieve. We will request the daily values (‘dv’) for site ‘0158520’ for the past 55 days:

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

Find out what data we received:

>>> herring
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 show the common name of the parameter and its units.

Create a dataframe from our data, and list the first five items:

>>> herring.df().head()

–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

Plot the data using built-in methods from Pandas and mathplotlib:

>>> herring.df().plot()

–a stream hydrograph appears–

a stream hydrograph for Herring Run

Easy Installation

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

$ pip install hydrofunctions

Hydrofunctions depends upon Pandas and numerous other scientific packages for Python. Anaconda 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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

hydrofunctions-0.2.1.tar.gz (4.5 MB view details)

Uploaded Source

Built Distribution

hydrofunctions-0.2.1-py3-none-any.whl (214.8 kB view details)

Uploaded Python 3

File details

Details for the file hydrofunctions-0.2.1.tar.gz.

File metadata

  • Download URL: hydrofunctions-0.2.1.tar.gz
  • Upload date:
  • Size: 4.5 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.3.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.0 CPython/3.9.5

File hashes

Hashes for hydrofunctions-0.2.1.tar.gz
Algorithm Hash digest
SHA256 187a170a3154c37439a2dc9aa3df6dac1e111fbe221164ee94cd0afd4af7c032
MD5 e1aae56d67758efad6fa211f0920753e
BLAKE2b-256 4b5b0aec4efe1e514df2dcfeafde79c5027becda371f5b46ad3fbea57c327daa

See more details on using hashes here.

File details

Details for the file hydrofunctions-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: hydrofunctions-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 214.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.3.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.0 CPython/3.9.5

File hashes

Hashes for hydrofunctions-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 01cb88a959511d815f5babc559267bea3af067de5e10a187734f367d709e2812
MD5 cb7a7346d85592df05cddf87dbeecc04
BLAKE2b-256 a6a02b9c99914ab88dc60d9cc1d62f52d95ea471c4abfca3a6ff89accf0423cb

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page