Skip to content

Expose the Water Data STAC protocol surface - #386

Draft
thodson-usgs wants to merge 1 commit into
DOI-USGS:mainfrom
thodson-usgs:feat/waterdata-stac-api
Draft

Expose the Water Data STAC protocol surface#386
thodson-usgs wants to merge 1 commit into
DOI-USGS:mainfrom
thodson-usgs:feat/waterdata-stac-api

Conversation

@thodson-usgs

@thodson-usgs thodson-usgs commented Aug 17, 2026

Copy link
Copy Markdown
Collaborator

Summary

Expose the public USGS Water Data STAC protocol surface through the waterdata.stac namespace while keeping the existing analysis-ready ratings workflow on the main waterdata facade.

Current upstream inventory

As verified against the live USGS catalog on 2026-08-21, /stac/v0/collections?limit=100 reports numberMatched: 1 and numberReturned: 1. The sole collection is ratings, containing stage-discharge rating files in three RDB variants: base, corr, and exsa.

This PR therefore does not claim that daily values, continuous values, peaks, field measurements, or other Water Data products are available through STAC. Those products currently belong to the separate /ogcapi/v0 API family. The official STAC documentation says the catalog will provide a wider array of native-format data, but it publishes no additional collection or timetable today.

The generic interface is useful now for raw ratings catalog/item metadata and is deliberately data-driven so newly published collections can be discovered without another public-interface redesign. waterdata.get_ratings() remains the only analysis-ready STAC workflow and continues to download and parse rating assets.

Public interface

Raw STAC documents are grouped under waterdata.stac:

  • get_catalog() and get_conformance()
  • get_collections() and get_collection()
  • get_items() and get_item()
  • get_queryables()
  • search() using the advertised GET or POST representation

Each helper returns (document, BaseMetadata). Catalog, Collection, GeoJSON Item/ItemCollection, and JSON Schema documents remain unchanged so callers retain standard links, extensions, collection-specific properties, and asset metadata.

The implementation forwards every parameter advertised for these public routes. The upstream pagination field token is exposed as page_token and translated back on the wire, avoiding ambiguity with the package's credential-parameter guard. Internal /_mgmt/ping and /_mgmt/health routes are excluded because they are service operations, not STAC capabilities.

No compatibility aliases are added for the earlier draft names (get_stac_* and search_stac) because that surface has never been released.

Service integration

STAC calls share the Water Data adapter's existing:

  • configured base-URL redirection;
  • host-scoped API-key handling;
  • typed HTTP errors and response metadata; and
  • bounded retry policy.

ADR 0012 records why raw protocol-shaped operations use a waterdata.stac namespace while the parsed waterdata.get_ratings() getter remains flat.

Documentation

  • README discovery example
  • Water Data reference page
  • architecture overview and ADR 0012
  • NEWS entry describing the raw-document return contract
  • executable STAC notebook covering catalog discovery, the current ratings collection, queryables, GET/POST search, pagination, item inspection, asset metadata, and when to use get_ratings()

Validation

  • Full offline suite: 1005 passed, 12 deselected; coverage report: 98%
  • Focused STAC/public-interface/architecture suite: 108 passed
  • Commit hooks: ruff check, ruff format, strict mypy, lint-imports (8 contracts), xenon, complexipy, notebook stripping, and repository hygiene checks
  • git diff --check
  • Sphinx HTML build under Python 3.12, including the STAC notebook and ADR 0012: succeeded with five known pre-existing warnings
  • Squash verification: one commit, with tree f200027e identical to the former five-commit tip

Primary upstream sources

Add raw access to the public USGS Water Data STAC operations through the
`waterdata.stac` namespace: catalog and conformance discovery, collection
and item resources, queryables, and GET/POST item search. Preserve upstream
Catalog, Collection, GeoJSON, and JSON Schema documents alongside
`BaseMetadata`, and forward every parameter advertised for those routes.

The live catalog currently publishes one collection, `ratings`, containing
base, correction, and expanded stage-discharge RDB assets. Keep
`waterdata.get_ratings()` as the flat analysis-ready workflow that downloads
and parses those files; the namespaced helpers serve raw discovery and can
see future collections without another public-interface redesign.

Use Water Data's configured base URL, host-scoped API key, typed HTTP
failures, and bounded retries. Expose the upstream pagination `token` as
`page_token` to avoid the package's credential guard, and omit internal
management health routes because they are not STAC capabilities.

Document the raw `(dict, BaseMetadata)` contract, namespace rationale, and
ratings-only current inventory in the reference, architecture guide, README,
NEWS, and an executable example notebook.
@thodson-usgs
thodson-usgs force-pushed the feat/waterdata-stac-api branch from f1d289b to 417f9e4 Compare August 21, 2026 20:39
@thodson-usgs thodson-usgs changed the title Expose full Water Data STAC API Expose the Water Data STAC protocol surface Aug 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant