Library
Documentation for SpineInterface.jl.
Contents
Index
SpineInterface.anythingSpineInterface.AnythingSpineInterface.ObjectSpineInterface.ObjectClassSpineInterface.ParameterSpineInterface.RelationshipClassSpineInterface.TimeSliceSpineInterface.TimeSliceSpineInterface.beforeSpineInterface.durationSpineInterface.indicesSpineInterface.iscontainedSpineInterface.overlap_durationSpineInterface.overlapsSpineInterface.t_highest_resolutionSpineInterface.t_lowest_resolutionSpineInterface.using_spinedb
Types
Missing docstring for ObjectLike. Check Documenter's build log for details.
SpineInterface.Object — Type.ObjectA type for representing an object in a Spine db.
SpineInterface.TimeSlice — Type.TimeSliceA type for representing a slice of time.
SpineInterface.Anything — Type.AnythingA type with no fields that is the type of anything.
Functions
SpineInterface.using_spinedb — Method.using_spinedb(db_url::String, mod=@__MODULE__; upgrade=false)Extend module mod with convenience functions to access the contents of the Spine db at the given RFC-1738 url. If upgrade is true, then the database is upgraded to the latest revision.
See ObjectClass(), RelationshipClass(), and Parameter() for details on how to call the convenience functors.
SpineInterface.ObjectClass — Method.(<oc>::ObjectClass)(;<keyword arguments>)An Array of Object instances corresponding to the objects in class oc.
Arguments
For each parameter associated to oc in the database there is a keyword argument named after it. The purpose is to filter the result by specific values of that parameter.
Examples
julia> using SpineInterface;
julia> url = "sqlite:///" * joinpath(dirname(pathof(SpineInterface)), "..", "examples/data/example.sqlite");
julia> using_spinedb(url)
julia> sort(node())
5-element Array{Object,1}:
Dublin
Espoo
Leuven
Nimes
Sthlm
julia> commodity(state_of_matter=:gas)
1-element Array{Object,1}:
wind
SpineInterface.RelationshipClass — Method.(<rc>::RelationshipClass)(;<keyword arguments>)An Array of Object tuples corresponding to the relationships of class rc.
Arguments
- For each object class in
rcthere is a keyword argument named after it. The purpose is to filter the result by an object or list of objects of that class, or to accept all objects of that class by specifyinganythingfor this argument. _compact::Bool=true: whether or not filtered object classes should be removed from the resulting tuples._default=[]: the default value to return in case no relationship passes the filter.
Examples
julia> using SpineInterface;
julia> url = "sqlite:///" * joinpath(dirname(pathof(SpineInterface)), "..", "examples/data/example.sqlite");
julia> using_spinedb(url)
julia> sort(node__commodity())
5-element Array{NamedTuple,1}:
(node = Dublin, commodity = wind)
(node = Espoo, commodity = wind)
(node = Leuven, commodity = wind)
(node = Nimes, commodity = water)
(node = Sthlm, commodity = water)
julia> node__commodity(commodity=:water)
2-element Array{Object,1}:
Nimes
Sthlm
julia> node__commodity(node=(:Dublin, :Espoo))
1-element Array{Object,1}:
wind
julia> sort(node__commodity(node=anything))
2-element Array{Object,1}:
water
wind
julia> sort(node__commodity(commodity=:water, _compact=false))
2-element Array{NamedTuple,1}:
(node = Nimes, commodity = water)
(node = Sthlm, commodity = water)
julia> node__commodity(commodity=:gas, _default=:nogas)
:nogas
SpineInterface.Parameter — Method.(<p>::Parameter)(;<keyword arguments>)The value of parameter p for a given object or relationship.
Arguments
- For each object class associated with
pthere is a keyword argument named after it. The purpose is to retrieve the value ofpfor a specific object. - For each relationship class associated with
p, there is a keyword argument named after each of the object classes involved in it. The purpose is to retrieve the value ofpfor a specific relationship. i::Int64: a specific index to retrieve in case of an array value (ignored otherwise).t::TimeSlice: a specific time-index to retrieve in case of a time-varying value (ignored otherwise).inds: indexes for navigating aMap(ignored otherwise). Tuples correspond to navigating nestedMaps._strict::Bool: whether to raise an error or returnnothingif the parameter is not specified for the given arguments.
Examples
julia> using SpineInterface;
julia> url = "sqlite:///" * joinpath(dirname(pathof(SpineInterface)), "..", "examples/data/example.sqlite");
julia> using_spinedb(url)
julia> tax_net_flow(node=:Sthlm, commodity=:water)
4
julia> demand(node=:Sthlm, i=1)
21
SpineInterface.indices — Method.indices(p::Parameter; kwargs...)An iterator over all objects and relationships where the value of p is different than nothing.
Arguments
- For each object class where
pis defined, there is a keyword argument named after it; similarly, for each relationship class wherepis defined, there is a keyword argument named after each object class in it. The purpose of these arguments is to filter the result by an object or list of objects of an specific class, or to accept all objects of that class by specifyinganythingfor the corresponding argument.
Examples
julia> using SpineInterface;
julia> url = "sqlite:///" * joinpath(dirname(pathof(SpineInterface)), "..", "examples/data/example.sqlite");
julia> using_spinedb(url)
julia> collect(indices(tax_net_flow))
1-element Array{NamedTuple{(:commodity, :node),Tuple{Object,Object}},1}:
(commodity = water, node = Sthlm)
julia> collect(indices(demand))
5-element Array{Object,1}:
Nimes
Sthlm
Leuven
Espoo
Dublin
SpineInterface.TimeSlice — Method.TimeSlice(start::DateTime, end_::DateTime)Construct a TimeSlice with bounds given by start and end_.
SpineInterface.duration — Method.duration(t::TimeSlice)The duration of time slice t.
SpineInterface.before — Method.before(a::TimeSlice, b::TimeSlice)Determine whether the end point of a is exactly the start point of b.
SpineInterface.iscontained — Method.iscontained(b, a)Determine whether b is contained in a.
SpineInterface.overlaps — Method.overlaps(a::TimeSlice, b::TimeSlice)Determine whether a and b overlap.
SpineInterface.overlap_duration — Method.overlap_duration(a::TimeSlice, b::TimeSlice)The duration of the period where a and b overlap.
SpineInterface.t_lowest_resolution — Method.t_lowest_resolution(t_iter)Return an Array containing only time slices from t_iter that aren't contained in any other.
SpineInterface.t_highest_resolution — Method.t_highest_resolution(t_iter)Return an Array containing only time slices from t_iter that do not contain any other.
Missing docstring for write_parameters(::Any, ::String). Check Documenter's build log for details.
Constants
SpineInterface.anything — Constant.anythingThe singleton instance of type Anything, used to specify all-pass filters in calls to RelationshipClass().