Skip to content

Fix SPC probabilistic outlook parsing for 2026 format#11

Merged
thornjad merged 1 commit into
mainfrom
fix-spc-probabilistic-cig
Jun 10, 2026
Merged

Fix SPC probabilistic outlook parsing for 2026 format#11
thornjad merged 1 commit into
mainfrom
fix-spc-probabilistic-cig

Conversation

@thornjad

@thornjad thornjad commented Jun 10, 2026

Copy link
Copy Markdown
Owner

Problem

Probabilistic tornado/wind/hail outlooks (get_spc_outlook with outlook_type tornado/wind/hail) were returning probability: 0 with null valid_time/expire_time for every location, and the significant flag never fired.

Root cause: SPC's March 3, 2026 outlook revamp (SCN 26-11) changed the probabilistic GeoJSON in two ways:

  1. Probability bands are now decimal-fraction strings ("0.05") rather than integer percents ("5"). int("0.05") raised ValueError, so every feature was skipped and probability fell through to 0 with null times.
  2. The single SIGN significant-severe hatched label was replaced by Conditional Intensity Groups CIG1/CIG2/CIG3. The old label == "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 — any CIG* group sets significant (CIG1 is the EF2+/65kt/2"-hail floor that SIGN used to mark); a new additive intensity_group field 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%.
  • Docstring — documents intensity_group and the day-1/2 per-hazard scope.
  • Tests/fixture — the shared MOCK_PROB_OUTLOOK fixture used the dead SIGN/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.

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
@thornjad thornjad merged commit 6f6f28c into main Jun 10, 2026
4 checks passed
@thornjad thornjad deleted the fix-spc-probabilistic-cig branch June 10, 2026 19:16
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.

1 participant