Add SML and SMU support to the SuperMAG reader - #89
Merged
Conversation
Collaborator
|
LGTM |
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
Extend
SMESuperMAGto support the complete standard SuperMAG auroral electrojet trio: SME, SML, and SMU.The existing behavior remains backward compatible: calling
read()without a variable selection continues to return onlysmeandfile_name.Motivation
SWVO previously exposed only SME, although SuperMAG supplies SME, SML, and SMU together and all three are commonly needed for auroral electrojet and substorm analyses.
During authenticated historical testing, SuperMAG also intermittently returned an empty response for an otherwise valid day. Repeating the same request succeeded. The downloader has therefore been hardened so that one transient response does not unnecessarily terminate a long historical download.
API
SMESuperMAG.read()now accepts avariablesargument:A single variable or ordered iterable is supported. Duplicate variables are removed while preserving their first occurrence. Empty, non-string, and unknown selections produce descriptive errors.
Compatibility and caching
download=Falsereports the missing fields and explains how to upgrade the cache.download=Trueatomically replaces the incomplete daily cache with a complete file.BaseIO.urlinterface is preserved; resolved SuperMAG request URLs use encoded parameters.Transient download handling
The downloader now treats the following conditions as transient:
Each affected day is attempted up to four times, with waits of one, two, and four seconds.
After all attempts are exhausted:
download_and_process()operation records the failed date, continues with subsequent days, and emits a summary warning.read(..., download=True)remains strict and raises the final failure because the requested data cannot be returned.Permanent failures, including invalid SuperMAG credentials, malformed data, and other HTTP 4xx responses, are not retried.
Requests use encoded parameters, and prepared URLs containing the SuperMAG username are not logged.
Data handling
NaN.file_nameprovenance are preserved.Documentation
A dedicated SuperMAG electrojet guide documents:
The README and Sphinx user-guide index have also been updated.
Verification
Local verification:
tests/iosuite: 688 passed, 14 skipped, 0 failed.The fork’s GitHub Actions matrix passed on Ubuntu and macOS with Python 3.11, 3.12, 3.13, and 3.14.