Skip to content

Commit bbbb365

Browse files
thodson-usgsclaude
andcommitted
Adapt R doc for get_samples_summary, drop two doc claims that are wrong for this endpoint
Adapted the wording from R's summarize_waterdata_samples (in the develop branch of DOI-USGS/dataRetrieval) to match the Python module's docstring style. Picked up the variety-of-agencies example IDs from the R doc. Two claims from the R doc were corrected rather than copied: - The R doc says "Location identifiers should be separated with commas" with a multi-ID example. That contradicts the function's own one-site check and is wrong for the summary service (which accepts exactly one ID). Dropped. - The R doc says "Location numbers without an agency prefix are assumed to have the prefix USGS." That's not true for this endpoint at the API level — bare IDs return an empty result with a different column shape. Documented the actual behavior instead. Also switched the example to USGS-04074950 (the site used by the R doc's example) so the two repos line up. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 491db88 commit bbbb365

1 file changed

Lines changed: 17 additions & 15 deletions

File tree

dataretrieval/waterdata/api.py

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1805,26 +1805,28 @@ def get_samples_summary(
18051805
monitoringLocationIdentifier: str,
18061806
ssl_check: bool = True,
18071807
) -> tuple[pd.DataFrame, BaseMetadata]:
1808-
"""Get a summary of samples available at a single monitoring location.
1808+
"""Get a summary of discrete water-quality samples at a single monitoring location.
18091809
1810-
Wraps the Samples database ``/summary/{monitoringLocationIdentifier}``
1811-
endpoint, which returns one row per (characteristic group, characteristic,
1812-
user-supplied characteristic) combination with result and activity counts
1813-
and the first / most recent activity dates. This is useful for taking an
1814-
inventory of what discrete-sample data exists at a site before pulling
1815-
the underlying observations with :func:`get_samples`.
1810+
Wraps the Samples database summary service described at
1811+
https://api.waterdata.usgs.gov/samples-data/docs. The service returns one
1812+
row per (characteristic group, characteristic, user-supplied characteristic)
1813+
combination with result and activity counts and the first / most recent
1814+
activity dates — useful for taking inventory of what discrete-sample data
1815+
exists at a site before pulling the underlying observations with
1816+
:func:`get_samples`.
18161817
1817-
The Samples summary endpoint only accepts a single monitoring location
1818-
per request.
1819-
1820-
See https://api.waterdata.usgs.gov/samples-data/docs#/summaries for the
1821-
full API reference.
1818+
The summary service is single-site only: it accepts exactly one monitoring
1819+
location per request.
18221820
18231821
Parameters
18241822
----------
18251823
monitoringLocationIdentifier : string
1826-
A monitoring location identifier in ``AGENCY-ID`` format, e.g.
1827-
``"USGS-04183500"``.
1824+
A monitoring location identifier has two parts, separated by a dash
1825+
(``-``): the agency code and the location number. Examples:
1826+
``"USGS-040851385"``, ``"AZ014-320821110580701"``,
1827+
``"CAX01-15304600"``. Bare location numbers without an agency prefix
1828+
are accepted by the service but return an empty result, so a prefix
1829+
is effectively required.
18281830
ssl_check : bool, optional
18291831
Check the SSL certificate. Default is True.
18301832
@@ -1841,7 +1843,7 @@ def get_samples_summary(
18411843
18421844
>>> # What discrete-sample data is available at this site?
18431845
>>> df, md = dataretrieval.waterdata.get_samples_summary(
1844-
... monitoringLocationIdentifier="USGS-04183500"
1846+
... monitoringLocationIdentifier="USGS-04074950"
18451847
... )
18461848
18471849
"""

0 commit comments

Comments
 (0)