Skip to contents

This function allows to efficiently calculate the relative wetness in the shallow groundwater section with regard to the the 1948-2012 reference period. The values represent the wetness percentile a given area achieves at a given point in time in regard to the reference period. For each polygon, the desired statistic/s (mean, median or sd) is/are returned. The required resources for this indicator are:

Format

A tibble with a column for each specified stats and a column with the respective date.

Details

The following arguments can be set:

stats_drought

Function to be applied to compute statistics for polygons either one or multiple inputs as character "mean", "median" or "sd".

engine

The preferred processing functions from either one of "zonal", "extract" or "exactextract" as character.

Examples

# \dontshow{
mapme.biodiversity:::.copy_resource_dir(file.path(tempdir(), "mapme-data"))
# }
# \dontrun{
library(sf)
library(mapme.biodiversity)

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

aoi <- system.file("extdata", "sierra_de_neiba_478140_2.gpkg",
  package = "mapme.biodiversity"
) %>%
  read_sf() %>%
  init_portfolio(
    years = 2022,
    outdir = outdir,
    tmpdir = tempdir(),
    add_resources = FALSE,
    verbose = FALSE
  ) %>%
  get_resources("nasa_grace") %>%
  calc_indicators("drought_indicator",
    stats_drought = c("mean", "median"),
    engine = "extract"
  ) %>%
  tidyr::unnest(drought_indicator)
#> Error in map2(.x, vec_index(.x), .f, ...):  In index: 1.
#>  With name: nasa_grace.
#> Caused by error in `.read_raster_source()`:
#> ! Did not find equal number of tiles per timestep.

aoi
#> Error in eval(expr, envir, enclos): object 'aoi' not found
# }