JLD.jl
JLD.jl copied to clipboard
Replacing only some entries on the file
Okey, this may not be an "issue" per se, but I do not seem to find here or anywhere else a practical way to replace the contents of only some entries on the datafile. As an example, if I do make something of this sort
arx=load(filename)
I get, let us say, a Dictionary with Entries "A", "B", and "C". So I make some calculations on "A", and then I have two options. If I do
jldopen(filename, "r+") do file
write(file, "A", A)
end
Julia will complaint that "A" exists and cannot overwrite them. If I do
jldopen(filename, "w") do file
write(file, "A", A)
end
Then I end with a new file that only stores "A". Of course I could rewrite everything, but If I have a large dictionary, seems impractical (and problematic if I miss something out).
Grettings and thanks in Advance K:
Put a delete!(file, "A", A) before yourwrite. Note, however, that HDF5 doesn't always actually free the space. So your file might be growing although you have the same size object stored inside. To avoid this generically, you would have to repack your file (look here for a hack to do this).
I do agree though that some convenience mappings would be nice here.