Learn R Programming

mapme.biodiversity (version 0.9.3)

gsw_change: Calculate Global Surface Water (GSW) Change

Description

The change in water occurrence intensity between the two periods is derived from homologous pairs of months (i.e. same months containing valid observations in both periods). The difference in the occurrence of surface water was calculated for each homologous pair of months. The average of all of these differences constitutes the Surface Water Occurrence change intensity. The raster files have integer cell values between [0, 200] where 0 represents surface water loss and 200 represents surface water gain.

Usage

calc_gsw_change(engine = "extract", stats = "mean")

Value

A function that returns an indicator tibble with change intensity as variable and corresponding (unitless) values as value.

Arguments

engine

The preferred processing functions from either one of "zonal", "extract" or "exactextract". Default: "extract".

stats

Aggregation function with which the data are combined. Default: "mean".

Details

The pixel values are aggregated using method provided via the stats parameter using the specified engine.

The required resources for this indicator are:

  • global_surface_water_change

Examples

Run this code
# \dontshow{
mapme.biodiversity:::.copy_resource_dir(file.path(tempdir(), "mapme-data"))
# }
if (FALSE) {
library(sf)
library(mapme.biodiversity)

outdir <- file.path(tempdir(), "mapme-data")
dir.create(outdir, showWarnings = FALSE)

mapme_options(
  outdir = outdir,
  verbose = FALSE
)

aoi <- system.file("extdata", "shell_beach_protected_area_41057_B.gpkg",
  package = "mapme.biodiversity"
) %>%
  read_sf() %>%
  get_resources(get_global_surface_water_change()) %>%
  calc_indicators(
    calc_gsw_change(engine = "extract", stats = "mean")
  ) %>%
  portfolio_long()

aoi
}

Run the code above in your browser using DataLab