Repository navigation
Conversation
- is_h5i looked for `&AOS_SHAPE` among the IDS groups at the root of the file, and returned from the `do` block only: it was false for every file, so file2imas read tensorized files with hdf2imas. - imas2h5i pads every field to the full shape of the arrays of structures that hold it (it stopped at the last structure holding the field), and takes the largest instance as the shape of an array of structures (it took the last one visited). - h5i2imas sizes every array of structures from its `&AOS_SHAPE` before filling the fields (the first field read decided the length), and skips a field whose stored array is shorter, as written by earlier versions. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #115 +/- ##
==========================================
+ Coverage 44.02% 44.76% +0.74%
==========================================
Files 16 16
Lines 31556 31588 +32
==========================================
+ Hits 13891 14140 +249
+ Misses 17665 17448 -217 ☔ 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.
Three problems of the ITER tensorized HDF5 format (
imas2h5i,h5i2imas,is_h5i), which show up as soon as a file is written and read back.1.
is_h5iis false for every fileIt looked for
&AOS_SHAPEamong the names at the root of the file, which are the IDS groups (equilibrium,pf_active, ...), and itsreturn truewas inside thedoblock, so it only left the closure.file2imastherefore sent tensorized files tohdf2imas, which returned addwith every array of structures empty, without an error.It now looks inside the IDS groups for dataset names that contain
&.2. Arrays of structures lost elements, or the file could not be read
imas2h5ipadded each field only up to the last structure that holds it, whileh5i2imassized each array of structures from the first of its fields that it reads, and indexed numbers and strings up to the&AOS_SHAPElength.pf_activesample came back with 12 of its 14 coils, the D3D samples with 1 of 2 ions.BoundsError(omas_sample.json,ARCv3a_starting_dd.json).Now:
imas2h5ipads every field to the full shape of the arrays of structures that hold it, and the shape of an array of structures is the largest among its instances.h5i2imasfirst sizes every array of structures from its&AOS_SHAPE, parents before children, and then fills the fields. Nested arrays of different lengths keep their own lengths (before, the first field read decided).h5i2imasskips a field where the stored array is shorter than&AOS_SHAPE, so files written before this change can be read: on nine sample files written with the current master, every array of structures now has the length it had in the source.Effect
imas2h5ithenh5i2imason 12 sample files (omas_sample.jsonand FUSE's samples):is_h5itrueWhat still differs after a round trip is what the format does not hold: empty arrays are dropped,
ids_properties.homogeneous_timeis added, and a number or string that only some structures of an array have comes back as0or""in the others.Question for reviewers
The third change of the reader (skipping a field whose stored array is too short instead of throwing) is only there for files written by earlier versions. There is a commented-out check with the same purpose just below it; if you would rather have an error or a warning for such files, I can change it.
Tests
New testset
h5iintest/runtests_io.jl(15 tests): arrays of structures of different lengths, fields that only some structures hold, three levels with a shorter last instance,file2imas, and a second write and read that returns the samedd. On master it fails atis_h5iand stops with theBoundsError.🤖 Generated with Claude Code