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

Fix show of very large GeoTable #396

Closed
juliohm opened this issue Feb 14, 2024 · 1 comment
Closed

Fix show of very large GeoTable #396

juliohm opened this issue Feb 14, 2024 · 1 comment

Comments

@juliohm
Copy link
Member

juliohm commented Feb 14, 2024

MWE:

julia> grid = CartesianGrid(1000, 1000, 1000)
1000×1000×1000 CartesianGrid{3,Float64}
  minimum: Point(0.0, 0.0, 0.0)
  maximum: Point(1000.0, 1000.0, 1000.0)
  spacing: (1.0, 1.0, 1.0)

julia> vgrid = view(grid, 1:200000000)
200000000 view(::CartesianGrid{3,Float64}, 1:200000000)
├─ Hexahedron((0.0, 0.0, 0.0), ..., (0.0, 1.0, 1.0))
├─ Hexahedron((1.0, 0.0, 0.0), ..., (1.0, 1.0, 1.0))
├─ Hexahedron((2.0, 0.0, 0.0), ..., (2.0, 1.0, 1.0))
├─ Hexahedron((3.0, 0.0, 0.0), ..., (3.0, 1.0, 1.0))
├─ Hexahedron((4.0, 0.0, 0.0), ..., (4.0, 1.0, 1.0))

├─ Hexahedron((995.0, 999.0, 199.0), ..., (995.0, 1000.0, 200.0))
├─ Hexahedron((996.0, 999.0, 199.0), ..., (996.0, 1000.0, 200.0))
├─ Hexahedron((997.0, 999.0, 199.0), ..., (997.0, 1000.0, 200.0))
├─ Hexahedron((998.0, 999.0, 199.0), ..., (998.0, 1000.0, 200.0))
└─ Hexahedron((999.0, 999.0, 199.0), ..., (999.0, 1000.0, 200.0))

julia> georef((a=rand(200000000),), vgrid); # works as expected

julia> georef((a=rand(200000000),), vgrid) # throws OutOfMemoryError()
Error showing value of type GeoTable{@NamedTuple{a::Vector{Float64}}}:
ERROR: OutOfMemoryError()
Stacktrace:
  [1] Array
    @ ./boot.jl:477 [inlined]
  [2] Array
    @ ./boot.jl:486 [inlined]
  [3] similar
    @ ./abstractarray.jl:874 [inlined]
  [4] similar
    @ ./abstractarray.jl:873 [inlined]
  [5] _array_for
    @ ./array.jl:723 [inlined]
  [6] collect(itr::Base.Generator{UnitRange{Int64}, Meshes.var"#125#126"{Meshes.SubDomain{3, Float64, CartesianGrid{3, Float64}, UnitRange{Int64}}}})
    @ Base ./array.jl:839
  [7] eltype
    @ ~/.julia/dev/Meshes/src/domains.jl:46 [inlined]
  [8] (::GeoTables.var"#5#6"{@NamedTuple{a::Vector{Float64}}, Meshes.SubDomain{3, Float64, CartesianGrid{3, Float64}, UnitRange{Int64}}})(name::Symbol)
    @ GeoTables ~/.julia/packages/GeoTables/XDtOm/src/abstractgeotable.jl:180
  [9] iterate(g::Base.Generator, s::Vararg{Any})
    @ Base ./generator.jl:47 [inlined]
 [10] collect_to!(dest::AbstractArray{T}, itr::Any, offs::Any, st::Any) where T
    @ Base ./array.jl:892 [inlined]
 [11] collect_to_with_first!(dest::AbstractArray, v1::Any, itr::Any, st::Any)
    @ Base ./array.jl:870 [inlined]
 [12] _collect(c::Vector{Symbol}, itr::Base.Generator{Vector{Symbol}, GeoTables.var"#5#6"{@NamedTuple{…}, Meshes.SubDomain{…}}}, ::Base.EltypeUnknown, isz::Base.HasShape{1})
    @ Base ./array.jl:864
 [13] collect_similar(cont::Vector{Symbol}, itr::Base.Generator{Vector{Symbol}, GeoTables.var"#5#6"{@NamedTuple{…}, Meshes.SubDomain{…}}})
    @ Base ./array.jl:763
 [14] map(f::Function, A::Vector{Symbol})
    @ Base ./abstractarray.jl:3282
 [15] _common_kwargs(geotable::GeoTable{@NamedTuple{a::Vector{Float64}}})
    @ GeoTables ~/.julia/packages/GeoTables/XDtOm/src/abstractgeotable.jl:178
 [16] show(io::IOContext{Base.TTY}, ::MIME{Symbol("text/plain")}, geotable::GeoTable{@NamedTuple{a::Vector{Float64}}})
    @ GeoTables ~/.julia/packages/GeoTables/XDtOm/src/abstractgeotable.jl:155
 [17] (::OhMyREPL.var"#15#16"{REPL.REPLDisplay{REPL.LineEditREPL}, MIME{Symbol("text/plain")}, Base.RefValue{Any}})(io::IOContext{Base.TTY})
    @ OhMyREPL ~/.julia/packages/OhMyREPL/gIS2Z/src/output_prompt_overwrite.jl:23
 [18] with_repl_linfo(f::Any, repl::REPL.LineEditREPL)
    @ REPL ~/.julia/juliaup/julia-1.10.0+0.x64.linux.gnu/share/julia/stdlib/v1.10/REPL/src/REPL.jl:569
 [19] display
    @ OhMyREPL ~/.julia/packages/OhMyREPL/gIS2Z/src/output_prompt_overwrite.jl:6 [inlined]
 [20] display(d::REPL.REPLDisplay, x::Any)
    @ REPL ~/.julia/juliaup/julia-1.10.0+0.x64.linux.gnu/share/julia/stdlib/v1.10/REPL/src/REPL.jl:278
 [21] display(x::Any)
    @ Base.Multimedia ./multimedia.jl:340
 [22] #invokelatest#2
    @ ./essentials.jl:887 [inlined]
 [23] invokelatest
    @ ./essentials.jl:884 [inlined]
 [24] print_response(errio::IO, response::Any, show_value::Bool, have_color::Bool, specialdisplay::Union{Nothing, AbstractDisplay})
    @ REPL ~/.julia/juliaup/julia-1.10.0+0.x64.linux.gnu/share/julia/stdlib/v1.10/REPL/src/REPL.jl:315
 [25] (::REPL.var"#57#58"{REPL.LineEditREPL, Pair{Any, Bool}, Bool, Bool})(io::Any)
    @ REPL ~/.julia/juliaup/julia-1.10.0+0.x64.linux.gnu/share/julia/stdlib/v1.10/REPL/src/REPL.jl:284
 [26] with_repl_linfo(f::Any, repl::REPL.LineEditREPL)
    @ REPL ~/.julia/juliaup/julia-1.10.0+0.x64.linux.gnu/share/julia/stdlib/v1.10/REPL/src/REPL.jl:569
 [27] print_response(repl::REPL.AbstractREPL, response::Any, show_value::Bool, have_color::Bool)
    @ REPL ~/.julia/juliaup/julia-1.10.0+0.x64.linux.gnu/share/julia/stdlib/v1.10/REPL/src/REPL.jl:282
 [28] (::REPL.var"#do_respond#80"{Bool, Bool, REPL.var"#93#103"{}, REPL.LineEditREPL, REPL.LineEdit.Prompt})(s::REPL.LineEdit.MIState, buf::Any, ok::Bool)
    @ REPL ~/.julia/juliaup/julia-1.10.0+0.x64.linux.gnu/share/julia/stdlib/v1.10/REPL/src/REPL.jl:911
 [29] (::VSCodeServer.var"#101#104"{REPL.var"#do_respond#80"{}})(mi::REPL.LineEdit.MIState, buf::IOBuffer, ok::Bool)
    @ VSCodeServer ~/.vscode/extensions/julialang.language-julia-1.66.2/scripts/packages/VSCodeServer/src/repl.jl:122
 [30] #invokelatest#2
    @ Base ./essentials.jl:887 [inlined]
 [31] invokelatest
    @ Base ./essentials.jl:884 [inlined]
 [32] run_interface(terminal::REPL.Terminals.TextTerminal, m::REPL.LineEdit.ModalInterface, s::REPL.LineEdit.MIState)
    @ REPL.LineEdit ~/.julia/juliaup/julia-1.10.0+0.x64.linux.gnu/share/julia/stdlib/v1.10/REPL/src/LineEdit.jl:2656
 [33] run_frontend(repl::REPL.LineEditREPL, backend::REPL.REPLBackendRef)
    @ REPL ~/.julia/juliaup/julia-1.10.0+0.x64.linux.gnu/share/julia/stdlib/v1.10/REPL/src/REPL.jl:1312
 [34] (::REPL.var"#62#68"{REPL.LineEditREPL, REPL.REPLBackendRef})()
    @ REPL ~/.julia/juliaup/julia-1.10.0+0.x64.linux.gnu/share/julia/stdlib/v1.10/REPL/src/REPL.jl:386
Some type information was truncated. Use `show(err)` to see complete types.
@juliohm
Copy link
Member Author

juliohm commented Feb 14, 2024

Fixed on master.

@juliohm juliohm closed this as completed Feb 14, 2024
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