Skip to content

Conversation

@jl-wynen
Copy link
Member

The biggest change here is specifying and adhering to common interfaces for all *IO classes.

This revealed an error in the dataset reader. The coord overrides where passed when reading the component data arrays but were not forwarded to the data array coord loader. So we were loading coords twice. The new implementation fixes that.

@jl-wynen jl-wynen assigned jl-wynen and unassigned jl-wynen Mar 11, 2025
@github-project-automation github-project-automation bot moved this to In progress in Development Board Mar 11, 2025
@jl-wynen jl-wynen moved this from In progress to Selected in Development Board Mar 11, 2025
Copy link
Contributor

@jokasimr jokasimr left a comment

Choose a reason for hiding this comment

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

👍

Comment on lines +449 to +458
coords = cast(dict[str, Variable], _read_mapping(group['coords']))
override = {'coords': coords}
data: MutableMapping[str, Variable | DataArray] = {}
for g in group['entries'].values():
name = g.attrs['name']
if g.attrs['scipp-type'] == 'DataArray':
data[name] = _DataArrayIO.read(g, override=override)
else:
data[name] = _VariableIO.read(g)
return Dataset(coords=coords, data=data)
Copy link
Contributor

Choose a reason for hiding this comment

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

Why can't we use _read_mapping here to create the data argument anymore?

Copy link
Contributor

Choose a reason for hiding this comment

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

Aha is it related to this?

This revealed an error in the dataset reader. The coord overrides where passed when reading the component data arrays but were not forwarded to the data array coord loader. So we were loading coords twice.

Copy link
Member Author

Choose a reason for hiding this comment

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

Exactly. This is the error that I fixed. (It was correct before but wasted time re-reading the same variables.)

@jl-wynen jl-wynen merged commit 6c5ffc2 into main Mar 11, 2025
5 checks passed
@jl-wynen jl-wynen deleted the appease-mypy branch March 11, 2025 14:57
@github-project-automation github-project-automation bot moved this from Selected to Done in Development Board Mar 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants