fix(parser): probabilistic LABEL is a fraction, not integer percent (100x scale bug)#3
Merged
Merged
Conversation
…eger percent parse_probabilistic divided every isopleth by 100 unconditionally, so the live www.spc.noaa.gov + ArcGIS GeoJSON form (LABEL="0.02") yielded 0.0002 instead of 0.02 — a 100x error on every real feed. Normalize like the day4-8 path (pct > 1.0 ? pct/100 : pct): integer percents divide, fractions pass through. Pin both forms with regression tests. Bump 0.1.0 -> 0.1.1.
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.
What
parse_probabilisticdivided every SPC probabilistic-outlook isopleth value by100 unconditionally, on the assumption that
LABEL/dnis an integerpercent (
"2","5","30"). The livewww.spc.noaa.govstatic GeoJSON andthe ArcGIS
f=geojsonmirror actually ship the value as an already-normalizedfraction (
LABEL = "0.02","0.30"). Result: a 2% tornado risk parsed to0.0002instead of0.02— a 100x error on every real feed.This was latent because the only persisting consumer (
spc-data→spc.prob_outlooks) was simultaneously fetching the wrong URL and storingnothing. Fixing that URL surfaced the scale bug.
Fix
Normalize exactly like the sibling day4-8 path (
convective.cpp):Integer percents (
> 1) divide by 100; fractions (<= 1) pass through. Bothupstream forms now map to the same
[0,1]probability.Tests
Parser.ProbabilisticFractionalLabel—"0.02"/"0.30"→0.02/0.30.Parser.ProbabilisticTornado(integer"2"/"5"→0.02/0.05) still green.Corpus.ProbabilisticParsesAndScalestightened to a>= 0.01floor (every realSPC isopleth is
>= 2%), which rejects the old0.0002regression.24/24 tests pass; lint + audit clean.
0.1.0→0.1.1(+ CHANGELOG).Downstream:
spc-datawill re-pin tov0.1.1and re-freeze its SQL golden.