mimiframework / Mimi.jl

Integrated Assessment Modeling Framework
https://www.mimiframework.org
Other
66 stars 34 forks source link

Fix small bug in Base.run for models and instances #988

Closed jonas-hass-bonne closed 5 months ago

jonas-hass-bonne commented 6 months ago

The Base.run function allows for an optional keyword argument dim_keys, which (as far as I can tell) allows the user to specify a subset of time periods which the model should be run for.

This keyword argument has the following type-declaration: Union{Nothing, Dict{Symbol, Vector{T} where T <: DimensionKeyTypes}}

However, this type declaration doesn't recognize a supplied value of type Dict{Symbol, Vector{Int64}} as valid since Dict{Symbol, Vector{Int64}} <: Dict{Symbol, Vector{T} where T <: DimensionKeyTypes} returns a value of false, although this is presumably the intended use of the argument.

This PR fixes this by changing the type-declaration to: Union{Nothing, Dict{Symbol, Vector{T}} where T <: DimensionKeyTypes}, which ensures that arguments of the type Dict{Symbol, Vector{Int64}} are recognized as being valid.

This change is made in both the src/core/model.jl and src/core/model.jl files