Repository navigation
Read zVariable pad value at correct offset when dims are NOVARY - #346
Merged
Merged
Conversation
bryan-harter
requested review from
bryan-harter
and
a balanced review from Copilot
October 13, 2026 20:09
There was a problem hiding this comment.
🟡 Changes recommended
The CDF 2 parsing branch lacks targeted regression coverage.
1 open finding
What changed in this PR
Fixes pad-value parsing for zVariables containing NOVARY dimensions.
Changes:
- Calculates pad offsets before filtering NOVARY dimensions.
- Adds a CDF 3 regression test.
| File | Description |
|---|---|
cdflib/cdfread.py |
Corrects CDF 2/3 zVDR pad offsets. |
tests/test_cdfwrite.py |
Tests CDF 3 NOVARY pad parsing. |
🧠 Review effort: Balanced
💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Member
|
Thanks for finding this bug! Merging now, and it will go out in the next deployment. |
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.

In
_read_vdr3/_read_vdr2, the pad-value offset was computed after dropping NOVARY dims, i.e. from the reduced dim count. On disk the VDR storeszDimSizesandDimVarysfor every dim, so any zVariable with a NOVARY dim and a pad value gotPadread from inside the DimVarys array (e.g.-4294967296instead of-7for an int64 pad).Fix: compute the offset from the stored
zNumDimsbefore dropping NOVARY dims.Test: writes a 2-D zVariable with a pad value, flips one DimVary to NOVARY in the file bytes (cdfwrite cannot emit NOVARY zVariable dims), and checks
varinq().Pad. Fails on main, passes here.