docs: Python ports of the new USGS Water Data API vignettes#291
Merged
Conversation
3045148 to
dfe96dd
Compare
Port five new R dataRetrieval Water Data API vignettes to the Python `waterdata` module as executable demo notebooks, wired into the Sphinx docs under a new "USGS Water Data API vignettes" section: - USGS_WaterData_Introduction_Examples (read_waterdata_functions.Rmd) - USGS_WaterData_DiscreteSamples_Examples (samples_data.Rmd) - USGS_WaterData_DailyStatistics_Examples (daily_data_statistics.Rmd) - USGS_WaterData_ContinuousData_Examples (continuous_pr.Rmd) - USGS_WaterData_ReferenceLists_Examples (Reference_Lists.Rmd) Each notebook was executed end-to-end against the live USGS Water Data API during development; outputs are cleared per the repo convention (the Sphinx docs build re-executes notebooks at build time). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
dfe96dd to
1783f2c
Compare
- Rename `daily_modern`/`field_modern` → `daily_data`/`field_data` (the "_modern" suffix was a leftover NWIS-vs-modern comparison artifact) - Rename `what_huc_sites` → `huc_sites`, `sites_information` → `sites_info`, `site_1`/`site_2` → `renamed`/`raw_id`, and `site1` → `site` in the daily statistics notebook (no `site2` ever existed) - Fix broken intra-notebook anchor `#General-retrieval-and-CQL2` → `#general-retrieval-and-cql2` - Simplify the daily-values facet plot by dropping the unnecessary `squeeze=False` + axes-indexing workaround - Clean up the `map_sites` helper in the samples notebook to use the conventional `fig, ax = plt.subplots(...)` unpacking and a docstring Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Ports the five new USGS Water Data API vignettes from the R
dataRetrievalpackage to thePython
dataretrieval.waterdatamodule as executable demo notebooks, and wiresthem into the Sphinx docs under a new "USGS Water Data API vignettes" section.
demos/)USGS_WaterData_Introduction_Examplesread_waterdata_functions.Rmdget_*family + CQL filtersUSGS_WaterData_DiscreteSamples_Examplessamples_data.Rmdget_samples,get_samples_summary,get_codesUSGS_WaterData_DailyStatistics_Examplesdaily_data_statistics.Rmdget_stats_por,get_stats_date_range,get_dailyUSGS_WaterData_ContinuousData_Examplescontinuous_pr.Rmdget_continuous,get_combined_metadataUSGS_WaterData_ReferenceLists_ExamplesReference_Lists.Rmdget_reference_tableNotes
during development (0 errors). Outputs are cleared per the repo convention
— the
sphinx-docsworkflow re-executes notebooks at build time(
nbsphinx_execute= auto).USGS_WaterData_<Topic>_Examplesconvention; code cells are formatted with
black-jupyter(23.3.0, matching.pre-commit-config.yaml).make html) succeeds and renders all five pages withtheir plots; no new build warnings.
R → Python adaptations worth a look
filter=/filter_lang="cql-text"; the library deliberatelyrejects unquoted numeric comparisons (the API types everything as strings), so
the drainage-area example uses a pandas-side numeric reduction instead.
read_waterdata_metadata→get_reference_table;read_waterdata_parameter_codes→
get_reference_table(collection="parameter-codes");check_OGC_requestshas noPython equivalent, so the
properties=argument is demonstrated directly.get_stats_*usecomputation_type=(vs Rcomputation=) and have nonormal_type/interval_typeargs yet, so those filters are applied in pandas;their string
valuecolumn is coerced to numeric for plotting/aggregation.🤖 Generated with Claude Code