Skip to content

Commit f27a934

Browse files
ensure fill value is of the same type than data
1 parent 1be5e07 commit f27a934

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

src/variable.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ function CDM.attribnames(v::ZarrVariable)
1818
return names
1919
end
2020

21-
function CDM.attrib(v::ZarrVariable,name::SymbolOrString)
21+
function CDM.attrib(v::ZarrVariable{T},name::SymbolOrString) where T
2222
if String(name) == "_FillValue" && !isnothing(v.zarray.metadata.fill_value)
23-
return v.zarray.metadata.fill_value
23+
return T(v.zarray.metadata.fill_value)
2424
end
2525
return v.zarray.attrs[String(name)]
2626
end

test/test_write.jl

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
using ZarrDatasets
22
using ZarrDatasets:
33
defDim,
4-
defVar,
5-
defAttrib
6-
using DataStructures
4+
defVar
75

86
data = rand(Int32,3,5)
97

0 commit comments

Comments
 (0)