fix(mag): align L2 vector and quality metadata#3230
Open
davidt0x wants to merge 3 commits into
Open
Conversation
davidt0x
commented
May 20, 2026
| FILLVAL: -1.0e31 | ||
| FORMAT: F13.5 | ||
| LABL_PTR_1: direction_label | ||
| VALIDMAX: 1.0e+5 |
Collaborator
Author
There was a problem hiding this comment.
Are these good values? These vector VALIDMIN/MAX values were inferred from the existing MAG magnitude metadata, which already used VALIDMAX = 1.0e5 nT. The goal was to replace the inherited int64 defaults with physically meaningful float bounds and keep the vector metadata consistent with magnitude.
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
Fix MAG L2 vector and quality metadata so the written CDF metadata matches the serialized variable types.
This PR is one small part of the broader ISTP / metadata cleanup tracked in issue #2577. Within that larger effort, this branch addresses the remaining MAG L2 metadata mismatches that were still showing up in the written normal-rate products.
Scope:
imap_mag_l2_norm-srfWhy
During the broader file-level metadata cleanup under #2577, two MAG-specific issues remained:
b_srfquality_flagsandquality_bitmaskwere assigned the wrong attribute templates in MAG L2 dataset generationThe underlying science values were not the problem here. The issue was that the metadata applied to the written CDF variables did not correctly describe the product semantics and serialized types.
What Changed
Fix shared MAG vector metadata
Update the shared MAG L2 vector attribute template so the written metadata matches the floating-point magnetic-field vectors that are actually emitted.
Changes:
CDF_FLOATFILLVAL = -1.0e31FORMAT = F13.5VALIDMIN = -1.0e5VALIDMAX = 1.0e5This flows through the shared vector attrs used by:
b_srfb_gseb_gsmb_rtnb_dsrfFix quality metadata mapping
In MAG L2 dataset generation, swap the attr-template assignment so:
quality_flagsuses theqfattrsquality_bitmaskuses theqf_bitmaskattrsThis keeps:
and only corrects the metadata applied to the written outputs.
Testing
Extended the written-CDF MAG regression coverage to verify:
CDF_FLOATFILLVAL,FORMAT,VALIDMIN, andVALIDMAXmatch the updated metadataquality_flagsandquality_bitmaskkeep their values but now carry the correct written CDF attrsValidated locally with: