Skip to content

Commit f436713

Browse files
authored
Throw more informative error for fill_value=nothing (#147)
This closes Zarr from gdalwarp can not be read because of fill_value is Nothing #146
1 parent 9ac31cb commit f436713

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

src/ZArray.jl

+3
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,9 @@ Read the chunk specified by `i` from the Zarray `z` and write its content to `a`
256256
"""
257257
function uncompress_raw!(a,z::ZArray{<:Any,N},curchunk) where N
258258
if curchunk === nothing
259+
if isnothing(z.metadata.fill_value)
260+
throw(ArgumentError("The array $z got missing chunks and no fill_value"))
261+
end
259262
fill!(a, z.metadata.fill_value)
260263
else
261264
zuncompress!(a, curchunk, z.metadata.compressor, z.metadata.filters)

test/runtests.jl

+8
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,14 @@ end
257257
@test all(==(5),c[:,1])
258258
end
259259

260+
@testset "Fill_Value nothing with missing chunk" begin
261+
# See issue #146
262+
p = tempname()
263+
a = zcreate(Int64, 10,10,chunks=(5,2))
264+
@test_throws ArgumentError a[:,:]
265+
266+
end
267+
260268
include("storage.jl")
261269

262270

0 commit comments

Comments
 (0)