Description Usage Arguments Details Value Examples
lsCloudMask
creates a cloud mask derived from the band for quality
assurance (BQA) from Landsat-7 or Landsat-8 time series. The function is
applied to untarred images, such as those resulting from
lsDownload
or lsDownSearch
. The result is a new
image band, called cloud (CLD), that is saved as separate GoeTiffs.
1 2 3 4 5 6 7 8 9 | lsCloudMask(
src,
AppRoot,
out.name,
ls8 = TRUE,
overwrite = FALSE,
verbose = FALSE,
...
)
|
src |
the path to the folder with the untarred images from Landsat-7 or Landsat-8. |
AppRoot |
the directory where the cloud masks are saved. |
out.name |
the name of the folder that stores the outputs. If the arguemnt is not defined the folder will be named as "CloudMask". |
ls8 |
|
overwrite |
logical argument. If |
verbose |
logical argument. If |
... |
arguments for nested functions.
|
The valid range for the sensitivity
threshold is 0-80000. By defualt,
the argument is set to 28000. We recommend 6000 and 28000 for Landsat-7 and
Landsat-8 respectively. The NA
and 1
values of the mask represent
cloudy and clear-sky pixels pixels respectively.
this function does not return anything. It saves the cloud masks (CLD)
as GTiff files in the AppRoot
directory.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 | ## Not run:
# load a spatial polygon object of Navarre
data(ex.navarre)
wdir <- file.path(tempdir(),"Path_for_downloading_folder")
print(wdir)
# search and download images from Landsat-8 between
# 01-01-2018 and 20-01-2018 for the region of Navarre
lsDownSearch(satellite = "ls8",
username = "username",
password = "password",
startDate = as.Date("01-01-2018", "%d-%m-%Y"),
endDate = as.Date("20-01-2018", "%d-%m-%Y"),
pathrow = list(c(200, 31), c(200, 30)),
untar = TRUE,
AppRoot = wdir)
# define the path where the GTiff images are located
wdir.ls8 <- file.path(wdir,"Landsat8")
wdir.ls8.untar <- file.path(wdir.ls8,"untar")
# mosaic and crop the imagery
lsMosaic(src = wdir.ls8.untar,
AppRoot = wdir.ls8,
out.name = "Navarre",
extent = ex.navarre,
gutils = TRUE, # using gdalUtils
overwrite = TRUE) # overwrite
# generate the path where mosaicked images are located
wdir.ls8.navarre <- file.path(wdir.ls8, "Navarre")
# calculate the cloud mask from QC layer
lsCloudMask(src=wdir.ls8.navarre,
overwrite=TRUE)
# load the B1 layer and calculate the CLD layer
files.ls8.navarre.path <- list.files(wdir.ls8.navarre,
full.names = TRUE,
recursive = TRUE,
pattern = "\\.tif$")
tiles.ls8.cld <- files.ls8.navarre.path[grepl("CLD",files.ls8.navarre.path)]
tiles.ls8.b1 <- files.ls8.navarre.path[grepl("B1.tif",files.ls8.navarre.path)]
img.ls8.cld <- lapply(tiles.ls8.cld,raster)
img.ls8.b1 <- lapply(tiles.ls8.b1,raster)
# calculate cloud free b1 layers
img.ls8.b1.cloud.free <- img.ls8.b1[[1]] * img.ls8.cld[[1]]
spplot(img.ls8.b1.cloud.free)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.