Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions src/base.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1969,28 +1969,34 @@ when actual forecasts are unavailable, without unnecessarily duplicating data.

If all `SingleTimeSeries` instances cannot be transformed then none will be.

Any existing `DeterministicSingleTimeSeries` forecasts will be deleted even if the inputs are
invalid.
By default, any existing `DeterministicSingleTimeSeries` forecasts will be deleted before the
transform (`delete_existing = true`). Set `delete_existing = false` to preserve existing
`DeterministicSingleTimeSeries`; entries with matching name, resolution, features, horizon,
and interval are skipped, allowing multiple calls with different resolutions to coexist.

# Arguments
- `sys::System`: System containing the components.
- `horizon::Dates.Period`: desired [horizon](@ref H) of each forecast [window](@ref W)
- `interval::Dates.Period`: desired [interval](@ref I) between forecast [windows](@ref W)
- `resolution::Union{Nothing, Dates.Period} = nothing`: If set, only transform time series
with this resolution.
- `delete_existing::Bool = true`: If `true`, delete all existing
`DeterministicSingleTimeSeries` before transforming.
"""
function transform_single_time_series!(
sys::System,
horizon::Dates.Period,
interval::Dates.Period;
resolution::Union{Nothing, Dates.Period} = nothing,
delete_existing::Bool = true,
Comment on lines 1986 to +1991
Copy link

Copilot AI Apr 3, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

New delete_existing keyword behavior is user-facing but currently has no direct test coverage. Consider adding a test that (1) creates a System with existing DeterministicSingleTimeSeries, (2) calls transform_single_time_series! with delete_existing=false and asserts existing forecasts remain and duplicates are skipped, and (3) calls with the default (true) and asserts forecasts are removed/replaced. This will prevent regressions in the wrapper/forwarding behavior.

Copilot uses AI. Check for mistakes.
)
IS.transform_single_time_series!(
sys.data,
IS.DeterministicSingleTimeSeries,
horizon,
interval;
resolution = resolution,
delete_existing = delete_existing,
)
return
end
Expand Down
Loading