Skip to content

Commit

Permalink
Throw more informative error for fill_value=nothing (#147)
Browse files Browse the repository at this point in the history
This closes Zarr from gdalwarp can not be read because of fill_value is Nothing #146
  • Loading branch information
felixcremer authored May 7, 2024
1 parent 9ac31cb commit f436713
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/ZArray.jl
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,9 @@ Read the chunk specified by `i` from the Zarray `z` and write its content to `a`
"""
function uncompress_raw!(a,z::ZArray{<:Any,N},curchunk) where N
if curchunk === nothing
if isnothing(z.metadata.fill_value)
throw(ArgumentError("The array $z got missing chunks and no fill_value"))
end
fill!(a, z.metadata.fill_value)
else
zuncompress!(a, curchunk, z.metadata.compressor, z.metadata.filters)
Expand Down
8 changes: 8 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,14 @@ end
@test all(==(5),c[:,1])
end

@testset "Fill_Value nothing with missing chunk" begin
# See issue #146
p = tempname()
a = zcreate(Int64, 10,10,chunks=(5,2))
@test_throws ArgumentError a[:,:]

end

include("storage.jl")


Expand Down

0 comments on commit f436713

Please sign in to comment.