niclasmattsson / GlobalEnergyGIS

Generates input data for energy models on renewable energy in arbitrary world regions using public datasets. Written in Julia 1.x.
MIT License
64 stars 24 forks source link

Bounds error when creating Antarctica region #7

Open euronion opened 4 years ago

euronion commented 4 years ago

Probably not the most relevant region, but the creation of the region mask for Antarctica fails

julia> aq = ["AQ" GADM("Antarctica")]
1×2 Array{Any,2}:
 "AQ"  GADM{String}(String[], ("Antarctica",))

julia> saveregions("AQ", aq)
Reading GADM rasters...
Making region index matrix...
Progress: 100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| Time: 0:00:51
ERROR: BoundsError: attempt to access 0-element Array{Int64,1} at index [2]
Stacktrace:
 [1] getindex at ./array.jl:788 [inlined]
 [2] dataindexes_lon at /home/<user>/.julia/packages/GlobalEnergyGIS/gFPzK/src/helperfunctions.jl:211 [inlined]
 [3] getbboxranges(::Array{Int16,2}, ::Int64) at /home/<user>/.julia/packages/GlobalEnergyGIS/gFPzK/src/helperfunctions.jl:188
 [4] saveregions(::String, ::Array{Any,2}, ::Array{UInt8,2}, ::Bool, ::Array{Int64,2}) at /home/<user>/.julia/packages/GlobalEnergyGIS/gFPzK/src/make_regions.jl:31
 [5] saveregions(::String, ::Array{Any,2}; autocrop::Bool, bbox::Array{Int64,2}) at /home/<user>/.julia/packages/GlobalEnergyGIS/gFPzK/src/make_regions.jl:24
 [6] saveregions(::String, ::Array{Any,2}) at /home/<user>/.julia/packages/GlobalEnergyGIS/gFPzK/src/make_regions.jl:20
 [7] top-level scope at REPL[69]:1

Haven't noticed it with any other major GADM region yet, so probably not all to important.