InfrastructureModels.jl
InfrastructureModels.jl copied to clipboard
summary for dictionaries with non-integer keys
It would be nice if the summary function also works when the keys are strings, e.g. as it is in PMD engineering data model.
Here's an example that breaks (file in PMD/test/data):
import InfrastructureModels
using PowerModelsDistribution
file = "case3_balanced.dss"
eng = parse_file(file)
InfrastructureModels.summary(stdout,eng)
results in
julia> InfrastructureModels.summary(stdout,eng)
Metadata
conductor_ids: [(4)]
data_model: ENGINEERING
files: [(1)]
name: 3bus_example
settings: {(5)}
Table Counts
bus: 3
line: 2
linecode: 2
load: 3
time_series: 1
voltage_source: 1
Table: bus
grounded, rg, terminals, xg
ERROR: ArgumentError: invalid base 10 digit 's' in "sourcebus"
Stacktrace:
[1] tryparse_internal(#unused#::Type{Int64}, s::String, startpos::Int64, endpos::Int64, base_::Int64, raise::Bool)
@ Base ./parse.jl:137
[2] parse(::Type{Int64}, s::String; base::Nothing)
@ Base ./parse.jl:241
[3] parse
@ ./parse.jl:241 [inlined]
[4] #43
@ ~/.julia/packages/InfrastructureModels/KOVFf/src/core/data.jl:400 [inlined]
[5] lt
@ ./ordering.jl:111 [inlined]
[6] sort!(v::Vector{String}, lo::Int64, hi::Int64, #unused#::Base.Sort.InsertionSortAlg, o::Base.Order.By{InfrastructureModels.var"#43#53", Base.Order.ForwardOrdering})
@ Base.Sort ./sort.jl:507
[7] sort!(v::Vector{String}, lo::Int64, hi::Int64, a::Base.Sort.MergeSortAlg, o::Base.Order.By{InfrastructureModels.var"#43#53", Base.Order.ForwardOrdering}, t::Vector{String})
@ Base.Sort ./sort.jl:592
[8] sort!
@ ./sort.jl:591 [inlined]
[9] sort!
@ ./sort.jl:662 [inlined]
[10] #sort!#8
@ ./sort.jl:723 [inlined]
[11] #sort#9
@ ./sort.jl:770 [inlined]
[12] summary(io::Base.TTY, data::Dict{String, Any}; float_precision::Int64, component_types_order::Dict{Any, Any}, component_parameter_order::Dict{Any, Any}, max_parameter_value::Float64, component_status_parameters::Set{String})
@ InfrastructureModels ~/.julia/packages/InfrastructureModels/KOVFf/src/core/data.jl:400
[13] summary(io::Base.TTY, data::Dict{String, Any})
@ InfrastructureModels ~/.julia/packages/InfrastructureModels/KOVFf/src/core/data.jl:279
[14] top-level scope
@ REPL[17]:1
Not sure what the preferred way of fixing this is.