Repository navigation
v1.4.0 keeps the package current with the USGS Water Data APIs and corrects several places where the data you received was not faithful to the data the services sent.
The Water Data getters now request v1 of the Water Data APIs. If you need time before moving, WaterdataConfiguration(api_version="v0") pins the previous version, which stays online until June 2027.
Five fixes restore values the package was changing or dropping without telling you:
- Code and identifier columns keep their leading zeros in every delimited response, so parameter code
00060stays00060. - Numeric columns are always
float64. They used to switch toint64whenever a response happened to hold only whole numbers, so the same column changed type between calls. - A value that cannot be parsed still becomes
NaNorNaT, but now also warns, naming the column and how many values were affected. A parse failure is no longer indistinguishable from missing data. - Historical peaks whose dates are only partly known are kept rather than discarded.
- The
qualifierfilter is sent as the JSON array the service expects. It previously returned HTTP 400 for every value.
Error messages also come from one place now. dataretrieval._validation holds the wording for each check that recurs across services, so a rejected call names the parameter you passed and the action that fixes it. In the same vein, get_nearest_continuous refuses missing or unusable targets and window values before sending anything, instead of building a filter the service cannot answer.
Smaller additions: the state filter accepts the five US territories, waterdata.get_cql takes a max_rows cap, and waterdata.get_continuous documents method_category, a column USGS added in September 2026.
What may change for you
These corrections change column types and error classes, so a few calls behave differently:
- Code columns now hold strings, including
USGSpcode,huc_cd,state_cd, and the HUC and FIPS fields. Comparing one against a number matches nothing instead of raising, so compare against the padded string (== "00060") or convert with.astype(int). - Peaks queries return more rows, and
datetimemay beNaT. Filter onpeak_dtif you select on dates. - The deprecated
nwisquery entry points raiseValueErrorrather thanTypeErrorfor a missing major filter, an incomplete bounding box, or an unknown service. The text of the shared rejection messages has also changed. waterdata.get_time_series_metadata()no longer returnsbegin_utc,end_utc,state_name, orhydrologic_unit_code. Passing any of them warns and sends the call to v0. Usebegin,end, andget_combined_metadata()instead.
Behavior changes
- Request v1 of the Water Data APIs, pinnable through
api_version;get_time_series_metadatadrops the v0-only fields andget_field_measurementsreturnstimeas a date by @thodson-usgs in #422 - Keep numeric columns
float64across calls, and warn, naming the column and count, when a value cannot be parsed by @thodson-usgs in #429 - Keep leading zeros in every code column, not only Samples; these columns now hold strings by @thodson-usgs in #420
- Keep censored peaks instead of dropping or dating them; peaks queries return more rows,
datetimemay beNaT, andpeak_dtis retained by @thodson-usgs in #395 - Centralize argument checks on one vocabulary; the deprecated
nwisquery entry points now raiseValueErrorrather thanTypeError, and shared rejection text changes by @thodson-usgs in #387 - Reject missing and unusable
get_nearest_continuousinputs before any request, rather than sendingnanbounds or inverting the window by @qorud02 in #431
New features
WaterdataConfiguration(api_version=...)to pin the Water Data API version while moving from v0 to v1 by @thodson-usgs in #422- Document
method_categoryonwaterdata.get_continuous, the RLMS method category code USGS added in September 2026 by @thodson-usgs in #423 - Accept the five US territories in the
statefilter acrosswaterdata,ngwmn, andnwdc; addwaterdata.get_cql(..., max_rows=N)by @thodson-usgs in #387
Bug fixes
- Send the
qualifierfilter as a JSON array, so it stops returning HTTP 400 for every value by @thodson-usgs in #427 - Name the Virgin Islands as the services do, so
state="VI"returns rows instead of none by @thodson-usgs in #432 - Handle an empty peaks response instead of raising
KeyError('peak_dt')by @arpitjain099 in #344 - Preserve Samples CSV identifiers through shared parsing by @tevinch in #419
- Preserve the
get_nearest_continuousresult shape across a resume by @thodson-usgs in #384 - Fix WQX3 array parameter serialization and iterable WQP filters by @thodson-usgs in #390
- Fix iterable filters for combined metadata by @thodson-usgs in #393
- Write ratings as UTF-8 off the event loop, so a non-UTF-8 locale no longer silently drops a rating and a multi-location pull no longer stalls by @thodson-usgs in #398
Deprecations and removals
- Remove
dataretrieval.ogc.retryand deprecatedataretrieval.ogc.interruptions; import exceptions fromdataretrievalordataretrieval.interruptionsby @thodson-usgs in #391 - Deprecate
begin_utc,end_utc,state,state_name, andhydrologic_unit_codeonget_time_series_metadata, removable on or after 2027-06-01 by @thodson-usgs in #422
Internals, docs, and CI
- Refactor functions to cyclomatic complexity 10 or below and ratchet the
complexipygate by @thodson-usgs in #385 - Simplify the WQP module so the
get_*andwhat_*getters share internal functions by @ehinman in #394 - Select the ruff checks no other gate covers, and pin the linter by @thodson-usgs in #398
- Check documented
propertiescolumns against each collection's/schemain the live run by @thodson-usgs in #424 - Use one word per concept in the configuration chain by @thodson-usgs in #400
- Separate the terms we own from the terms the services own, and use the glossary's terms for collections and locations by @thodson-usgs in #405, #402
- Record each explanation once, in the venue that owns it, with copy edits across the ADRs, guides, glossary, docstrings, comments, and tests by @thodson-usgs in #396, #417, #418
- Catch doubled words in pre-commit by @thodson-usgs in #404
- Add the Water Data for the Nation survey link to NEWS by @ehinman in #401
New contributors
Full changelog: v1.3.0...v1.4.0
Release notes drafted using Claude Opus 5