-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Jd/add infos #316
Jd/add infos #316
Conversation
Co-authored-by: Daniel Thom <daniel.thom@nrel.gov>
Co-authored-by: Daniel Thom <daniel.thom@nrel.gov>
Co-authored-by: Daniel Thom <daniel.thom@nrel.gov>
@daniel-thom I addressed most of the comments. There are a few failing tests related to the time series and the serialization |
Tests are expected to fail on serialization/deserialization |
end | ||
|
||
function TestSupplemental(; | ||
value::Float64 = 0.0, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[JuliaFormatter] reported by reviewdog 🐶
value::Float64 = 0.0, | |
value::Float64=0.0, |
src/utils/test.jl
Outdated
value::Float64 = 0.0, | ||
component_uuids::Set{UUIDs.UUID}=Set{UUIDs.UUID}(), | ||
) | ||
return TestSupplemental(value, component_uuids, InfrastructureSystemsInternal(), TimeSeriesContainer()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[JuliaFormatter] reported by reviewdog 🐶
return TestSupplemental(value, component_uuids, InfrastructureSystemsInternal(), TimeSeriesContainer()) | |
return TestSupplemental( | |
value, | |
component_uuids, | |
InfrastructureSystemsInternal(), | |
TimeSeriesContainer(), | |
) |
test/test_supplemental_attributes.jl
Outdated
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[JuliaFormatter] reported by reviewdog 🐶
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remaining comments which cannot be posted as a review comment to avoid GitHub Rate Limit
src/components.jl
Outdated
data::ComponentsByType | ||
time_series_storage::TimeSeriesStorage | ||
validation_descriptors::Vector | ||
end | ||
|
||
get_display_string(::Components) = "components" | ||
|
||
function Components(time_series_storage::TimeSeriesStorage, validation_descriptors=nothing) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[JuliaFormatter] reported by reviewdog 🐶
function Components(time_series_storage::TimeSeriesStorage, validation_descriptors=nothing) | |
function Components( | |
time_series_storage::TimeSeriesStorage, | |
validation_descriptors = nothing, | |
) |
src/components.jl
Outdated
@@ -388,6 +362,7 @@ function set_name!( | |||
set_name_internal!(component, name) | |||
components.data[T][name] = component | |||
@debug "Changed the name of component $(summary(component))" _group = LOG_GROUP_SYSTEM | |||
return | |||
end | |||
|
|||
function compare_values(x::Components, y::Components; compare_uuids=false) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[JuliaFormatter] reported by reviewdog 🐶
function compare_values(x::Components, y::Components; compare_uuids=false) | |
function compare_values(x::Components, y::Components; compare_uuids = false) |
geo_json::Dict{String, Any}=Dict{String, Any}(), | ||
component_uuids::Set{UUIDs.UUID}=Set{UUIDs.UUID}(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[JuliaFormatter] reported by reviewdog 🐶
geo_json::Dict{String, Any}=Dict{String, Any}(), | |
component_uuids::Set{UUIDs.UUID}=Set{UUIDs.UUID}(), | |
geo_json::Dict{String, Any} = Dict{String, Any}(), | |
component_uuids::Set{UUIDs.UUID} = Set{UUIDs.UUID}(), |
src/supplemental_attributes.jl
Outdated
function _add_supplemental_attribute!( | ||
supplemental_attributes::SupplementalAttributes, | ||
supplemental_attribute::T; | ||
allow_existing_time_series=false, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[JuliaFormatter] reported by reviewdog 🐶
allow_existing_time_series=false, | |
allow_existing_time_series = false, |
src/supplemental_attributes.jl
Outdated
function get_supplemental_attributes( | ||
::Type{T}, | ||
supplemental_attributes::SupplementalAttributes, | ||
filter_func::Union{Nothing, Function}=nothing, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[JuliaFormatter] reported by reviewdog 🐶
filter_func::Union{Nothing, Function}=nothing, | |
filter_func::Union{Nothing, Function} = nothing, |
src/time_series_interface.jl
Outdated
len=len, | ||
ignore_scaling_factors=ignore_scaling_factors, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[JuliaFormatter] reported by reviewdog 🐶
len=len, | |
ignore_scaling_factors=ignore_scaling_factors, | |
len = len, | |
ignore_scaling_factors = ignore_scaling_factors, |
src/time_series_interface.jl
Outdated
start_time::Union{Nothing, Dates.DateTime}=nothing; | ||
len::Union{Nothing, Int}=nothing, | ||
ignore_scaling_factors=false, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[JuliaFormatter] reported by reviewdog 🐶
start_time::Union{Nothing, Dates.DateTime}=nothing; | |
len::Union{Nothing, Int}=nothing, | |
ignore_scaling_factors=false, | |
start_time::Union{Nothing, Dates.DateTime} = nothing; | |
len::Union{Nothing, Int} = nothing, | |
ignore_scaling_factors = false, |
src/time_series_interface.jl
Outdated
len=len, | ||
ignore_scaling_factors=ignore_scaling_factors, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[JuliaFormatter] reported by reviewdog 🐶
len=len, | |
ignore_scaling_factors=ignore_scaling_factors, | |
len = len, | |
ignore_scaling_factors = ignore_scaling_factors, |
src/time_series_interface.jl
Outdated
end | ||
|
||
function _make_time_array(component, time_series, start_time, len, ignore_scaling_factors) | ||
ta = make_time_array(time_series, start_time; len=len) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[JuliaFormatter] reported by reviewdog 🐶
ta = make_time_array(time_series, start_time; len=len) | |
ta = make_time_array(time_series, start_time; len = len) |
src/time_series_interface.jl
Outdated
name_mapping::Union{Nothing, Dict{Tuple{String, String}, String}}=nothing, | ||
scaling_factor_multiplier_mapping::Union{Nothing, Dict{String, String}}=nothing, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[JuliaFormatter] reported by reviewdog 🐶
name_mapping::Union{Nothing, Dict{Tuple{String, String}, String}}=nothing, | |
scaling_factor_multiplier_mapping::Union{Nothing, Dict{String, String}}=nothing, | |
name_mapping::Union{Nothing, Dict{Tuple{String, String}, String}} = nothing, | |
scaling_factor_multiplier_mapping::Union{Nothing, Dict{String, String}} = nothing, |
src/component.jl
Outdated
attribute_container[T] = Set{T}() | ||
end | ||
push!(attribute_container[T], attribute) | ||
@debug "SupplementalAttribute type $T with UUID $(get_uuid(attribute)) stored in component $(get_name(component))" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need a LOG_GROUP for this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These are already implemented.
src/component.jl
Outdated
container = get_supplemental_attributes_container(component) | ||
for attribute_set in values(container) | ||
for i in attribute_set | ||
delete!(get_components_uuids(i), get_uuid(component)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One plural should be sufficient: get_component_uuids
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These are fixed already
src/component.jl
Outdated
if !haskey(container, T) | ||
throw( | ||
ArgumentError( | ||
"supplemental attribute type $T is not stored in component $(get_name(component))", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Related to comments in the last round, I think you should use $(summary(component))
so that the component type shows up in the message.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These are fixed already
attribute::T, | ||
) where {T <: InfrastructureSystemsSupplementalAttribute} | ||
attach_component!(attribute, component) | ||
attribute_container = get_supplemental_attributes_container(component) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can this call attach_component!
? The code here and there is different. It seems not great to modify the attribute inside the component code.
src/system_data.jl
Outdated
for info in attributes | ||
for c_uuid in get_component_uuids(info) | ||
comp = get_component(data, c_uuid) | ||
delete!(get_supplemental_attributes_container(comp), info) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same above, I think this could call a component method.
src/time_series_interface.jl
Outdated
@@ -0,0 +1,606 @@ | |||
const SUPPORTED_TIME_SERIES_TYPES = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For type aliases don’t we normally use pascal case? SupportedTimeSeriesTypes
?
return remove_supplemental_attribute!(data.attributes, info) | ||
end | ||
|
||
function remove_supplemental_attributes!( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have concerns about this function because of the implicit disconnection from components. Since the user can only add attributes through a component, shouldn’t they only be able to remove attributes through a component?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This contradicts previous requests to have a method to do this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This method will clear all attributed of a particular type
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[JuliaFormatter] reported by reviewdog 🐶
in_memory = time_series_in_memory, | |
directory = time_series_directory, | |
compression = compression, |
src/time_series_interface.jl
Outdated
component::SUPPORTED_TIME_SERIES_TYPES, | ||
ts_metadata::T, | ||
ts::TimeSeriesData; | ||
skip_if_present=false, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[JuliaFormatter] reported by reviewdog 🐶
skip_if_present=false, | |
skip_if_present = false, |
src/time_series_interface.jl
Outdated
get_name(ts_metadata), | ||
ts, | ||
) | ||
add_time_series!(component, ts_metadata, skip_if_present=skip_if_present) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[JuliaFormatter] reported by reviewdog 🐶
add_time_series!(component, ts_metadata, skip_if_present=skip_if_present) | |
add_time_series!(component, ts_metadata; skip_if_present = skip_if_present) |
src/utils/print.jl
Outdated
println(io, "==========") | ||
println(io, "Num components: $num_components") | ||
if num_components > 0 | ||
println(io) | ||
show_components_table(io, components, backend=Val(:auto)) | ||
show_components_table(io, container, backend=Val(:auto)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[JuliaFormatter] reported by reviewdog 🐶
show_components_table(io, container, backend=Val(:auto)) | |
show_components_table(io, container; backend = Val(:auto)) |
src/utils/test.jl
Outdated
|
||
function TestSupplemental(; | ||
value::Float64 = 0.0, | ||
component_uuids::Set{UUIDs.UUID}=Set{UUIDs.UUID}(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[JuliaFormatter] reported by reviewdog 🐶
component_uuids::Set{UUIDs.UUID}=Set{UUIDs.UUID}(), | |
component_uuids::Set{UUIDs.UUID} = Set{UUIDs.UUID}(), |
test/test_supplemental_attributes.jl
Outdated
ta = TimeSeries.TimeArray(range(initial_time; length=24, step=resolution), ones(24)) | ||
ts = IS.SingleTimeSeries(data=ta, name="test") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[JuliaFormatter] reported by reviewdog 🐶
ta = TimeSeries.TimeArray(range(initial_time; length=24, step=resolution), ones(24)) | |
ts = IS.SingleTimeSeries(data=ta, name="test") | |
ta = TimeSeries.TimeArray(range(initial_time; length = 24, step = resolution), ones(24)) | |
ts = IS.SingleTimeSeries(; data = ta, name = "test") |
test/test_system_data.jl
Outdated
ta = TimeSeries.TimeArray(range(initial_time; length=24, step=resolution), ones(24)) | ||
ts = IS.SingleTimeSeries(data=ta, name="test") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[JuliaFormatter] reported by reviewdog 🐶
ta = TimeSeries.TimeArray(range(initial_time; length=24, step=resolution), ones(24)) | |
ts = IS.SingleTimeSeries(data=ta, name="test") | |
ta = TimeSeries.TimeArray(range(initial_time; length = 24, step = resolution), ones(24)) | |
ts = IS.SingleTimeSeries(; data = ta, name = "test") |
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #316 +/- ##
==========================================
+ Coverage 78.08% 78.35% +0.27%
==========================================
Files 44 49 +5
Lines 3737 3964 +227
==========================================
+ Hits 2918 3106 +188
- Misses 819 858 +39
Flags with carried forward coverage won't be shown. Click here to find out more.
|
No description provided.