Load the packages:
if (!require("pacman")) install.packages("pacman")
pacman::p_load("tidyverse", "sf", "sits", "gdalcubes", "terra")
In this part, we will test some basics of SITS * package, which is for satellite image time series analysis. They are stored as earth observation data cubes. The book about SITS package can be found here
*Rolf Simoes, Gilberto Camara, Gilberto Queiroz, Felipe Souza, Pedro R. Andrade, Lorena Santos, Alexandre Carvalho, and Karine Ferreira. “Satellite Image Time Series Analysis for Big Earth Observation Data”. Remote Sensing, 13: 2428, 2021. doi:10.3390/rs13132428 Collections that can be used in SITS package are available in cloud services, such as Amazon Web Service or Microsoft’s Planetary Computer.
Firstly, we will try to find collection of Landsat imagery from MPC- you can specify your own region of interest (roi).
L8_cube = sits_cube(
source = "MPC",
collection = "LANDSAT-C2-L2",
bands = c("RED", "SWIR16", "NIR08", "CLOUD"),
roi = c("lat_min" = 50.026, "lon_min" = 19.902, "lat_max" = 50.027, "lon_max" = 19.903),
start_date = "2021-06-01",
end_date = "2022-08-01",
prgress = TRUE)
View(L8_cube)
sits_timeline(L8_cube)
Select one tile with low cloud cover and plot it:
plot(L8_cube,
red = "SWIR16", green = "NIR08", blue = "RED",
date = "2021-06-18")
As the time series are irregular, they need to be converted to regular data cubes before further processing in sits. It may take some time…
reg_cube = sits_regularize(
cube = L8_cube,
output_dir = tempdir(),
res = 120,
period = "P1M",
multicores = 4)
And calculate NDVI:
reg_cube_ndvi = sits_apply(reg_cube,
NDVI = (NIR08 - RED) / (NIR08 + RED),
output_dir = tempdir(),
multicores = 4,
memsize = 12)
plot(reg_cube_ndvi, band = "NDVI", palette = "RdYlGn")