JuliaIO/Zarr.jl

If metadata.fill_value is nothing

twinGu opened this issue · 2 comments

If the fill_value for a ZArray is decoded as nothing and the user attempts to access the array at out of bounds indices, an error occurs during filling. I understand from the Zarr specification that accessing uninitialized (not existing) chunks should return the fill value, in this case nothing. The concrete issue here is the pre-allocation of a fixed type for the array. Maybe the arrays should be pre-allocated as Array{Union{T, Nothing}}?

Well, actually a fill_value=none means that no fill_value is be used so the data is assumed to be left as it is. So, when reading data I think it is ok to throw an error.

The problem is that when writing data, the chunk has to be read first, and we should not throw an error if it does not exist. So maybe it would be nice if readchunk! would return a Bool indicating wether a chunk was read and then the caller checks that when in readmode we throw an error and otherwise we continue.

I think this issue is resolved. There are constructors for ZArrays like zzeros etc and from there on you can modify data. I think it is sane that when there is no fill_value defined we assume that all chunks are present.