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

HDF5: can overwrite vectors but not scalars #344

Open
ghost opened this issue Nov 1, 2016 · 2 comments
Open

HDF5: can overwrite vectors but not scalars #344

ghost opened this issue Nov 1, 2016 · 2 comments
Labels

Comments

@ghost
Copy link

ghost commented Nov 1, 2016

Hi everyone, I am using Julia's wonderful HDF5 library. I have come across a kind of strange issue: it seems possible to overwrite vectors, but not scalars. There are some workarounds, like using mid-level routines such as o_delete, or just creating a vector to begin with, but I'm still a bit surprised by this behavior. I am wondering if anyone has any insight to share into this? My apologies if the answer is obvious; I am trained in statistics rather than CS, but my attempts to find a solution in the docs and newsgroups have not been successful so far.

create a vector and a scalar

a=[1,2]
b=1

save using julia's hdf5 library

using HDF5
filepath="~/test.h5"
h5open(filepath, "w") do fid
fid["a"] =a
fid["b"]=b
end

try to rewrite using HDF structure directly

f=h5open(filepath,"r+")
names(f)
f["a"][:]=[1,3] #works
f["b"]=1 #fails
f["b"][:]=1 #fails
f["b"][1]=1 #fails
close(f)

@ggggggggg
Copy link
Contributor

I think this is the nature of the HDF5 library, not of the Julia wrapper. Try the same in Python (I think h5py is supported by the HDF5 group directly). I think the only way to make this work would be to delete f["b"] then create a new f["b"].

@ggggggggg
Copy link
Contributor

Can we close this as wontfix if I'm correct that this is a limitation of the HDF5 library?

@musm musm added wontfix and removed wontfix labels May 9, 2017
@musm musm added the wontfix label Dec 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants