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

Can not load complex tiff values #319

Closed
lupemba opened this issue Sep 26, 2022 · 3 comments
Closed

Can not load complex tiff values #319

lupemba opened this issue Sep 26, 2022 · 3 comments

Comments

@lupemba
Copy link

lupemba commented Sep 26, 2022

Hi

Just tried to use Rasters.jl to load some complex Sentinel 1 SAR images. I get an error and it looks like there is an issue with complex numbers CInt16.

The image can be here https://we.tl/t-pKuLOIMfT5 but the link only works for 7 days and the file is 1.14 GB. The image will probably look like noise if you try to show it. I will see if I can find a better and smaller example.

error

raster jl code

I have previously used python rasterio to load but I want to remove the python dependency.

rasterio code

@rafaqz
Copy link
Owner

rafaqz commented Sep 26, 2022

Ok its seems this is an ArchGDAL.jl issue.

fn = "s1a-iw1-slc-vv-20220918t074922-20220918t074947-045056-056232-004.tiff"
ArchGDAL.read(fn) do ds
    ArchGDAL.read(ds)
end

ERROR: KeyError: key ArchGDAL.GDT_CInt16 not found
Stacktrace:
  [1] getindex
    @ ./dict.jl:819 [inlined]
  [2] convert
    @ ~/.julia/packages/ArchGDAL/1I2FZ/src/utils.jl:131 [inlined]
  [3] pixeltype(ptr::Ptr{Nothing})
    @ ArchGDAL ~/.julia/packages/ArchGDAL/1I2FZ/src/types.jl:177
  [4] ArchGDAL.IRasterBand(ptr::Ptr{Nothing}; ownedby::ArchGDAL.Dataset)
    @ ArchGDAL ~/.julia/packages/ArchGDAL/1I2FZ/src/types.jl:205
  [5] getband
    @ ~/.julia/packages/ArchGDAL/1I2FZ/src/dataset.jl:697 [inlined]
  [6] (::ArchGDAL.var"#77#78"{ArchGDAL.Dataset})(i::Int64)
    @ ArchGDAL ~/.julia/packages/ArchGDAL/1I2FZ/src/dataset.jl:850
  [7] iterate
    @ ./generator.jl:47 [inlined]
  [8] _collect(c::UnitRange{Int64}, itr::Base.Generator{UnitRange{Int64}, ArchGDAL.var"#77#78"{ArchGDAL.Dataset}}, #unused#::Base.EltypeUnknown, isz::Base.HasShape{1})
    @ Base ./array.jl:807
  [9] collect_similar
    @ ./array.jl:716 [inlined]
 [10] map
    @ ./abstractarray.jl:2933 [inlined]
 [11] pixeltype(ds::ArchGDAL.Dataset)
    @ ArchGDAL ~/.julia/packages/ArchGDAL/1I2FZ/src/dataset.jl:849
 [12] ArchGDAL.RasterDataset(ds::ArchGDAL.Dataset)
    @ ArchGDAL ~/.julia/packages/ArchGDAL/1I2FZ/src/raster/array.jl:32
 [13] #unsafe_readraster#108
    @ ~/.julia/packages/ArchGDAL/1I2FZ/src/raster/array.jl:126 [inlined]
 [14] unsafe_readraster
    @ ~/.julia/packages/ArchGDAL/1I2FZ/src/raster/array.jl:126 [inlined]
 [15] readraster(f::ComposedFunction{typeof(Rasters.cleanreturn), Rasters.var"#51#52"{Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}, String}}, args::String; kwargs::B
ase.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
    @ ArchGDAL ~/.julia/packages/ArchGDAL/1I2FZ/src/context.jl:265
 [16] readraster(f::Function, args::String)
    @ ArchGDAL ~/.julia/packages/ArchGDAL/1I2FZ/src/context.jl:264
 [17] _open(f::Function, ::Type{Rasters.GDALfile}, filename::String; write::Bool, kw::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
    @ Rasters ~/.julia/dev/Rasters/src/sources/gdal.jl:306
 [18] _open(f::Function, ::Type{Rasters.GDALfile}, filename::String)
    @ Rasters ~/.julia/dev/Rasters/src/sources/gdal.jl:292
 [19] _open(f::Function, filename::String; kw::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
    @ Rasters ~/.julia/dev/Rasters/src/convenience.jl:20
 [20] _open(f::Function, filename::String)
    @ Rasters ~/.julia/dev/Rasters/src/convenience.jl:19
 [21] Raster(filename::String; name::Nothing, key::Nothing, kw::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
    @ Rasters ~/.julia/dev/Rasters/src/array.jl:259
 [22] Raster(filename::String)
    @ Rasters ~/.julia/dev/Rasters/src/array.jl:258
 [23] top-level scope
    @ REPL[67]:1

@rafaqz
Copy link
Owner

rafaqz commented Oct 7, 2022

This should be fixed with the latest ArchGDAL patch version.

@rafaqz rafaqz closed this as completed Oct 7, 2022
@lupemba
Copy link
Author

lupemba commented Oct 16, 2022

Thank you. I have tried the latest ArchGDAL and it works perfectly

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants