Rescale Methods
Rescale methods define ways of rescaling a trace to match a summary. They are defined to be subtypes of RescaleMethod.
The rescale method itself is defined by extending rescalesinglevariable! for the new type. For example:
struct RescaleMaxChangeMin <: RescaleMethod end
function rescalesinglevariable!(x::AbstractVector,y::Real,::RescaleMaxChangeMin)
rescale = y/maximum(x)
for i in eachindex(x)
@inbounds x[i] *= rescale
end
nothing
endis the implementation for RescaleMaxChangeMin.
The rescaletrace! function will call rescalesinglevariable! on each variable in a trace in turn, it takes a Tuple of RescaleMethods which allows for different rescales for different variables.
Available Methods
HistoricalStormTraceSimulation.RescaleIdentity — TypeRescaleIdentity()A rescale type to represent the identity rescale.
HistoricalStormTraceSimulation.RescaleMaxChangeMin — TypeRescaleMaxChangeMin()Linear rescale to adjust the maximum of the new trace to equal the summary value.
Given a trace variable series $y_j$, and summary value $x_j$, the new trace $\tilde{y}_j$ is constructed using the following rule, $\forall t\in T_y$:
$\tilde y_j(t) = \frac{x_j}{\max\limits_{t\in T_y}y_j(t)}y_j(t).$
HistoricalStormTraceSimulation.RescaleMaxPreserveMin — TypeRescaleMaxPreserveMin()Linear rescale to adjust the maximum of the new trace to equal the summary value whilst preserving the minimum.
Given a trace variable series $y_j$, and summary value $x_j$, the new trace $\tilde{y}_j$ is constructed using the following rule, $\forall t\in T_y$:
$\tilde y_j(t) = \frac{x_j-\min\limits_{t\in T_y} y_j(t)}{\max\limits_{t\in T_y}y_j(t)-\min\limits_{t\in T_y} y_j(t)} \left(y_j(t)-\min\limits_{t\in T_y} y_j(t)\right) + \min\limits_{t\in T_y} y_j(t).$
This only works if the new maximum $x_j$ satisfies $x_j>\min\limits_{t\in T_y} y_j(t)$. The formula is $\forall t\in T_y$. If this condition is not satisfied, a warning will be displayed.
HistoricalStormTraceSimulation.RescaleMean — TypeRescaleMean()Additive rescaling to match the mean of the trace to the summary value.
Given a trace variable series $y_j$, and summary value $x_j$, the new trace
$\tilde y_j(t) = y_j(t) - \overline{y_j} + x_j$
where $\overline{y_j} = \frac{1}{|T_y|} \sum_{t\in T_y}y_j(t)$.
HistoricalStormTraceSimulation.RescaleMeanCircularDeg — TypeRescaleMeanCircularDeg()Rescale the angular mean assuming data is in degrees.
Given a trace variable series $y_j$, and summary value $x_j$, the new trace
$\tilde y_j(t) = y_j(t) - \overline{y_j} + x_j$
where $\overline{y_j} = \arg\left(\frac{1}{|T_y|} \sum_{t\in T_y}\exp\{i y_j(t)\}\right)$.