Reject missing nearest-observation targets - #431
Merged
Merged
Conversation
Follow-up review changes on top of the missing-target fix (DOI-USGS#430): - targets: report how many entries are missing and where the first is, listing every missing form (NaT, None, NaN, ''); ask for a timestamp rather than suggesting removal when nothing valid remains; reject numbers (read by pandas as epoch nanoseconds) with TypeError naming the units to convert from; rewrap pandas parse errors to name targets instead of suggesting a format= the getter does not accept. - window: reject missing, negative, and unparseable windows with ValueError, and bare numbers with TypeError. A negative window used to invert every bound and return an empty frame; a missing one crashed with AttributeError. Zero remains an exact-match query. - Messages follow the repo convention: parameter names bare, caller values as (got ...), and a remedy that works when pasted back. - Docstring: describe window as how far either side of each target to search; document every raise. - Tests grouped into targets and window validation sections; each suggested remedy is applied literally and must succeed. - NEWS entry.
thodson-usgs
approved these changes
Oct 1, 2026
thodson-usgs
left a comment
Collaborator
There was a problem hiding this comment.
Reviewed and extended with input validation for targets and window; CI green.
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.
Missing target timestamps passed to
get_nearest_continuousbecome invalidtime >= 'nan'/time <= 'nan'CQL bounds, including when only one entry in a list is missing. Reject these targets with an actionableValueErrorbefore callingget_continuous.The change adds a missing-value check after timestamp normalization and documents the input requirement. Seven regression cases exercise scalar and supported container inputs and verify that the underlying getter is never called for missing targets.
Validation on Windows with Python 3.12.14 and pandas 3.0.1:
nearest.py. Per the contributor guide, the Windows result is recorded with--fail-under=0; the Linux CI job still evaluates its 98.90% ratchet.These API-boundary tests make no live USGS request.
Closes #430.