modis_classify: Classify MODIS Image

modis_classifyR Documentation

Classify MODIS Image

Description

Function to classify MODIS MCD43A4 band 7 into the binary categories water and dryland. Classification is based on the algorithm described in Wolski et al., 2017 and requires that reflectance values of water- and dryland are sufficiently distinct. The final map binarily depicts water = 1 and dryland = 0.

Usage

modis_classify(
  x = NULL,
  watermask = NULL,
  drymask = NULL,
  ignore.bimodality = F
)

Arguments

x

RasterLayer of MODIS band 7

watermask

SpatialPolygons or SpatialPolygonsDataFrame representing the water-polygon that is used to extract reflectances of water on MODIS band 7. By default the masks from Wolski et al., 2017 are used. See also modis_watermask() in case you want to create dynamic watermasks.

drymask

SpatialPolygons or SpatialPolygonsDataFrame representing the dryland-polygon that is used to extract reflectances of water on MODIS band 7. By default the masks from Wolski et al., 2017 are used.

ignore.bimodality

logical. Should issues with bimodality be ignored, i.e. the bimodality check be skipped? This can lead to biased classifications but may help in detecting issues.

Value

RasterLayer of classified MODIS image. water is valued 1, dryland valued 0. If there are clouds, they are masked as NA.

Examples

## Not run: 
# Download files for two dates
files <- modis_download(
    dates     = c("2020-01-01", "2020-01-01")
  , outdir    = getwd()
  , tmpdir    = tempdir()
  , username  = "username"
  , password  = "password"
  , overwrite = F
)

# Load one of them
modis <- modis_load(files[1])

# Classify it
classified <- modis_classify(modis, ignore.bimodality = T)

# Visualize
plot(classified)

## End(Not run)

DavidDHofmann/floodmapr documentation built on Jan. 15, 2024, 9:32 p.m.