Skip to content

Commit

Permalink
Merge pull request #385 from NREL-Sienna/jd/improve_ts_message_print
Browse files Browse the repository at this point in the history
use Dates.canonicalize in error messages
  • Loading branch information
jd-lara authored Jul 1, 2024
2 parents 86620ff + 5a87f42 commit dce97a7
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/system_data.jl
Original file line number Diff line number Diff line change
Expand Up @@ -577,7 +577,7 @@ with the given horizon and interval.
Throw ConflictingInputsError if any time series cannot be converted.
Return a Vector of NamedTuple of component, time series metadata, and forecast parameters
for all matches.
for all matches.
"""
function _check_transform_single_time_series(
data::SystemData,
Expand Down Expand Up @@ -620,15 +620,15 @@ function _check_single_time_series_transformed_parameters(
if desired_horizon > max_horizon
throw(
ConflictingInputsError(
"desired horizon = $desired_horizon is greater than max horizon = $max_horizon",
"TimeSeries: $(get_name(metadata)) desired horizon = $(Dates.canonicalize(desired_horizon)) is greater than max horizon = $(Dates.canonicalize(max_horizon))",
),
)
end

if desired_horizon % resolution != Dates.Millisecond(0)
throw(
ConflictingInputsError(
"desired horizon = $desired_horizon is not evenly divisible by resolution = $resolution",
"TimeSeries: $(get_name(metadata)) desired horizon = $(Dates.canonicalize(desired_horizon)) is not evenly divisible by resolution = $(Dates.canonicalize(resolution))",
),
)
end
Expand All @@ -637,11 +637,11 @@ function _check_single_time_series_transformed_parameters(
max_interval = desired_horizon
if len == horizon_count && desired_interval == max_interval
desired_interval = Dates.Second(0)
@warn "There is only one forecast window. Setting interval = $desired_interval"
@warn "There is only one forecast window. Setting interval = $(Dates.canonicalize(desired_interval))"
elseif desired_interval > max_interval
throw(
ConflictingInputsError(
"interval = $desired_interval is bigger than the max of $max_interval",
"TimeSeries: $(get_name(metadata)) interval = $(Dates.canonicalize(desired_interval)) is bigger than the max of $(Dates.canonicalize(max_interval))",
),
)
end
Expand Down

0 comments on commit dce97a7

Please sign in to comment.