Description Usage Arguments Details Value Examples
View source: R/genFilterStack.R
genFilterStack
filters the RasterLayer
s within a range of dates.
1 | genFilterStack(r, ...)
|
r |
the |
... |
arguments for nested functions:
|
This is a helper function used by other functions in this package.
a RasterStack
with images within the specified dates.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | # generate random images
img <- matrix(1:16, ncol = 4, byrow = TRUE)
r <- raster(img)
r <- stack(r, r, r, r, r, r)
names(r) <- paste0("RandomImage_201803", 1:6)
# print the names and dates of the random images
print(names(r))
genGetDates(names(r))
# example of filtering the raster stack
r2 <- genFilterStack(r = r,
startDate = as.Date("2018-02-02", "%Y-%m-%d"),
endDate = as.Date("2018-02-04", "%Y-%m-%d"))
# print the names and the number of layers of the filtered stack
genGetDates(names(r2))
nlayers(r2)
|
Loading required package: raster
Loading required package: sp
Loading required package: sf
Linking to GEOS 3.8.0, GDAL 3.0.4, PROJ 6.3.1
Loading required package: tmap
[1] "RandomImage_2018031" "RandomImage_2018032" "RandomImage_2018033"
[4] "RandomImage_2018034" "RandomImage_2018035" "RandomImage_2018036"
[1] "2018-01-31" "2018-02-01" "2018-02-02" "2018-02-03" "2018-02-04"
[6] "2018-02-05"
[1] "2018-02-02" "2018-02-03" "2018-02-04"
[1] 3
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.