NREL-Sienna / InfrastructureSystems.jl

Utility package for Sienna's simulation infrastructure
https://nrel-sienna.github.io/InfrastructureSystems.jl/
BSD 3-Clause "New" or "Revised" License
39 stars 20 forks source link

Fix printing of TimeSeriesData length in `summary` #210

Closed nickrobinson251 closed 3 years ago

nickrobinson251 commented 3 years ago

Setup:

julia> using InfrastructureSystems, TimeSeries, Dates

julia> resolution = Dates.Hour(1);

julia> dates = range(DateTime("2020-01-01T00:00:00"), step = resolution, length = 2);

julia> data = TimeArray(dates, ones(2));

On master:

julia> InfrastructureSystems.SingleTimeSeries("max_active_power", data)
InfrastructureSystems.SingleTimeSeries time_series (length(time_series)):
   name: max_active_power
   data: 2×1 TimeArray{Float64, 1, DateTime, Vector{Float64}} 2020-01-01T00:00:00 to 2020-01-01T01:00:00
│                     │ A     │
├─────────────────────┼───────┤
│ 2020-01-01T00:00:00 │ 1.0   │
│ 2020-01-01T01:00:00 │ 1.0   │
   scaling_factor_multiplier: nothing

(note the summary line has time_series (length(time_series)):)

This PR:

julia> time_series = InfrastructureSystems.SingleTimeSeries("max_active_power", data)
InfrastructureSystems.SingleTimeSeries time_series (2):
   name: max_active_power
   data: 2×1 TimeArray{Float64, 1, DateTime, Vector{Float64}} 2020-01-01T00:00:00 to 2020-01-01T01:00:00
│                     │ A     │
├─────────────────────┼───────┤
│ 2020-01-01T00:00:00 │ 1.0   │
│ 2020-01-01T01:00:00 │ 1.0   │
   scaling_factor_multiplier: nothing
codecov[bot] commented 3 years ago

Codecov Report

Merging #210 (07148b0) into master (0789221) will increase coverage by 0.12%. The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #210      +/-   ##
==========================================
+ Coverage   74.69%   74.81%   +0.12%     
==========================================
  Files          42       42              
  Lines        3027     3022       -5     
==========================================
  Hits         2261     2261              
+ Misses        766      761       -5     
Flag Coverage Δ
unittests 74.81% <100.00%> (+0.12%) :arrow_up:

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
src/utils/print.jl 36.70% <100.00%> (+3.37%) :arrow_up:
src/InfrastructureSystems.jl 60.00% <0.00%> (-6.67%) :arrow_down:
src/internal.jl 74.46% <0.00%> (-2.13%) :arrow_down:
src/utils/utils.jl 59.83% <0.00%> (-0.84%) :arrow_down:
src/utils/lazy_dict_from_iterator.jl 96.15% <0.00%> (-0.15%) :arrow_down:
src/common.jl 50.00% <0.00%> (+25.00%) :arrow_up: