Repository navigation
fix(waterdata): scope the ratings catalog search to its collection - #474
Merged
thodson-usgs merged 1 commit intoNov 24, 2026
Merged
Conversation
get_ratings() sent /search with no collections= parameter, and /search spans every collection in the Water Data STAC catalog. Since USGS added the daily and continuous collections in October 2026, a call with a list of file types (which sends no server-side file_type filter) also returned each monitoring location's daily and continuous items when download_and_parse=False: USGS-01104475 with file_type=["exsa", "corr"] returned 5 items instead of 3. Send collections=ratings with every search.
thodson-usgs
marked this pull request as ready for review
November 24, 2026 19:10
thodson-usgs
added a commit
to thodson-usgs/dataretrieval-python
that referenced
this pull request
Dec 1, 2026
- catalog: build each search through ogc.planning._try_build, so a filter over the 64 KB httpx can put in one URL component raises the ValueError with its remedy instead of httpx.InvalidURL. - One _as_list, in catalog, for ratings, catalog.search and _retrieval. - catalog.__all__ lists the names the bulk modules import. - One masked renderer for api_key and files_api_key in show_configuration. - ogc.errors._error_body reads the request URL and its key variables once. - _change_clauses builds the set of changing locations once and floors the cutoffs as one DatetimeIndex. - Without geopandas, the file rows' geometry is looked up once per location (pd.factorize), as with geopandas, instead of Series.map per row. - qualifier: only the non-null lists are converted to Python objects (1.4M rows, 3% non-null: 27 ms to 12 ms). - Wording: "the bulk getters" instead of "the files route". - Tests: the ratings scoping test duplicated DOI-USGS#474's and is removed; the world-readable warning test covers both keys; the no-pyarrow fixture leaves conftest for a monkeypatch in its one test; _response uses inert_response. Co-Authored-By: Claude Opus 5.5 <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.
Problem
waterdata.get_ratings()sends STAC/searchwithoutcollections=./searchspans every collection in the catalog. In October 2026 USGS addeddailyandcontinuous(announcement), so those items now match too.Ratings items and the new items share
monitoring_location_id. Whenfile_typeis a list, no server-sidefile_typefilter is sent, and withdownload_and_parse=Falsethe raw items are returned unfiltered:A single
file_typewas not affected. Neither was the defaultdownload_and_parse=True, which filters items byfile_typelocally, although it still fetched the extra items.Fix
Send
collections=ratingswith every search. The diff is one parameter, a regression test that checks the sent query, and a NEWS entry.Checks
ratingsitems, and the download path returns theexsaandcorrframes.This also lands in #475 as part of moving the search into a shared module. This PR is the minimal version so the fix can merge first.