Fix mangled column names for NWIS dam sublocation timeseries#231
Draft
thodson-usgs wants to merge 2 commits into
Draft
Fix mangled column names for NWIS dam sublocation timeseries#231thodson-usgs wants to merge 2 commits into
thodson-usgs wants to merge 2 commits into
Conversation
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>
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.
Closes #177
Summary
methodDescriptionfields for dam sites include a sublocation qualifier in the form"STAGE - TAILWATER, [Tailwater]"method.strip("[]()").lower()only stripped leading/trailing brackets — it left the inner, [Tailwaterfragment, producing column names like00065_stage - tailwater, [tailwater", ["before stripping so"STAGE - TAILWATER, [Tailwater]"→"stage - tailwater"and"HEADWATER"→"headwater"(unchanged)Live reproduction
Site
03399800is a dam with both headwater and tailwater gage-height sublocations — the tailwater channel'smethodDescriptionis"STAGE - TAILWATER, [Tailwater]", the exact shape that exposes the bug. Both runs below hitwaterservices.usgs.gov.The pre-fix output was observed live against
waterservices.usgs.govduring PR review.Test plan
TestReadJsonColumnNameswith 3 unit tests covering simple descriptions, bracket-qualified descriptions, and empty descriptions🤖 Generated with Claude Code