fix(codes): name the Virgin Islands as the services do - #432
Merged
thodson-usgs merged 1 commit intoOct 2, 2026
Merged
Conversation
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
force-pushed
the
fix/state-virgin-islands-name
branch
from
October 2, 2026 01:08
e65b396 to
e3c3c33
Compare
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
marked this pull request as ready for review
October 2, 2026 01:11
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.
TL;DR:
state="VI"returned no rows from Water Data or NGWMN, becausecodes.statescalled 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.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 byTest_to_state. A separate assertion covers the "US Virgin Islands" alias.Verification
waterdata.get_monitoring_locations(state="VI")returns 1,092 rows (0 onmain), andngwmn.get_sites(state="VI")returns 3 (0 onmain). Every name and postal code in the table matches the Water Datastatescollection.