source("setup.R", echo = FALSE)
= get_bb(form = 'polygon')
bb = rnaturalearth::ne_coastline(scale = 'large', returnclass = 'sf') |>
coast ::st_geometry()
sf= read_predictors(quick = TRUE)
preds = read_ensemble("data/model/tidysdm/v1_ensemble.rds") ensemble
tidysdm-05-prediction
We can predict one “layer” at a time - that is for one date. Here we get the first date.
= stars::st_get_dimension_values(preds, "time")
times = predict_rasters(ensemble, slice(preds, "time", 1))
p plot(p, reset = FALSE, zlim = c(0,1), main = format(times[1], "%Y-%m-%d"),
breaks = seq(from = 0, to = 1, by = 0.1),
axes = TRUE)
plot(coast, add = TRUE, col = "orange")
We can try a series of dates. Here’s the first year of our data collection used to make monthly predictions.
= predict_rasters(ensemble, slice(preds, "time", seq_len(12))) p
And we can plot a timeseries of rasters. Using a “hook” function allows us to decorate each subplot, in this case by drawing the coastline.
= function(...){
plot_coast plot(coast, add = TRUE, col = "orange")
}
plot(p,
breaks = seq(from = 0, to = 1, by = 0.1),
hook = plot_coast)
So, is that believable? The likelihood of a reported sighting is highest in winter in the Guld of Maine. Ummmm…
Back to top