Skip to content
A suite of convenience functions for working with hydrology data in an interactive Python session.
Jupyter Notebook Python Makefile
Branch: master
Clone or download
mroberge Merge pull request #32 from nkorinek/documentation-update
Changed documentation to reflect what the function actually takes in
Latest commit abb39d6 Feb 7, 2019
Type Name Latest commit message Commit time
Failed to load latest commit information.
.ipynb_checkpoints Updated Jupyter Notebooks Feb 21, 2018
_static Merge pull request #23 from mroberge/package-cleanup May 11, 2018
docs Changed documentation to reflect what the function actually takes in … Feb 7, 2019
hydrofunctions update to version 0.1.7 Nov 12, 2018
tests Merge branch 'develop' into master May 31, 2018
.editorconfig initial commit Aug 12, 2016
.gitattributes 👾 Added .gitattributes Aug 12, 2016
.gitignore Added ability to retrieve more than one site at a time. Also added fu… Feb 13, 2018
.spyderproject split NWIS from station, add a list of instances. Sep 27, 2016
.travis.yml Update travis.yml test against 3.7-dev Nov 14, 2018
AUTHORS.rst Improved docs! Feb 16, 2018
CONTRIBUTING.rst some clean up May 31, 2018
Comparing_Urban_and_Rural_Streams.ipynb New notebook describing the flow duration chart. Mar 9, 2018
Draw_Map_Demo.ipynb draw_map notebook Mar 6, 2018
Graphing.ipynb New notebook & page in User's Guide Mar 10, 2018
HISTORY.rst update to Python 3.7 Nov 12, 2018
Introduction to Hydrofunctions.ipynb Updated notebooks, Added Writing_Valid_Requests... Feb 23, 2018
LICENSE Improved docs! Feb 16, 2018 fix MANIFEST Mar 8, 2018
Makefile initial commit Aug 12, 2016
NWIS trial run.ipynb Updated notebooks, Added Writing_Valid_Requests... Feb 23, 2018
README.rst Added Codecov to travis and badge Mar 12, 2018
Selecting_Sites.ipynb add new properties to NWIS Mar 6, 2018
Writing_Valid_Requests_for_NWIS.ipynb Updated notebooks, Added Writing_Valid_Requests... Feb 23, 2018
requirements.txt clean up .travis.yml and requirements.txt May 11, 2018
requirements_dev.txt update requirements_dev.txt May 11, 2018
setup.cfg update to version 0.1.7 Nov 12, 2018 update to version 0.1.7 Nov 12, 2018 initial commit Aug 12, 2016



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.


  • Retrieves stream data from the USGS NWIS service
  • Retrieve data using multiple site numbers, state, county codes, or 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
  • Plotting and manipulation through Pandas dataframes
  • Interactive map for finding stream gage ID numbers
  • Still in early development! More features to come!

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')

We've set up our system, now we submit our request for data and get a response:

>>> herring.get_data()
<hydrofunctions.station.NWIS at 0x127506d6ac8>

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

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

--a table with our data appears--

datetime 01585200 - Mean Discharge, cubic feet per second
2017-06-01 0.71
2017-06-02 0.64
2017-06-03 0.61
2017-06-04 0.58
2017-06-05 1.95

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

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

--a stream hydrograph appears--

a stream hydrograph for Herring Run

Draw an interactive map in a Jupyter Notebook:

a map in an interactive Jupyter Notebook.

Learn more:

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.

Visit the Installation Page in the Users Guide to learn how to install Anaconda, or if you have problems using the Easy Installation method above.

Other Projects You Should See

Hydropy, a Python package that builds upon Pandas for enhanced data selection and plotting of hydrology data.

WellApplication a Python package that provides functions for working with dataloggers and USGS well data.

This package was created with Cookiecutter and the audreyr/cookiecutter-pypackage project template.

MIT License

Copyright (c) 2016, Martin Roberge and contributors

You can’t perform that action at this time.