cdmt_int | R Documentation |
This is the internal function called by cdmt
to operate at the pixel level.
cdmt_int( x, nb, ny, yrs, ev = NA, dir, th_const = 1.2, noise_rm = TRUE, as_list = FALSE )
x |
numeric vector or matrix. If |
nb |
integer. The number of bands in the time series. |
ny |
integer. The number of years. |
yrs |
numeric vector. The sequence of years to be analysed. |
ev |
logical vector. A vector containing |
dir |
numeric vector. Direction of change caused by a disturbance in each band. Valid values are either 1 or -1. |
th_const |
numeric. Constant controlling the change threshold employed by the HiTS procedure during thresholding. Typical values are comprised in the interval [1, 1.4]. |
noise_rm |
logical. If |
as_list |
logical. If |
cdmt_int()
is not directly called by the user.
It analyses inter-annual Landsat time series to detect changes in spectral trends at the pixel level.
Time series can include single or multiple spectral bands/indices, hereafter referred to as bands.
Input data can be a numeric
vector
extracted from a SpatRaster
or a matrix
.
Impulsive noise, i.e. outliers in the time series, can be removed through an iterative procedure by the relevant filter.
One-year gaps in the time series are filled using either linear interpolation or extrapolation.
Changes in the intercept, slope or both of linear trends are detected using the High-dimensional Trend Segmentation (HiTS) procedure proposed by \insertCitemaeng2019adaptive;textualcdmt.
The HiTS procedure aims at detecting changepoints in a piecewise linear signal where their number and location are unknown.
If as_list
is TRUE
, a list
containing the following elements.
est |
Estimated values (one layer for each year and band). |
cpt |
Detected changepoints (one layer for each year and band). |
slo |
Slope of the linear segments (one layer for each year and band). |
mag |
Magnitude in absolute terms (one layer for each year and band). |
mag_rel |
Magnitude in relative terms (one layer for each year and band). |
len |
Length of segments (one layer per year). |
cpt_id |
Type of change (one layer per year). One of the following values: 101 (abrupt disturbance); 102 (abrupt greening); 201 (gradual disturbance); 202 (gradual greening); 9 (other change). |
tpa |
Impulsive noise (one layer per year). |
d_dur |
Duration of disturbance (one layer per year). |
g_dur |
Duration of greening (one layer per year). |
d_max |
Maximum disturbance change magnitude (in relative tems) throughout the time series (one layer per band). |
d_fst |
Change magnitude (in relative tems) associated with the first disturbance detected within the time series (one layer per band). |
g_max |
Maximum greening change magnitude (in relative tems) throughout the time series (one layer per band). |
wgts |
Weights assigned to each band (one layer per band). |
d_max_md |
Median among bands using values of |
d_fst_md |
Median among bands using values of |
g_max_md |
Median among bands using values of |
d_max_yr |
Year corresponding to |
d_fst_yr |
Year corresponding to |
g_max_yr |
Year corresponding to |
d_max_dr |
Duration of the disturbance corresponding to |
d_fst_dr |
Duration of the disturbance corresponding to |
g_max_dr |
Duration of the greening corresponding to |
d_max-id |
Type of change ( |
d_fst_id |
Type of change ( |
g_max_id |
Type of change ( |
n_gap |
Number of gaps in the time series, if any (single layer). |
n_tpa |
Number of years containing impulsive noise, if any (single layer). |
n_iter |
Number of iterations performed by the impulsive noise filter (single layer). |
If as_list
is FALSE
the result is a numeric
vector
.
Donato Morresi, donato.morresi@gmail.com
maeng2019adaptivecdmt
library(cdmt) # Load raster data data(lnd_si) lnd_si <- terra::rast(lnd_si) # Extract values v <- terra::values(lnd_si)[2000,] # Process data out <- cdmt_int(v, nb = 3, ny = 36, yrs = 1985:2020, dir = c(-1, 1, 1), as_list = TRUE ) # Plot results bands <- c("MSI", "TCW", "TCA") par(mfrow=c(length(bands), 1)) for(i in seq_along(bands)) { plot(matrix(v, nrow = 3, ncol = 36)[i,], type = "l", col = 2, lwd = 2, ylab = "", xlab = "", xaxt = "n") lines(out$est[i,], type = "l", col = 4, lwd = 2, lty = 1) abline(v = which(out$cpt_id == 101), lty = 2, col = 1, lwd = 2) axis(1, at = seq_along(1985:2020), labels = 1985:2020) title(main = paste(bands[i]), adj = 0) }
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.