Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test for writing netcdf data with unlimited dimension does not do what might be expected. #249

Open
bnlawrence opened this issue Dec 27, 2024 · 1 comment

Comments

@bnlawrence
Copy link

What happened:

The following piece of code:

...
v = ds.create_variable("foo_unlimited", ("x", "unlimited"), float)
v[...] = 1
...

which appears in the write_h5netcdf method of test_h5netcdf results in a file with no data in the variable "foo_unlimited", which I don't believe was the intention.

You can see that by attempting to read the data, which show an empty dataset. (I only know this because the new pyfive backend raises an error because it can't handle reading an unlimited variable with no data, which is a problem for pyfive which I will need to fix). You probably want to decide what you want to happen here, possibly have two tests, one with data, and one without. (h5netcdf reads this variable empty or not, fine.)

What you expected to happen:

Either the library should raise an error when the attempt to write a value to non-existent dimension is attempted (netcdf4-python does), or it should silently extend the dimension, and then fill it (which is what ChatGPT expected to happen !!)

Version

h5netcdf 1.4.1
h5py 3.12.1
HDF5 1.12.2
Python 3.11.11 | packaged by conda-forge | (main, Dec 5 2024, 14:21:42) [Clang 18.1.8 ]
sys.platform darwin
sys.maxsize 9223372036854775807
numpy 2.2.1
cython (built with) 3.0.11
numpy (built against) 2.1.1
HDF5 (built against) 1.12.2

@kmuehlbauer
Copy link
Collaborator

Thanks @bnlawrence for bringing this to attention. I'll have a look into this the coming days.

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

No branches or pull requests

2 participants