Skip to content

Commit a7d7f55

Browse files
thodson-usgsclaude
andauthored
docs+types: reference/build fixups and unify last_modified type (#326)
* docs+types: add NGWMN README section + samples reference page, fix conf root_doc, drop dead nblink media, unify last_modified type Four small, independent fixups surfaced in a library review: - docs: add a `reference/samples.rst` page and wire it into the API reference toctree. `dataretrieval.samples` is public (in `__all__`) but had no reference page. - docs(conf): `main_doc` is not a recognized Sphinx setting (the correct name is `root_doc`); it was silently ignored. Rename so the intent is real rather than relying on the `index` default. - docs(examples): drop the `extra-media: ../../../demos/datasets` entry from `peak_streamflow_trends.nblink`. That directory does not exist and the notebook reads no local files, so nbsphinx_link warned/failed copying missing media on every docs build. - types(waterdata): widen `get_daily`/`get_continuous` `last_modified` from `str | None` to `str | Iterable[str] | None`, matching the other eight OGC getters. `last_modified` is routed through `_format_api_dates`, which accepts a single interval string or a two-element [start, end] range list, so the narrow annotation rejected a valid input shape and was inconsistent with the parallel getters. - README: add an NGWMN usage example (state -> sites -> water levels) and an NGWMN entry under Available Data Services; reformat that section as a function index -- each service led by its function name (e.g. `get_dv`) with a brief description, and each subsection tagged with its module. - README: document `get_ratings` (usage example + index entry) and note its `dict`-of-rating-tables return shape; pass a Series to a getter directly in the NGWMN example (drop the redundant `.tolist()`). --------- Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 963eb28 commit a7d7f55

6 files changed

Lines changed: 75 additions & 37 deletions

File tree

README.md

Lines changed: 61 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,30 @@ import logging
118118
logging.basicConfig(level=logging.DEBUG)
119119
```
120120

121+
### National Ground-Water Monitoring Network (NGWMN)
122+
123+
Access groundwater data aggregated from many state, federal, and local
124+
agencies. NGWMN uses the same OGC engine as the Water Data API,
125+
so chunking and pagination behave the same way:
126+
127+
```python
128+
from dataretrieval import ngwmn
129+
130+
# Find the groundwater monitoring sites in a state
131+
# (state accepts a full name, a postal code like 'WI', or a FIPS code like '55')
132+
sites, metadata = ngwmn.get_sites(state='Wisconsin')
133+
134+
print(f"Found {len(sites)} NGWMN sites in Wisconsin")
135+
136+
# Pull water levels from the first twenty sites over a time window.
137+
water_levels, metadata = ngwmn.get_water_level(
138+
monitoring_location_id=sites['monitoring_location_id'][:20],
139+
datetime=['2022-01-01', '2024-01-01']
140+
)
141+
142+
print(f"Retrieved {len(water_levels)} water-level observations")
143+
```
144+
121145
### Water Quality Portal (WQP)
122146

123147
Access water quality data from multiple agencies:
@@ -170,35 +194,43 @@ print(f"Found {len(flowlines)} upstream tributaries within 50km")
170194

171195
## Available Data Services
172196

173-
### Modern USGS Water Data APIs (Recommended)
174-
- **Daily values**: Daily statistical summaries (mean, min, max)
175-
- **Instantaneous values**: High-frequency continuous data
176-
- **Field measurements**: Discrete measurements from field visits
177-
- **Monitoring locations**: Site information and metadata
178-
- **Time series metadata**: Information about available data parameters
179-
- **Latest daily values**: Most recent daily statistical summary data
180-
- **Latest instantaneous values**: Most recent high-frequency continuous data
181-
- **Daily, monthly, and annual statistics**: Median, maximum, minimum, arithmetic mean, and percentile statistics
182-
- **Samples data**: Discrete USGS water quality data
183-
184-
### Legacy NWIS Services (Deprecated)
185-
- **Daily values (dv)**: Legacy daily statistical data
186-
- **Instantaneous values (iv)**: Legacy continuous data
187-
- **Site info (site)**: Basic site information
188-
- **Statistics (stat)**: Statistical summaries
189-
- **Discharge peaks (peaks)**: Annual peak discharge events
190-
191-
### Water Quality Portal
192-
- **Results**: Water quality analytical results from USGS, EPA, and other agencies
193-
- **Sites**: Monitoring location information
194-
- **Organizations**: Data provider information
195-
- **Projects**: Sampling project details
196-
197-
### Network Linked Data Index (NLDI)
198-
- **Basin delineation**: Watershed boundaries for any point
199-
- **Flow navigation**: Upstream/downstream network traversal
200-
- **Feature discovery**: Find monitoring sites, dams, and other features
201-
- **Hydrologic connectivity**: Link data across the stream network
197+
### Modern USGS Water Data APIs (Recommended) — `dataretrieval.waterdata`
198+
- `get_daily`: Daily statistical summaries (mean, min, max)
199+
- `get_continuous`: High-frequency continuous (instantaneous) values
200+
- `get_field_measurements`: Discrete measurements from field visits
201+
- `get_monitoring_locations`: Site information and metadata
202+
- `get_time_series_metadata`: A location's available data parameters
203+
- `get_latest_daily`: Most recent daily statistical summary
204+
- `get_latest_continuous`: Most recent high-frequency value
205+
- `get_stats_por` / `get_stats_date_range`: Daily, monthly, and annual statistics
206+
- `get_samples`: Discrete USGS water-quality samples
207+
- `get_ratings`: Stage-discharge rating curves
208+
209+
### National Ground-Water Monitoring Network (NGWMN) — `dataretrieval.ngwmn`
210+
- `get_sites`: Groundwater monitoring-location metadata across many agencies
211+
- `get_water_level`: Depth-to-water and water-level observations
212+
- `get_lithology`: Geologic-material logs by depth interval
213+
- `get_well_construction`: Casing, screen, and build-out records
214+
- `get_providers`: Contributing data-provider organizations
215+
216+
### Legacy NWIS Services (Deprecated) — `dataretrieval.nwis`
217+
- `get_dv`: Legacy daily statistical data
218+
- `get_iv`: Legacy continuous (instantaneous) data
219+
- `get_info`: Basic site information
220+
- `get_stats`: Statistical summaries
221+
- `get_discharge_peaks`: Annual peak discharge events
222+
223+
### Water Quality Portal — `dataretrieval.wqp`
224+
- `get_results`: Water-quality analytical results from USGS, EPA, and other agencies
225+
- `what_sites`: Monitoring-location information
226+
- `what_organizations`: Data-provider information
227+
- `what_projects`: Sampling-project details
228+
229+
### Network Linked Data Index (NLDI) — `dataretrieval.nldi`
230+
- `get_basin`: Watershed boundary for a point or feature
231+
- `get_flowlines`: Upstream/downstream flowline navigation
232+
- `get_features`: Find monitoring sites, dams, and other features along the network
233+
- `get_features_by_data_source`: Features from a specific data source
202234

203235
## More Examples
204236

dataretrieval/waterdata/api.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ def get_daily(
6565
unit_of_measure: str | Iterable[str] | None = None,
6666
qualifier: str | Iterable[str] | None = None,
6767
value: str | Iterable[str] | None = None,
68-
last_modified: str | None = None,
68+
last_modified: str | Iterable[str] | None = None,
6969
skip_geometry: bool | None = None,
7070
time: str | Iterable[str] | None = None,
7171
bbox: list[float] | None = None,
@@ -288,7 +288,7 @@ def get_continuous(
288288
unit_of_measure: str | Iterable[str] | None = None,
289289
qualifier: str | Iterable[str] | None = None,
290290
value: str | Iterable[str] | None = None,
291-
last_modified: str | None = None,
291+
last_modified: str | Iterable[str] | None = None,
292292
time: str | Iterable[str] | None = None,
293293
limit: int | None = None,
294294
filter: str | None = None,

docs/source/conf.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@
3939
# suffix of source documents
4040
source_suffix = ".rst"
4141

42-
# The main toctree document.
43-
main_doc = "index"
42+
# The root toctree document.
43+
root_doc = "index"
4444

4545
# The version info for the project you're documenting, acts as replacement for
4646
# |version| and |release|, also used in various other places throughout the
Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
11
{
2-
"path": "../../../demos/peak_streamflow_trends.ipynb",
3-
"extra-media": [
4-
"../../../demos/datasets"
5-
]
2+
"path": "../../../demos/peak_streamflow_trends.ipynb"
63
}

docs/source/reference/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ API reference
1212
ngwmn
1313
nldi
1414
nwis
15+
samples
1516
streamstats
1617
utils
1718
waterdata

docs/source/reference/samples.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
.. _samples:
2+
3+
dataretrieval.samples
4+
---------------------
5+
6+
.. automodule:: dataretrieval.samples
7+
:members:
8+
:special-members:

0 commit comments

Comments
 (0)