Skip to content

Enrich waterdata getter docstrings with examples adapted from R#265

Open
thodson-usgs wants to merge 1 commit intoDOI-USGS:mainfrom
thodson-usgs:enrich-waterdata-examples
Open

Enrich waterdata getter docstrings with examples adapted from R#265
thodson-usgs wants to merge 1 commit intoDOI-USGS:mainfrom
thodson-usgs:enrich-waterdata-examples

Conversation

@thodson-usgs
Copy link
Copy Markdown
Collaborator

Summary

Cross-referenced each Python waterdata getter's Examples section against the corresponding R analogue in DOI-USGS/dataRetrieval and ported the distinctive examples that the Python docs were missing. Same rationale as the audit done for get_combined_metadata in #264 — many R example sets cover useful idioms (ISO 8601 durations, half-bounded time intervals, last_modified for incremental polling, multi-value POST queries) that aren't yet shown in the Python docs.

Docs only — no signature, behavior, or test changes.

Functions touched and what was added

Function Added
get_daily ISO 8601 duration (time="P7D") example; last_modified="P7D" example for incremental ETL polling. Also fixed a pre-existing bug where the multi-site / approval_status example block was missing its closing parenthesis and trailing comma.
get_latest_continuous time="P7D" example (drops sites with no recent observation); multi-site / multi-parameter + last_modified="P7D" example.
get_latest_daily last_modified="P7D" example; multi-site + multi-parameter (discharge + water-temperature) example.
get_field_measurements Half-bounded time example ("1980-01-01/.." for everything since 1980; documents the inverse "../<date>" form).

What was deliberately skipped

  • Functions whose example coverage already matched or exceeded R's: get_continuous (5 examples), get_monitoring_locations (2 well-chosen ones already, R's bbox+chaining cases would duplicate get_combined_metadata's new chaining example in Add waterdata.get_combined_metadata for combined location + time-series inventory #264), get_time_series_metadata, get_stats_por, get_stats_date_range, get_samples, get_codes, get_reference_table, get_channel, get_samples_summary.
  • R-only kwargs that have no Python equivalent (no_paging, attach_request, chunk_size, convertType flag toggling). Filter chunking happens automatically in Python.
  • get_daily's R dv_post example using approval_status=c("Approved", "Provisional") — Python already has an approval_status="Approved" example.

Test plan

  • ruff check clean.
  • Each function's __doc__ renders correctly (verified via help()).
  • Live API spot-check: attempted but blocked by a 429 rate limit. The new examples only exercise date-format and multi-value idioms (P7D duration, 1980-01-01/.. half-bounded interval, last_modified field) that are already covered by existing tests and other functions' working examples.

Related

Cross-referenced each Python waterdata getter's Examples section
against the corresponding R analogue in DOI-USGS/dataRetrieval and
ported the distinctive examples that the Python docs were missing:

- get_daily: add ISO 8601 duration ("P7D") and last_modified ("P7D")
  examples. Also fix a pre-existing bug where the multi-site /
  approval_status example block was missing its closing parenthesis
  and trailing comma.
- get_latest_continuous: add time="P7D" and multi-site +
  last_modified="P7D" examples.
- get_latest_daily: add last_modified="P7D" and multi-site +
  multi-parameter examples.
- get_field_measurements: add a half-bounded-time example
  ("1980-01-01/..") and document the inverse "../<date>" form.

Docs only — no signature, behavior, or test changes. Ruff clean.
Live spot-verification was attempted but blocked by a 429 rate
limit; the new examples only use date-format and multi-value idioms
that are already covered by existing tests.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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