fix_cmip7_repack_compression - #692
Merged
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #692 +/- ##
=======================================
+ Coverage 78.6% 78.7% +0.1%
=======================================
Files 41 41
Lines 9021 9061 +40
Branches 1687 1693 +6
=======================================
+ Hits 7094 7134 +40
Misses 1592 1592
Partials 335 335
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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.
Fix
cmip7repacksilently leaving every 3-D CMIP7 field uncompressedProblem
createVariablepasses nochunksizes, so netCDF4's default applies.cmip7repackthen refuses to rechunk in two situations, and MOPPy's CMIP7output hits both:
(a) A second timestep does not fit. The default chunk is one timestep, and
two of them exceed the target.
(b) The default chunk already exceeds the target. For the largest fields
netCDF4's default chunk is multi-dimensional rather than one timestep.
(19,144,192)f4[1,19,144,192]cl/cli/clw(38,145,192)f4[1,38,145,192](50,300,360)f4[1,25,150,180](145,192)f4[1,145,192][37,145,192](300,360)f4[1,300,360][9,300,360]For p19 the miss is 8,192 bytes:
In a one-year daily run this is the seven p19 variables
ta ua va hus hur wap zg— about 100 GiB of the 111 GiB run. Monthly runs addcl/cli/clwandthe 3-D ocean fields.
The failure was invisible because
tests/unit/test_qc_gates.py:189mockedsubprocessand assertedpasson exit 0 — pinning the blind spot in placewith a passing test. This is the second defect to reach production through this
gate; see
ISSUE-cmip7-out-name-cmip6-fallback.md.Fix
1. Size
-dper variable —base.py:2710_cmip7repack_chunk_targetreopens the written file, resolves the data variablethe way
cmip7repackdoes (thevariable_idglobal attribute), and asks for twotimesteps' worth:
-dmust be at least the 4 MiB default, so surface fields keep it unchanged.Branch (b) is why the target is sized from the slice rather than merely nudged
past 4 MiB: for ocean 3-D it has to clear the existing 4,500,000 B chunk before
cmip7repackwill touch the variable at all.Preferred over dropping the
mip_era != "CMIP7"guard inuse_compression:that would fight the design intent (repack owns CMIP7 packing) and would not fix
the chunk layout.
2. Verify the repack happened —
base.py:2748_verify_repack_compressionreopens the file after the subprocess returns andreads
filters()['zlib']off the data variable. The gate now recordswarnwitha reason instead of
passwhen it is false:Worth having independently of (1). The man page's "or the data in the input file
only has one chunk" branch means a variable can still come back uncompressed
however
-dis sized — andcheck_cmip7_packingdoes not catch this defecteither (see Verification), so this read-back is the only check that does.
Cost
+49 s CPU per 769 MB file — about +15 min CPU per p19 variable, +1.8 h across
the seven, taking them from ~70 min to ~85 min CPU (+21 %). It saves about
47 GiB on the daily run. Both figures are measured.