Skip to content

Fix mangled column names for NWIS dam sublocation timeseries#231

Draft
thodson-usgs wants to merge 1 commit intoDOI-USGS:mainfrom
thodson-usgs:fix-nwis-column-names
Draft

Fix mangled column names for NWIS dam sublocation timeseries#231
thodson-usgs wants to merge 1 commit intoDOI-USGS:mainfrom
thodson-usgs:fix-nwis-column-names

Conversation

@thodson-usgs
Copy link
Copy Markdown
Collaborator

Closes #177

Summary

  • NWIS methodDescription fields for dam sites include a sublocation qualifier in the form "STAGE - TAILWATER, [Tailwater]"
  • The previous method.strip("[]()").lower() only stripped leading/trailing brackets — it left the inner , [Tailwater fragment, producing column names like 00065_stage - tailwater, [tailwater
  • Fix: split on ", [" before stripping so "STAGE - TAILWATER, [Tailwater]""stage - tailwater" and "HEADWATER""headwater" (unchanged)

Test plan

  • Added TestReadJsonColumnNames with 3 unit tests covering simple descriptions, bracket-qualified descriptions, and empty descriptions
  • Verified live fix: get_iv(sites="03399800", parameterCd="00065") now returns ["00065_headwater", "00065_stage - tailwater", ...]
  • All 96 unit tests pass

🤖 Generated with Claude Code

NWIS methodDescription values like "STAGE - TAILWATER, [Tailwater]"
produced column names with bracket qualifiers (e.g.
"00065_stage - tailwater, [tailwater"). Strip the ", [...]" suffix
before building the column name so get_iv returns clean names like
"00065_stage - tailwater". Closes DOI-USGS#177.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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.

Column Names get Mangled for Dam Headwater / Tailwater Stage Observations

1 participant