Repository navigation
fix: NOAA SWPC 2026 format changes (SFI/Kp dict rows, RTSW endpoints, NUL bytes) - #5
Closed
AnsgarSchmidt wants to merge 1 commit into
Closed
AnsgarSchmidt wants to merge 1 commit into
AnsgarSchmidt wants to merge 1 commit into
Conversation
- conditions(): handle 10cm-flux.json list-of-dicts and
noaa-planetary-k-index.json dict rows (both shapes kept)
- solar_wind(): switch to json/rtsw/rtsw_{mag,wind}_1m.json,
parse bz_gsm/bt and proton_density/proton_speed; bz falls
back to bz_gse; -9999 sentinels become None via _to_float()
- _get_json(): strip trailing NUL bytes NOAA occasionally appends
- tests: SOLAR-L2-046..052 covering new + legacy formats
Contributor
|
Thank you, @AnsgarSchmidt! Your fix shipped in solar-mcp 0.2.4 (https://pypi.org/project/solar-mcp/0.2.4/). Your commit is in It had conflicts with 0.2.3, which fixed SFI and Kp separately, so we resolved them in #9. We also added one change on top: the rtsw files list the newest rows first, with one row per spacecraft per minute, so 73! |
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.
Summary
solar-mcp 0.2.1 breaks against the current NOAA SWPC endpoints (verified 2026-08-28 against live services.swpc.noaa.gov). This PR fixes all six data tools:
conditions()—products/summary/10cm-flux.jsonnow returns a list of dicts ([{"flux": 122, "time_tag": "..."}], lowercase keys) instead of a single dict withFlux/TimeStamp.products/noaa-planetary-k-index.jsonnow returns dict rows ({"time_tag", "Kp", ...}) instead of list rows. The parser now handles both old and new shapes (backward compatible).solar_wind()—products/solar-wind/{mag,plasma}-5-minute.jsonare gone (HTTP 404). Switched tojson/rtsw/rtsw_mag_1m.jsonandjson/rtsw/rtsw_wind_1m.json(source is DSCOVR or ACE), parsingbz_gsm/btandproton_density/proton_speed. Bz falls back tobz_gsewhenbz_gsmcarries missing data._to_float()— new helper: NOAA's-9999sentinel (and JSONnull) becomeNoneinstead of leaking bogus values into results._get_json()— strips trailing NUL bytes (\x00) that NOAA's file servers occasionally append (observed live onjson/goes/primary/xrays-6-hour.json; brokexray()with a JSONDecodeError).Testing
pytest tests/test_live.py --live)Tested with Python 3.12, FastMCP 3.4.7.