Skip to main content

A convenient interface for USGS WaterData APIs.

Project description

OWPHydroTools :: WaterData Client

This subpackage implements an interface to the USGS WaterData APIs. The primary use for this tool is to populate pandas.Dataframe objects with USGS streamflow data. See the WaterData Client Documentation for a complete list and description of the currently available methods. To report bugs or request new features, submit an issue through the OWPHydroTools Issue Tracker on GitHub.

Installation

In accordance with the python community, we support and advise the usage of virtual environments in any workflow using python. In the following installation guide, we use python's built-in venv module to create a virtual environment in which the tool will be installed. Note this is just personal preference, any python virtual environment manager should work just fine (conda, pipenv, etc. ).

# Create and activate python environment, requires python >= 3.11
$ python3 -m venv venv
$ source venv/bin/activate
$ python3 -m pip install --upgrade pip

# Install waterdata_client
$ python3 -m pip install hydrotools.waterdata_client

Usage

The following example demonstrates how one might use hydrotools.waterdata_client to retrieve USGS streamflow observations.

Code

# Import client and geopandas for easy parsing
import geopandas as gpd
from hydrotools.waterdata_client import LatestContinuousClient

# Instantiate client
client = LatestContinuousClient()

# Retrieve data
data = client.get(
    monitoring_location_id="USGS-02146470"
    )

# Look at values
observations = gpd.GeoDataFrame.from_features(data[0])
print(observations)
print(observations.columns)

Output

                     geometry                                    id                    time_series_id  ... approval_status qualifier                     last_modified
0  POINT (-80.85306 35.16444)  1b39aa0f-6adb-40ea-ab4e-453f88b8b16c  6ec29c85c72246ea83912c6f02f6fd63  ...     Provisional      None  2026-04-24T16:06:22.291045+00:00
1  POINT (-80.85306 35.16444)  b3ce8113-2a1a-4d13-9d88-8a0237c11df6  27d30d4d1a4749bb887d1435da9fd278  ...     Provisional      None  2026-04-24T16:06:35.455215+00:00
2  POINT (-80.85306 35.16444)  e56f5a19-8a93-489d-a2a0-98cae31f9529  b1f149deee984fcea8768c17076b1d7f  ...     Provisional      None  2026-04-24T16:06:17.732760+00:00

[3 rows x 12 columns]
Index(['geometry', 'id', 'time_series_id', 'monitoring_location_id',
       'parameter_code', 'statistic_id', 'time', 'value', 'unit_of_measure',
       'approval_status', 'qualifier', 'last_modified'],
      dtype='str')

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

hydrotools_waterdata_client-0.8.0a0.tar.gz (56.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

hydrotools_waterdata_client-0.8.0a0-py3-none-any.whl (50.3 kB view details)

Uploaded Python 3

File details

Details for the file hydrotools_waterdata_client-0.8.0a0.tar.gz.

File metadata

File hashes

Hashes for hydrotools_waterdata_client-0.8.0a0.tar.gz
Algorithm Hash digest
SHA256 2d8a3e43aec3aa98d8bc875b2866b10e2d4578fc8ea411c868a64fec454329a8
MD5 f2231b2e5d47f258eca96afaa7e38d9a
BLAKE2b-256 dc1b6277bb5125d539829e36618c8a84637f0ea566554e7ae147dd77fd3d33af

See more details on using hashes here.

File details

Details for the file hydrotools_waterdata_client-0.8.0a0-py3-none-any.whl.

File metadata

File hashes

Hashes for hydrotools_waterdata_client-0.8.0a0-py3-none-any.whl
Algorithm Hash digest
SHA256 accc75a6234336dbf652462696e937ba193bc81a7bb19988fd3bc09ab928b3ec
MD5 7f299b891838872acbb3605184d7e907
BLAKE2b-256 aea489ef7c289bf93276267281e66f05fa621037403edd7f89e680dd947f211c

See more details on using hashes here.

Supported by

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