Hi,
I use below code to write json file but it shows UndefVarError: writeshortest not defined. Please help me solve this problem! Thank you!
h5open(solution, "r") do f
t = open_dataset(f, "t")[:]
v = open_dataset(f, "v")
maxv_l = similar(t)
maxv_r = similar(t)
@showprogress "Iterating max velocity" for i ∈ range(1, length=length(t))
v_tmp = v[:,:,i]
maxv_l[i] = maximum(v_tmp[patch_l])
maxv_r[i] = maximum(v_tmp[patch_r])
end
content = Dict(
:t => t,
:maxv_l => maxv_l,
:maxv_r => maxv_r,
)
open(catalog, "w") do io
JSON3.write(io, content)
end
The error is below,
UndefVarError: writeshortest not defined
Stacktrace:
[1] getproperty
@ .\Base.jl:35 [inlined]
[2] write(::StructTypes.NumberType, buf::Vector{UInt8}, pos::Int64, len::Int64, x::Float64; allow_inf::Bool, kw::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
@ JSON3 C:\Users\student.julia\packages\JSON3\GoF7x\src\write.jl:236
[3] write
@ C:\Users\student.julia\packages\JSON3\GoF7x\src\write.jl:225 [inlined]
[4] write(::StructTypes.ArrayType, buf::Vector{UInt8}, pos::Int64, len::Int64, x::Vector{Float64}; kw::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
@ JSON3 C:\Users\student.julia\packages\JSON3\GoF7x\src\write.jl:169
[5] write(::StructTypes.ArrayType, buf::Vector{UInt8}, pos::Int64, len::Int64, x::Vector{Float64})
@ JSON3 C:\Users\student.julia\packages\JSON3\GoF7x\src\write.jl:165
[6] write(::StructTypes.DictType, buf::Vector{UInt8}, pos::Int64, len::Int64, x::Dict{Symbol, Vector{Float64}}; kw::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
@ JSON3 C:\Users\student.julia\packages\JSON3\GoF7x\src\write.jl:155
[7] write
@ C:\Users\student.julia\packages\JSON3\GoF7x\src\write.jl:146 [inlined]
[8] write(io::IOStream, obj::Dict{Symbol, Vector{Float64}}; kw::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
@ JSON3 C:\Users\student.julia\packages\JSON3\GoF7x\src\write.jl:32
[9] write
@ C:\Users\student.julia\packages\JSON3\GoF7x\src\write.jl:30 [inlined]
[10] #266
@ .\In[29]:31 [inlined]
[11] open(::var"#266#268"{Dict{Symbol, Vector{Float64}}}, ::String, ::Vararg{String}; kwargs::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
@ Base .\io.jl:330
[12] open(::Function, ::String, ::String)
@ Base .\io.jl:328
[13] (::var"#265#267")(f::HDF5.File)
@ Main .\In[29]:30
[14] h5open(::var"#265#267", ::String, ::Vararg{String}; swmr::Bool, pv::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
@ HDF5 C:\Users\student.julia\packages\HDF5\I9NLZ\src\HDF5.jl:303
[15] h5open(::Function, ::String, ::String)
@ HDF5 C:\Users\student.julia\packages\HDF5\I9NLZ\src\HDF5.jl:301
[16] top-level scope
@ In[29]:14
[17] eval
@ .\boot.jl:373 [inlined]
[18] include_string(mapexpr::typeof(REPL.softscope), mod::Module, code::String, filename::String)
@ Base .\loading.jl:1196