Skip to content

Commit 403bdd8

Browse files
thodson-usgsclaude
andcommitted
Adapt R doc examples for get_combined_metadata, fix data_type values
Ported three additional examples from R's read_waterdata_combined_meta that aren't redundant with the ones we already had: - Groundwater well — surfaces water-level and aquifer columns that the surface-water example shows as nulls. - State + county — common area-of-interest workflow. - Two-step "inventory then fetch" chain — get_combined_metadata to find what's available in a HUC, then get_continuous to pull the actual observations at every site found. Also corrected the data_type description: the live API returns "Continuous values" and "Daily values" (with the word "values"), not "Continuous" / "Daily" as the docstring previously claimed. Verified against api.waterdata.usgs.gov. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent f12deff commit 403bdd8

1 file changed

Lines changed: 28 additions & 2 deletions

File tree

dataretrieval/waterdata/api.py

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1042,7 +1042,8 @@ def get_combined_metadata(
10421042
https://help.waterdata.usgs.gov/code/stat_cd_nm_query?stat_nm_cd=%25&fmt=html.
10431043
data_type : string or list of strings, optional
10441044
The type of data the time series represents, e.g.
1045-
``"Continuous"``, ``"Daily"``, ``"Field measurements"``.
1045+
``"Continuous values"``, ``"Daily values"``,
1046+
``"Field measurements"``.
10461047
computation_identifier : string or list of strings, optional
10471048
Indicates whether the data from this time series represent a
10481049
specific statistical computation.
@@ -1106,11 +1107,22 @@ def get_combined_metadata(
11061107
--------
11071108
.. code::
11081109
1109-
>>> # All time series and field measurements at a single site
1110+
>>> # All time series and field measurements at a single surface-water site
11101111
>>> df, md = dataretrieval.waterdata.get_combined_metadata(
11111112
... monitoring_location_id="USGS-05407000"
11121113
... )
11131114
1115+
>>> # Same, for a groundwater well — water-level and aquifer columns
1116+
>>> # are populated where the surface-water example has nulls
1117+
>>> df, md = dataretrieval.waterdata.get_combined_metadata(
1118+
... monitoring_location_id="USGS-375907091432201"
1119+
... )
1120+
1121+
>>> # Every series in a single county, useful for area-of-interest workflows
1122+
>>> df, md = dataretrieval.waterdata.get_combined_metadata(
1123+
... state_name="Wisconsin", county_name="Dane County"
1124+
... )
1125+
11141126
>>> # Inventory across multiple HUCs, restricted to streams and springs
11151127
>>> df, md = dataretrieval.waterdata.get_combined_metadata(
11161128
... hydrologic_unit_code=["11010008", "11010009"],
@@ -1129,6 +1141,20 @@ def get_combined_metadata(
11291141
... parameter_code="00060",
11301142
... )
11311143
1144+
>>> # Two-step "what's available?" → "fetch it" workflow:
1145+
>>> # 1. inventory the sites in two HUCs
1146+
>>> hucs, _ = dataretrieval.waterdata.get_combined_metadata(
1147+
... hydrologic_unit_code=["11010008", "11010009"],
1148+
... site_type="Stream",
1149+
... )
1150+
>>> # 2. pull continuous discharge at every distinct site found
1151+
>>> sites = hucs["monitoring_location_id"].unique().tolist()
1152+
>>> df, md = dataretrieval.waterdata.get_continuous(
1153+
... monitoring_location_id=sites,
1154+
... parameter_code="00060",
1155+
... time="P1D",
1156+
... )
1157+
11321158
"""
11331159
service = "combined-metadata"
11341160
output_id = "combined_meta_id"

0 commit comments

Comments
 (0)