Skip to content

Read channel names from the "channel" dataset in h5_convert.py - #183

Merged
azrael417 merged 1 commit into
NVIDIA:mainfrom
MaxFreedomPollard:fix-h5-convert-channel-key
Sep 30, 2026
Merged

azrael417 merged 1 commit into
NVIDIA:mainfrom
MaxFreedomPollard:fix-h5-convert-channel-key

Conversation

@MaxFreedomPollard

Copy link
Copy Markdown
Contributor

data_process/h5_convert.py reads the channel names from a dataset called channel_names, but every makani writer (annotate_dataset.py, concatenate_dataset.py, the converters, and h5_convert.py itself when it writes its output) calls that dataset channel. So the script stops with KeyError: "Unable to synchronously open object (object 'channel_names' doesn't exist)" on any annotated file and writes nothing. This changes the read to channel.

I also added TestH5Convert to tests/test_data_process.py. It annotates a small dataset with the existing test helpers, converts it with gzip and a batch size that leaves a partial last batch, and checks the data, the compression and the four dimension scales. It fails with the KeyError on main and passes with the fix.

Testing: tests/test_data_process.py passes locally (11 passed, 8 skipped for mpi4py, the same skips as on main), pre-commit run --all-files is clean, and the tests and Style checks workflows passed on my fork (tests, style). I also ran the script from the command line on an annotated file before and after the change. I only tried small synthetic files, not real ERA5 data.

Two other options of the script still fail for unrelated reasons (--transpose and a chunk size given in MB). I left them alone to keep this small.

Every makani writer, h5_convert.py included, stores channel names in a
dataset called "channel", so reading "channel_names" raised a KeyError on
every annotated file. Add a test that converts an annotated dataset.

@azrael417 azrael417 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM, thanks for fixing this.

@azrael417
azrael417 merged commit 3697539 into NVIDIA:main Sep 30, 2026
2 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