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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file hydrotools_waterdata_client-0.8.0a0.tar.gz.
File metadata
- Download URL: hydrotools_waterdata_client-0.8.0a0.tar.gz
- Upload date:
- Size: 56.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2d8a3e43aec3aa98d8bc875b2866b10e2d4578fc8ea411c868a64fec454329a8
|
|
| MD5 |
f2231b2e5d47f258eca96afaa7e38d9a
|
|
| BLAKE2b-256 |
dc1b6277bb5125d539829e36618c8a84637f0ea566554e7ae147dd77fd3d33af
|
File details
Details for the file hydrotools_waterdata_client-0.8.0a0-py3-none-any.whl.
File metadata
- Download URL: hydrotools_waterdata_client-0.8.0a0-py3-none-any.whl
- Upload date:
- Size: 50.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
accc75a6234336dbf652462696e937ba193bc81a7bb19988fd3bc09ab928b3ec
|
|
| MD5 |
7f299b891838872acbb3605184d7e907
|
|
| BLAKE2b-256 |
aea489ef7c289bf93276267281e66f05fa621037403edd7f89e680dd947f211c
|