Fix SPC probabilistic outlook parsing for 2026 format#11
Merged
Conversation
SPC's March 2026 outlook revamp (SCN 26-11) changed the probabilistic
GeoJSON: probabilities are now decimal-fraction strings ("0.05" not
"5"), and the "SIGN" significant-severe label was replaced by
Conditional Intensity Groups (CIG1/CIG2/CIG3). The old int() parse threw
on every feature, so tornado/wind/hail outlooks returned 0% with null
valid/expire times, and the significant flag never fired.
- parse decimal-fraction and legacy integer probability labels
- treat any CIG group as significant; surface the highest group via a
new intensity_group field
- reject day-3 per-hazard probabilistic requests (SPC issues a combined
product for day 3) instead of 404-ing into a misleading 0%
- harden against null, numeric, and non-finite labels
- update the test fixture from the dead SIGN/integer format to the real
fraction/CIG format
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.
Problem
Probabilistic tornado/wind/hail outlooks (
get_spc_outlookwithoutlook_typetornado/wind/hail) were returningprobability: 0with nullvalid_time/expire_timefor every location, and thesignificantflag never fired.Root cause: SPC's March 3, 2026 outlook revamp (SCN 26-11) changed the probabilistic GeoJSON in two ways:
"0.05") rather than integer percents ("5").int("0.05")raisedValueError, so every feature was skipped and probability fell through to 0 with null times.SIGNsignificant-severe hatched label was replaced by Conditional Intensity GroupsCIG1/CIG2/CIG3. The oldlabel == "SIGN"check therefore never matched.Changes
_parse_probability— parses both decimal-fraction and legacy integer labels (disambiguated by the decimal point), and rejects non-finite values._point_in_probabilistic— anyCIG*group setssignificant(CIG1 is the EF2+/65kt/2"-hail floor thatSIGNused to mark); a new additiveintensity_groupfield surfaces the highest group at the point (CIG1→CIG3), compared by integer rank so a future two-digit group still orders correctly. Hardened against null, numeric, and malformed labels that previously crashed.get_spc_outlook(tools) — rejects day-3 per-hazard probabilistic requests with a clear error. SPC publishes per-hazard probabilities for days 1–2 only; day 3 is a single combined product, so the request used to 404 into a misleading 0%.intensity_groupand the day-1/2 per-hazard scope.MOCK_PROB_OUTLOOKfixture used the deadSIGN/integer format, which is why this passed green while production failed. Updated to the real fraction/CIG format, plus regression coverage for fraction parsing, legacy formats, CIG ordering, malformed labels, and the day-3 rejection.