File tree Expand file tree Collapse file tree 2 files changed +12
-5
lines changed Expand file tree Collapse file tree 2 files changed +12
-5
lines changed Original file line number Diff line number Diff line change @@ -19,7 +19,7 @@ import ClimaUtilities.TimeVaryingInputs: extrapolation_bc
19
19
20
20
import ClimaUtilities. TimeVaryingInputs
21
21
22
- import ClimaUtilities. TimeManager: ITime, date
22
+ import ClimaUtilities. TimeManager: ITime, date, epoch
23
23
using Dates
24
24
25
25
"""
@@ -105,12 +105,12 @@ function TimeVaryingInputs.TimeVaryingInput(
105
105
" LinearPeriodFillingInterpolation is not supported when the input data is 1D" ,
106
106
)
107
107
end
108
-
108
+ if eltype (times) <: ITime && eltype (times) isa UnionAll
109
+ times = [promote (times... )... ]
110
+ end
109
111
if extrapolation_bc (method) isa PeriodicCalendar
110
112
if extrapolation_bc (method) isa PeriodicCalendar{Nothing}
111
- if ! isequispaced (
112
- eltype (times) <: ITime ? [float .(promote (times... ))... ] : times,
113
- )
113
+ if ! isequispaced (eltype (times) <: ITime ? float .(times) : times)
114
114
error (
115
115
" PeriodicCalendar() boundary condition cannot be used because data is defined at non uniform intervals of time" ,
116
116
)
Original file line number Diff line number Diff line change 76
76
method = TimeVaryingInputs. LinearPeriodFillingInterpolation (),
77
77
)
78
78
79
+ # test promote when some input times do not contain an epoch
80
+ promotion_tvi = TimeVaryingInputs. TimeVaryingInput (
81
+ [ITime (0 ; epoch = DateTime (2010 )), ITime (1 )],
82
+ ys,
83
+ )
84
+ @test all (t -> t. epoch == DateTime (2010 ), promotion_tvi. times)
85
+
79
86
# Test PeriodicCalendar with non simple duration
80
87
@test_throws ErrorException TimeVaryingInputs. PeriodicCalendar (
81
88
Month (2 ),
You can’t perform that action at this time.
0 commit comments