Closed rafaqz closed 2 years ago
I can reproduce the error (by following comment#1), but I'm not sure how to resolve it yet.
Here's what I have so far:
| | |_| | | | (_| | | Version 1.8.0 (2022-08-17)
_/ |\__'_|_|_|\__'_| | Official https://julialang.org/ release
|__/ |
julia> using ArchGDAL, GDAL
[ Info: Precompiling ArchGDAL [c9ce4bd3-c3d5-55b8-8973-c0e20141b8c3]
┌ Warning: User provided progress functions are unsupported on this architecture.
└ @ ArchGDAL ~/.julia/dev/ArchGDAL/src/utils.jl:233
┌ Warning: User provided progress functions are unsupported on this architecture.
└ @ ArchGDAL ~/.julia/dev/ArchGDAL/src/utils.jl:233
┌ Warning: User provided progress functions are unsupported on this architecture.
└ @ ArchGDAL ~/.julia/dev/ArchGDAL/src/utils.jl:233
┌ Warning: User provided progress functions are unsupported on this architecture.
└ @ ArchGDAL ~/.julia/dev/ArchGDAL/src/utils.jl:233
┌ Warning: User provided progress functions are unsupported on this architecture.
└ @ ArchGDAL ~/.julia/dev/ArchGDAL/src/utils.jl:233
julia> Base.convert(GDAL.GDALDataType, ArchGDAL.GDT_CInt16)
GDT_CInt16::GDALDataType = 0x00000008
julia> Base.convert(ArchGDAL.GDALDataType, GDAL.GDT_CInt16)
GDT_CInt16::GDALDataType = 8
julia> macroexpand(Main, :(ArchGDAL.@convert(
GDALDataType::GDAL.GDALDataType,
GDT_Unknown::GDAL.GDT_Unknown,
GDT_Byte::GDAL.GDT_Byte,
GDT_UInt16::GDAL.GDT_UInt16,
GDT_Int16::GDAL.GDT_Int16,
GDT_UInt32::GDAL.GDT_UInt32,
GDT_Int32::GDAL.GDT_Int32,
GDT_Float32::GDAL.GDT_Float32,
GDT_Float64::GDAL.GDT_Float64,
GDT_CInt16::GDAL.GDT_CInt16,
GDT_CInt32::GDAL.GDT_CInt32,
GDT_CFloat32::GDAL.GDT_CFloat32,
GDT_CFloat64::GDAL.GDT_CFloat64,
GDT_TypeCount::GDAL.GDT_TypeCount,
)))
quote
const GDALDataType_to_GDAL_GDALDataType_map = (ArchGDAL.Base).ImmutableDict([Pair(GDT_Unknown, GDAL.GDT_Unknown), Pair(GDT_Byte, GDAL.GDT_Byte), Pair(GDT_UInt16, GDAL.GDT_UInt16), Pair(GDT_Int16, GDAL.GDT_Int16), Pair(GDT_UInt32, GDAL.GDT_UInt32), Pair(GDT_Int32, GDAL.GDT_Int32), Pair(GDT_Float32, GDAL.GDT_Float32), Pair(GDT_Float64, GDAL.GDT_Float64), Pair(GDT_CInt16, GDAL.GDT_CInt16), Pair(GDT_CInt32, GDAL.GDT_CInt32), Pair(GDT_CFloat32, GDAL.GDT_CFloat32), Pair(GDT_CFloat64, GDAL.GDT_CFloat64), Pair(GDT_TypeCount, GDAL.GDT_TypeCount)]...)
function (ArchGDAL.Base).convert(::ArchGDAL.Type{GDAL.GDALDataType}, var"#26#ft"::GDALDataType)
#= /Users/yeesian/.julia/dev/ArchGDAL/src/utils.jl:130 =#
#= /Users/yeesian/.julia/dev/ArchGDAL/src/utils.jl:131 =#
return GDALDataType_to_GDAL_GDALDataType_map[var"#26#ft"]
end
const GDAL_GDALDataType_to_GDALDataType_map = (ArchGDAL.Base).ImmutableDict([Pair(GDAL.GDT_Unknown, GDT_Unknown), Pair(GDAL.GDT_Byte, GDT_Byte), Pair(GDAL.GDT_UInt16, GDT_UInt16), Pair(GDAL.GDT_Int16, GDT_Int16), Pair(GDAL.GDT_UInt32, GDT_UInt32), Pair(GDAL.GDT_Int32, GDT_Int32), Pair(GDAL.GDT_Float32, GDT_Float32), Pair(GDAL.GDT_Float64, GDT_Float64), Pair(GDAL.GDT_CInt16, GDT_CInt16), Pair(GDAL.GDT_CInt32, GDT_CInt32), Pair(GDAL.GDT_CFloat32, GDT_CFloat32), Pair(GDAL.GDT_CFloat64, GDT_CFloat64), Pair(GDAL.GDT_TypeCount, GDT_TypeCount)]...)
function (ArchGDAL.Base).convert(::ArchGDAL.Type{GDALDataType}, var"#28#ft"::GDAL.GDALDataType)
#= /Users/yeesian/.julia/dev/ArchGDAL/src/utils.jl:163 =#
#= /Users/yeesian/.julia/dev/ArchGDAL/src/utils.jl:164 =#
return GDAL_GDALDataType_to_GDALDataType_map[var"#28#ft"]
end
end
I.e. It seems that the KeyError is being triggered inside the convert macro here: https://github.com/yeesian/ArchGDAL.jl/blob/66066333e7a6c06f3a1086ec1de0b7d4ac3ca79c/src/utils.jl#L122-L131
However,
ArchGDAL.GDT_CInt16
should be in the map, and Base.convert(GDAL.GDALDataType, ArchGDAL.GDT_CInt16)
seems to be working as wellSo I'm still dumbfounded for now.
Oh I see now, we'll need to define the conversion in https://github.com/yeesian/ArchGDAL.jl/blob/66066333e7a6c06f3a1086ec1de0b7d4ac3ca79c/src/types.jl#L292-L304
E.g. with https://github.com/yeesian/ArchGDAL.jl/commit/66c284e77820bacadc5dae1ba631ef91aba063a0, the example in https://github.com/yeesian/ArchGDAL.jl/issues/326#issue-1386480491 will run (although I can't vouch for the correctness of the output).
Since I can't transfer the issue here, reposting this from @lupemba over at Rasters.jl https://github.com/rafaqz/Rasters.jl/issues/319
The file is here: https://we.tl/t-pKuLOIMfT5
This is a complex SAR tiff file, also 1GB download.
@yeesian @mathieu17g do you understand this error?
It's not so easy to follow why this definition is missing through the
@convert
macros. But I imagine this should come back as aComplex{Int16}
do we even handle complex numbers?