legend-exp / LegendHDF5IO.jl

HDF5-IO in Julia for the LEGEND experiment
Other
0 stars 6 forks source link

Modify `LHDataStore` to also being able to read files without having write access #19

Closed fhagemann closed 2 years ago

fhagemann commented 2 years ago

Right now, LHDataStore is opened using cw rights, meaning that one can read and write. However, if trying to open a file without write access, this fails.

How about making

LHDataStore(f::AbstractString) = LHDataStore(HDF5.h5open(f, "cw"))

something like

LHDataStore(f::AbstractString, access = "cw") = LHDataStore(HDF5.h5open(f, access))

?

oschulz commented 2 years ago

@apmypb Let's use read-only access as the default, we should have

LHDataStore(f::AbstractString, access::AbstractString = "r") = LHDataStore(HDF5.h5open(f, access))

The default should always be to not change scientific data. :-)

apmypb commented 2 years ago

I will consider it in the next pull request

fhagemann commented 2 years ago

Thanks @apmypb !