Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to read data of type Char #98

Open
alex-s-gardner opened this issue Nov 1, 2022 · 1 comment
Open

Unable to read data of type Char #98

alex-s-gardner opened this issue Nov 1, 2022 · 1 comment
Labels
bug Something isn't working good first issue Good for newcomers

Comments

@alex-s-gardner
Copy link
Contributor

alex-s-gardner commented Nov 1, 2022

dc = Zarr.zopen("http://its-live-data.s3.amazonaws.com/test_datacubes/Malaspina_succeeded_ITS_LIVE_vel_EPSG3413_G0120_X-3250000_Y250000.zarr")

numerical data can be read in just fine, e.g.:

dc["mid_date"][:]

character data can not be read in:

dc["sensor_img1"][:]

I do not believe this was an issue with earlier versions of Zarr.jl

#and here's the stack trace:

ERROR: MethodError: no method matching zero(::Type{Char})
Closest candidates are:
  zero(::Union{Type{P}, P}) where P<:Dates.Period at /Applications/Julia-1.8.app/Contents/Resources/julia/share/julia/stdlib/v1.8/Dates/src/periods.jl:53
  zero(::Union{Type{<:Zarr.DateTime64}, Zarr.DateTime64}) at ~/.julia/packages/Zarr/ol3aJ/src/metadata.jl:47
  zero(::Union{Zarr.ASCIIChar, Type{Zarr.ASCIIChar}}) at ~/.julia/packages/Zarr/ol3aJ/src/metadata.jl:22
  ...
Stacktrace:
 [1] _zero(T::Type)
   @ Zarr ~/.julia/packages/Zarr/ol3aJ/src/ZArray.jl:131
 [2] getchunkarray(z::ZArray{Char, 1, Zarr.BloscCompressor, Zarr.ConsolidatedStore{Zarr.HTTPStore}})
   @ Zarr ~/.julia/packages/Zarr/ol3aJ/src/ZArray.jl:135
 [3] readblock!(aout::Vector{Char}, z::ZArray{Char, 1, Zarr.BloscCompressor, Zarr.ConsolidatedStore{Zarr.HTTPStore}}, r::CartesianIndices{1, Tuple{Base.OneTo{Int64}}}; readmode::Bool)
   @ Zarr ~/.julia/packages/Zarr/ol3aJ/src/ZArray.jl:149
 [4] readblock!(aout::Vector{Char}, z::ZArray{Char, 1, Zarr.BloscCompressor, Zarr.ConsolidatedStore{Zarr.HTTPStore}}, r::CartesianIndices{1, Tuple{Base.OneTo{Int64}}})
   @ Zarr ~/.julia/packages/Zarr/ol3aJ/src/ZArray.jl:143
 [5] readblock!(a::ZArray{Char, 1, Zarr.BloscCompressor, Zarr.ConsolidatedStore{Zarr.HTTPStore}}, aout::Vector{Char}, i::Base.OneTo{Int64})
   @ Zarr ~/.julia/packages/Zarr/ol3aJ/src/ZArray.jl:174
 [6] getindex_disk(a::ZArray{Char, 1, Zarr.BloscCompressor, Zarr.ConsolidatedStore{Zarr.HTTPStore}}, i::Function)
   @ DiskArrays ~/.julia/packages/DiskArrays/VGEpq/src/diskarray.jl:31
 [7] getindex(a::ZArray{Char, 1, Zarr.BloscCompressor, Zarr.ConsolidatedStore{Zarr.HTTPStore}}, i::Function)
   @ DiskArrays ~/.julia/packages/DiskArrays/VGEpq/src/diskarray.jl:177
 [8] top-level scope
   @ REPL[127]:1
@meggart
Copy link
Collaborator

meggart commented Nov 10, 2022

A quick fix would be to define Zarr._zero(::Type{Char}) = Char(0) before reading from the array. After that you can read the data. The underlying problem here is that the array in question does not define a fill value which makes it hard to initialize the buffer when reading into it. I will also add a patch to master but it might some time until this trickles to the registered version.

@meggart meggart added bug Something isn't working good first issue Good for newcomers labels Nov 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants