## ----include = FALSE----------------------------------------------------------
knitr::opts_chunk$set(collapse = TRUE, comment = "#>",
                      fig.width = 6, fig.height = 4.5)

## ----setup, include = FALSE---------------------------------------------------
library(sptrends)
r <- terra::rast(
  sort(list.files(
    example_data("vhp_ndvi"),
    pattern = "\\.tif$",
    full.names = TRUE
  ))
)

## -----------------------------------------------------------------------------
pw <- prewhiten(r, report = FALSE, verbose = FALSE)
pw
summary(pw)

## ----fig.alt = "Spatial diagnostics from selective trend-free prewhitening"----
plot(pw)

