An encoder that ends in global pooling discards when a thermal event happened, so the position of a bin in the year has to be given to it as input if it is to be used at all. These two channels carry that position as the sine and cosine of the bin's fractional place in the year, which is continuous across the turn of the year where the fraction itself is not.
Arguments
- x
A
grain_matrix()result. Alookback_matrix()result has no place in the calendar and is refused.
Value
An array of the same units and bins with two channels, year_sin and year_cos,
identical across units. Combine it with the readings using bind_channels().
Details
They are the time index of each bin, not a summary of the readings, so adding them introduces no hand-built thermal feature: whatever a model does with them it could have done with a calendar.
The position is read at the midpoint of the record each bin holds, on the Gregorian calendar in
UTC, so a bin the record only partly covers sits at the phase it was actually measured over.
inst/spec/representation.md is the normative description.
Examples
t <- seq(as.POSIXct("2021-09-01", tz = "UTC"), by = "hour", length.out = 24 * 400)
d <- data.frame(plot = "a", t = t, temp = sin(seq_along(t) / 500))
x <- grain_matrix(d, plot, t, temp, grain = "month")
round(calendar_channels(x)[1, 1:4, ], 3)