Skip to contents

This functions allows to efficiently calculate the treecover and emissions indicators in a single function call together. Since most of the pre-processing operations for treecover and emissions are the same, it is more efficient to calculate them in one run if users are actually interested in both statistics. Otherwise users are advised to use the respective single indicator functions.

Usage

calc_treecover_area_and_emissions(
  years = 2000:2020,
  min_size = 10,
  min_cover = 35
)

Arguments

years

A numeric vector with the years for which to calculate treecover area and emissions.

min_size

The minimum size of a forest patch in ha.

min_cover

The minimum threshold of stand density for a pixel to be considered forest in the year 2000.

Value

A function that returns tibble with a column for years, treecover (in ha), and emissions (in Mg CO2).

Details

The required resources for this indicator are:

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)

mapme_options(
  outdir = outdir,
  verbose = FALSE
)

aoi <- system.file("extdata", "sierra_de_neiba_478140_2.gpkg",
  package = "mapme.biodiversity"
) %>%
  read_sf() %>%
  get_resources(
    get_gfw_treecover(version = "GFC-2020-v1.8"),
    get_gfw_lossyear(version = "GFC-2020-v1.8"),
    get_gfw_emissions()
  ) %>%
  calc_indicators(
    calc_treecover_area_and_emissions(years = 2016:2017, min_size = 1, min_cover = 30)
  ) %>%
  tidyr::unnest(treecover_area_and_emissions)
#> Resource 'gfw_treecover' is already available.
#> Resource 'gfw_lossyear' is already available.

aoi
#> Simple feature collection with 2 features and 8 fields
#> Geometry type: POLYGON
#> Dimension:     XY
#> Bounding box:  xmin: -71.80933 ymin: 18.57668 xmax: -71.33201 ymax: 18.69931
#> Geodetic CRS:  WGS 84
#> # A tibble: 2 × 9
#>   WDPAID NAME            DESIG_ENG     ISO3  assetid years emissions treecover
#>    <dbl> <chr>           <chr>         <chr>   <int> <int>     <dbl>     <dbl>
#> 1 478140 Sierra de Neiba National Park DOM         1  2016      2400     2360.
#> 2 478140 Sierra de Neiba National Park DOM         1  2017      2839     2348.
#> # ℹ 1 more variable: geom <POLYGON [°]>
# }