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

Better Error message for failed cubefromshape #240

Open
felixcremer opened this issue Feb 2, 2021 · 0 comments
Open

Better Error message for failed cubefromshape #240

felixcremer opened this issue Feb 2, 2021 · 0 comments

Comments

@felixcremer
Copy link
Member

When I try to make a cubefromshape on a Cube which have X and Y axes instead of "Lat" and "Lon" Axes I get the following error.
I can circumvent the problem by renaming my axes before I do the cubefromshape but I think it would be nice to give the user a hint to do that and to have a more informing errror message.

ERROR: MethodError: no method matching length(::Nothing)
Closest candidates are:
  length(::DataStructures.DiBitVector) at /home/crem_fe/.julia/packages/DataStructures/DLSxi/src/dibit_vector.jl:40
  length(::IRTools.Inner.CFG) at /home/crem_fe/.julia/packages/IRTools/aSVI5/src/passes/passes.jl:18
  length(::VSCodeServer.JSON.Parser.MemoryParserState) at /home/crem_fe/.vscode/extensions/julialang.language-julia-1.0.10/scripts/packages/JSON/src/Parser.jl:29
  ...
Stacktrace:
 [1] cubefromshape_single(::String, ::Nothing, ::Nothing; labelsym::Nothing, T::Type{T} where T, kwargs::Base.Iterators.Pairs{Symbol,Nothing,Tuple{Symbol},NamedTuple{(:wrap,),Tuple{Nothing}}}) at /home/crem_fe/.julia/dev/ESDL/src/Shapes.jl:52
 [2] cubefromshape(::String, ::Vararg{Any,N} where N; samplefactor::Nothing, kwargs::Base.Iterators.Pairs{Symbol,Nothing,Tuple{Symbol},NamedTuple{(:wrap,),Tuple{Nothing}}}) at /home/crem_fe/.julia/dev/ESDL/src/Shapes.jl:77
 [3] cubefromshape(::String, ::YAXArray{Union{Missing, Float32},4,DiskArrayTools.DiskArrayStack{Union{Missing, Float32},4,Zarr.ZArray{Union{Missing, Float32},3,Zarr.BloscCompressor,Zarr.DirectoryStore},1},Array{CubeAxis,1}}; kwargs::Base.Iterators.Pairs{Symbol,Nothing,Tuple{Symbol},NamedTuple{(:wrap,),Tuple{Nothing}}}) at /home/crem_fe/.julia/dev/ESDL/src/Shapes.jl:74
 [4] randinds(::YAXArray{Union{Missing, Float32},4,DiskArrayTools.DiskArrayStack{Union{Missing, Float32},4,Zarr.ZArray{Union{Missing, Float32},3,Zarr.BloscCompressor,Zarr.DirectoryStore},1},Array{CubeAxis,1}}, ::String, ::Int64; seed::Int64, nsamples::Int64, wrap::Nothing, inner::Bool) at /home/crem_fe/.julia/dev/ESDLHelpers/src/shapesampling.jl:31
 [5] getsample(::YAXArray{Union{Missing, Float32},4,DiskArrayTools.DiskArrayStack{Union{Missing, Float32},4,Zarr.ZArray{Union{Missing, Float32},3,Zarr.BloscCompressor,Zarr.DirectoryStore},1},Array{CubeAxis,1}}, ::String, ::Int64, ::Int64; seed::Int64, nsamples::Int64, wrap::Nothing, inner::Bool) at /home/crem_fe/.julia/dev/ESDLHelpers/src/shapesampling.jl:47
 [6] get_data(::YAXArray{Union{Missing, Float32},4,DiskArrayTools.DiskArrayStack{Union{Missing, Float32},4,Zarr.ZArray{Union{Missing, Float32},3,Zarr.BloscCompressor,Zarr.DirectoryStore},1},Array{CubeAxis,1}}, ::String, ::Array{String,1}) at /home/crem_fe/Documents/papers_wip/EMDAmazonas/scripts/intro_sorted.jl:74
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant