Skip to content

Conversation

@MridulS
Copy link
Member

@MridulS MridulS commented Jan 14, 2025

I'm not sure about this!

If we are reading a legacy HDF5 file which was written with attrs in it, it will have the aligned set to True (tried this with scipp=24.11.2) for that attribute. But if I read the file in which has the old attrs in it, we should always set the new coord as unaligned for that attr right?

Maybe this is better solution than scipp/esssans#192 ?

Copy link
Member

@jl-wynen jl-wynen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch! The old attrs should indeed be unaligned. I missed this in the original PR.

g.attrs['name']: override[g.attrs['name']]
if g.attrs['name'] in override
else _HDF5IO.read(g)
else _HDF5IO.read(g, aligned=aligned)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This does not match the common interface of readers. And it doesn't make sense in general because only coords can be aligned, not, e.g., data groups.

I think it would be easiest to modify _read_legacy_attrs_into to add coords to a DataArray directly instead of the contents dict. Then you can use Coords.set_aligned.

@MridulS MridulS enabled auto-merge (squash) January 16, 2025 08:13
@MridulS MridulS merged commit 5626c94 into scipp:main Jan 16, 2025
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants