1
1
"""
2
- Timeseries {D, Ω, I, T, TT} <: AbstractDiagnostic
2
+ TimeSeries {D, Ω, I, T, TT} <: AbstractDiagnostic
3
3
4
- A diagnostic for collecting and storing timeseries .
4
+ A diagnostic for collecting and storing time series .
5
5
"""
6
- struct Timeseries {D, Ω, I, T, TT} <: AbstractDiagnostic
6
+ struct TimeSeries {D, Ω, I, T, TT} <: AbstractDiagnostic
7
7
diagnostic :: D
8
8
frequency :: Ω
9
9
interval :: I
@@ -12,16 +12,16 @@ struct Timeseries{D, Ω, I, T, TT} <: AbstractDiagnostic
12
12
end
13
13
14
14
"""
15
- Timeseries (diagnostic, model; frequency=nothing, interval=nothing)
15
+ TimeSeries (diagnostic, model; frequency=nothing, interval=nothing)
16
16
17
- A `Timeseries ` `Diagnostic` that records a time series of `diagnostic(model)`.
17
+ A `TimeSeries ` `Diagnostic` that records a time series of `diagnostic(model)`.
18
18
19
19
Example
20
20
=======
21
21
```julia
22
22
julia> model = Model(grid=RegularCartesianGrid(size=(16, 16, 16), length=(1, 1, 1)));
23
23
24
- julia> max_u = Timeseries (FieldMaximum(abs, model.velocities.u), model; frequency=1)
24
+ julia> max_u = TimeSeries (FieldMaximum(abs, model.velocities.u), model; frequency=1)
25
25
26
26
julia> model.diagnostics[:max_u] = max_u; data(model.velocities.u) .= π; time_step!(model, Nt=3, Δt=1e-16)
27
27
@@ -32,32 +32,32 @@ julia> max_u.data
32
32
3.1415925323439517
33
33
```
34
34
"""
35
- function Timeseries (diagnostic, model; frequency= nothing , interval= nothing )
35
+ function TimeSeries (diagnostic, model; frequency= nothing , interval= nothing )
36
36
TD = typeof (diagnostic (model))
37
37
TT = typeof (model. clock. time)
38
- return Timeseries (diagnostic, frequency, interval, TD[], TT[])
38
+ return TimeSeries (diagnostic, frequency, interval, TD[], TT[])
39
39
end
40
40
41
- @inline (timeseries :: Timeseries )(model) = timeseries . diagnostic (model)
41
+ @inline (time_series :: TimeSeries )(model) = time_series . diagnostic (model)
42
42
43
- function run_diagnostic (model, diag:: Timeseries )
43
+ function run_diagnostic (model, diag:: TimeSeries )
44
44
push! (diag. data, diag (model))
45
45
push! (diag. time, model. clock. time)
46
46
return nothing
47
47
end
48
48
49
49
"""
50
- Timeseries (diagnostics::NamedTuple, model; frequency=nothing, interval=nothing)
50
+ TimeSeries (diagnostics::NamedTuple, model; frequency=nothing, interval=nothing)
51
51
52
- A `Timeseries ` `Diagnostic` that records a `NamedTuple` of time series of
52
+ A `TimeSeries ` `Diagnostic` that records a `NamedTuple` of time series of
53
53
`diag(model)` for each `diag` in `diagnostics`.
54
54
55
55
Example
56
56
=======
57
57
```julia
58
58
julia> model = Model(grid=RegularCartesianGrid(size=(16, 16, 16), length=(1, 1, 1))); Δt = 1.0;
59
59
60
- julia> cfl = Timeseries ((adv=AdvectiveCFL(Δt), diff=DiffusiveCFL(Δt)), model; frequency=1);
60
+ julia> cfl = TimeSeries ((adv=AdvectiveCFL(Δt), diff=DiffusiveCFL(Δt)), model; frequency=1);
61
61
62
62
julia> model.diagnostics[:cfl] = cfl; time_step!(model, Nt=3, Δt=Δt)
63
63
@@ -72,19 +72,19 @@ julia> cfl.adv
72
72
0.0
73
73
```
74
74
"""
75
- function Timeseries (diagnostics:: NamedTuple , model; frequency= nothing , interval= nothing )
75
+ function TimeSeries (diagnostics:: NamedTuple , model; frequency= nothing , interval= nothing )
76
76
TT = typeof (model. clock. time)
77
77
TDs = Tuple (typeof (diag (model)) for diag in diagnostics)
78
78
data = NamedTuple {propertynames(diagnostics)} (Tuple (T[] for T in TDs))
79
- return Timeseries (diagnostics, frequency, interval, data, TT[])
79
+ return TimeSeries (diagnostics, frequency, interval, data, TT[])
80
80
end
81
81
82
- function (timeseries :: Timeseries {<:NamedTuple} )(model)
83
- names = propertynames (timeseries . diagnostic)
84
- return NamedTuple {names} (Tuple (diag (model) for diag in timeseries . diagnostics))
82
+ function (time_series :: TimeSeries {<:NamedTuple} )(model)
83
+ names = propertynames (time_series . diagnostic)
84
+ return NamedTuple {names} (Tuple (diag (model) for diag in time_series . diagnostics))
85
85
end
86
86
87
- function run_diagnostic (model, diag:: Timeseries {<:NamedTuple} )
87
+ function run_diagnostic (model, diag:: TimeSeries {<:NamedTuple} )
88
88
ntuple (Val (length (diag. diagnostic))) do i
89
89
Base. @_inline_meta
90
90
push! (diag. data[i], diag. diagnostic[i](model))
@@ -93,13 +93,13 @@ function run_diagnostic(model, diag::Timeseries{<:NamedTuple})
93
93
return nothing
94
94
end
95
95
96
- Base. getproperty (ts:: Timeseries {<:NamedTuple} , name:: Symbol ) = get_timeseries_field (ts, name)
96
+ Base. getproperty (ts:: TimeSeries {<:NamedTuple} , name:: Symbol ) = get_time_series_field (ts, name)
97
97
98
- " Returns a field of timeseries , or a field of `timeseries .data` when possible."
99
- function get_timeseries_field (timeseries , name)
100
- if name ∈ propertynames (timeseries )
101
- return getfield (timeseries , name)
98
+ " Returns a field of time series , or a field of `time_series .data` when possible."
99
+ function get_time_series_field (time_series , name)
100
+ if name ∈ propertynames (time_series )
101
+ return getfield (time_series , name)
102
102
else
103
- return getproperty (timeseries . data, name)
103
+ return getproperty (time_series . data, name)
104
104
end
105
105
end
0 commit comments