Skip to content

fix(codes): name the Virgin Islands as the services do - #432

Merged
thodson-usgs merged 1 commit into
DOI-USGS:mainfrom
thodson-usgs:fix/state-virgin-islands-name
Oct 2, 2026
Merged

thodson-usgs merged 1 commit into
DOI-USGS:mainfrom
thodson-usgs:fix/state-virgin-islands-name

Conversation

@thodson-usgs

@thodson-usgs thodson-usgs commented Oct 1, 2026 •

Copy link
Copy Markdown
Collaborator

TL;DR: state="VI" returned no rows from Water Data or NGWMN, because codes.states called the territory "US Virgin Islands" and both services call it "Virgin Islands". The table now uses the services' name, and still accepts "US Virgin Islands" as input.

The county PR (#433) is stacked on this one, because Virgin Islands counties need the corrected state name.

Changes

  • codes.states: FIPS 78 is named "Virgin Islands". "US Virgin Islands" is still accepted as input.
  • Behavior change: to_state(..., to="name") returns "Virgin Islands" for the territory.
  • TestTerritories: consolidated to one row per territory. Each row checks that the territory's name, postal code and FIPS code resolve to one another. Previously Puerto Rico appeared in four rows, one per input form, and those forms are already covered by Test_to_state. A separate assertion covers the "US Virgin Islands" alias.

Verification

  • Live: waterdata.get_monitoring_locations(state="VI") returns 1,092 rows (0 on main), and ngwmn.get_sites(state="VI") returns 3 (0 on main). Every name and postal code in the table matches the Water Data states collection.
  • Offline: 1215 passed. ruff, mypy, coverage and pre-commit pass.

codes.states named FIPS 78 "US Virgin Islands". Water Data and NGWMN
both filter state_name on "Virgin Islands" and match exactly, so
state="VI" returned no rows from either service: 0 rather than 1,092
monitoring locations, and 0 rather than 3 NGWMN sites. The Census name
is still accepted as input.

The territory tests are consolidated to one row per territory, each
checking that its name, postal code, and FIPS code resolve to one
another; the encodings themselves (case, US: prefix) are Test_to_state's.
@thodson-usgs
thodson-usgs force-pushed the fix/state-virgin-islands-name branch from e65b396 to e3c3c33 Compare October 2, 2026 01:08
thodson-usgs added a commit to thodson-usgs/dataretrieval-python that referenced this pull request Oct 2, 2026
ADR 0013's unified-argument clause requires each conversion table to be
checked live against the service's reference collection. The county
table is (counties_test.py); this does the same for codes.states, whose
names Water Data and NGWMN match exactly. It would have caught the
Virgin Islands name fixed in DOI-USGS#432.
@thodson-usgs
thodson-usgs marked this pull request as ready for review October 2, 2026 01:11
@thodson-usgs
thodson-usgs merged commit d77c853 into DOI-USGS:main Oct 2, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant