-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Losing top level name attribute when saving and then reopening using h5netcdf #9293
Comments
Thanks for opening your first issue here at xarray! Be sure to follow the issue template! |
@melonora Thanks for raising. Short question, does it work with engine |
@melonora thanks for the clear issue! Note if I do
which doesn't have |
@melonora @TomNicholas I think there is no way to implement this, as the standard name of the root group (at least in the HDF5/NETCDF4 world) is See also the HDF5 documentation on groups. Citing from that document:
Maybe properly documenting that is enough? |
Okay thanks @kmuehlbauer! I thought there was a reason I didn't already do this.
Yes. Also if you really really wanted to preserve that information I guess you could an extra level at the root, so your |
I think this is not possible in Zarr either, as the v3 spec says:
|
Yes, that would work, too. I think if the user needs that kind of metadata it should go in |
@TomNicholas Can you point me to the doc part where this information should be added? I'm going to add this now. |
Thanks, I will approach it as suggested. Would it be good to give a warning when saving that the name of the root datatree is dropped? I could open a PR for that |
❤️
Either the new section for the IO page, or the Be aware that the explanatory (non-API) docs currently live in a temporary location, and are being merged in to the main docs to be exposed publicly as part of #9033.
Perhaps? If we do this then the warning should only trigger if the name of the parent is not |
I agree, that might be annoying for the majority of users. But I have also no other idea at the moment. |
Doc PR in #9298 |
Great, thanks for the quick reply! As for the warning, I thought more to check at write whether the group being written is the root and only in case name is then not None to give the warning. If that is a possibility |
@melonora Yes, totally understand that. But users might assemble/disassemble DataTree's from/into subtrees and at some point in time just dump them to disk. Most users will just don't care and would have to reset the name to |
I see |
What happened?
I have a
DataTree
that looks like this before saving withto_netcdf
and engine set toh5netcdf
:When reopening with
open_datatree
using the same engine I lose the namemy_container
of the root datatree.What did you expect to happen?
I would expect the name of the root datatree to be conserved when reopening the datatree.
Minimal Complete Verifiable Example
MVCE confirmation
Relevant log output
No response
Anything else we need to know?
No response
Environment
python 3.10
xarray 2024.7.0
netcdf4 1.7.1
h5netcdf 1.3.0
The text was updated successfully, but these errors were encountered: