NetCDF.jl icon indicating copy to clipboard operation
NetCDF.jl copied to clipboard

error showing NcVar with no data

Open visr opened this issue 5 years ago • 1 comments

This is with NetCDF.jl master on Julia 1.4-rc2

julia> using NetCDF

julia> d = NcDim("Dim1", 1)
NcDim(-1, -1, -1, "Dim1", 0x0000000000000001, Any[], Dict{Any,Any}(), false)

julia> v = NcVar("v1", [d])
Disk Array with size 1


julia> @show v
ERROR: NetCDF error code -33:
        NetCDF: Not a valid ID
Stacktrace:
 [1] check at C:\Users\visser_mn\.julia\packages\NetCDF\SFmQh\src\netcdf_helpers.jl:22 [inlined]
 [2] nc_get_vara_double(::Int32, ::Int32, ::Array{UInt64,1}, ::Array{UInt64,1}, ::Array{Float64,1}) at C:\Users\visser_mn\.julia\packages\NetCDF\SFmQh\src\netcdf_c.jl:2486
 [3] nc_get_vara_x! at C:\Users\visser_mn\.julia\packages\NetCDF\SFmQh\src\NetCDF.jl:465 [inlined]
 [4] readvar!(::NcVar{Float64,1,6}, ::Array{Float64,1}; start::Array{Int64,1}, count::Array{Int64,1}) at C:\Users\visser_mn\.julia\packages\NetCDF\SFmQh\src\NetCDF.jl:343
 [5] readblock!(::NcVar{Float64,1,6}, ::Array{Float64,1}, ::UnitRange{Int64}) at C:\Users\visser_mn\.julia\packages\NetCDF\SFmQh\src\NetCDF.jl:218
 [6] getindex_disk at C:\Users\visser_mn\.julia\packages\DiskArrays\RJ0eT\src\DiskArrays.jl:36 [inlined]
 [7] getindex at C:\Users\visser_mn\.julia\packages\DiskArrays\RJ0eT\src\DiskArrays.jl:158 [inlined]
 [8] isassigned(::NcVar{Float64,1,6}, ::Int64) at .\abstractarray.jl:404
 [9] show_delim_array(::IOContext{Base.GenericIOBuffer{Array{UInt8,1}}}, ::NcVar{Float64,1,6}, ::Char, ::String, ::Char, ::Bool, ::Int64, ::Int64) at .\show.jl:712
 [10] show_delim_array at .\show.jl:705 [inlined]
 [11] show_vector(::Base.GenericIOBuffer{Array{UInt8,1}}, ::NcVar{Float64,1,6}, ::Char, ::Char) at .\arrayshow.jl:458
 [12] show_vector at .\arrayshow.jl:447 [inlined]
 [13] show(::Base.GenericIOBuffer{Array{UInt8,1}}, ::NcVar{Float64,1,6}) at .\arrayshow.jl:420
 [14] sprint(::Function, ::NcVar{Float64,1,6}; context::Nothing, sizehint::Int64) at .\strings\io.jl:105
 [15] #repr#339 at .\strings\io.jl:227 [inlined]
 [16] repr(::NcVar{Float64,1,6}) at .\strings\io.jl:227
 [17] top-level scope at show.jl:613

visr avatar Feb 29 '20 23:02 visr

I think this is rather a DiskArrays issue, since this package does not define a show method anymore. I will try to find out which method exactly the @show macro is calling, the stack should never end up in arrayshow.jl

meggart avatar Mar 09 '20 15:03 meggart