# Creating patterns from objects of class twdtwTimeSeries
evi = brick(system.file("lucc_MT/data/evi.tif", package="dtwSat"))
ndvi = brick(system.file("lucc_MT/data/ndvi.tif", package="dtwSat"))
timeline = scan(system.file("lucc_MT/data/timeline", package="dtwSat"), what="date")
rts = twdtwRaster(evi, ndvi, timeline=timeline)
# Read field samples
if (FALSE) {
field_samples = read.csv(system.file("lucc_MT/data/samples.csv", package="dtwSat"))
prj_string = scan(system.file("lucc_MT/data/samples_projection", package="dtwSat"),
what = "character")
# Extract time series
ts = getTimeSeries(rts, y = field_samples, proj4string = prj_string)
# Create temporal patterns
patt = createPatterns(x=ts, from="2005-09-01", to="2006-09-01", freq=8, formula = y~s(x))
# Plot patterns
autoplot(patt[[1]], facets = NULL) + xlab("Time") + ylab("Value")
}
Run the code above in your browser using DataLab