
Calculate active fire counts based on NASA FIRMS polygons
Source:R/calc_active_fire_counts.R
active_fire_counts.Rd
This function allows to efficiently calculate the number of fire events occurred in the region of interest from the NASA FIRMS active fire polygon datasets. For each polygon, the fire event counts for the desired year is returned. The required resources for this indicator are:
Examples
library(sf)
#> Linking to GEOS 3.10.2, GDAL 3.4.1, PROJ 8.2.1; sf_use_s2() is TRUE
library(mapme.biodiversity)
temp_loc <- file.path(tempdir(), "mapme.biodiversity")
if (!file.exists(temp_loc)) {
dir.create(temp_loc)
resource_dir <- system.file("res", package = "mapme.biodiversity")
file.copy(resource_dir, temp_loc, recursive = TRUE)
}
#> [1] TRUE
(try(aoi <- system.file("extdata", "sierra_de_neiba_478140_2.gpkg",
package = "mapme.biodiversity"
) %>%
read_sf() %>%
init_portfolio(
years = 2021,
outdir = file.path(temp_loc, "res"),
tmpdir = tempdir(),
add_resources = FALSE,
verbose = FALSE
) %>%
get_resources("nasa_firms", instrument = "VIIRS") %>%
calc_indicators("active_fire_counts") %>%
tidyr::unnest(active_fire_counts)))
#> Simple feature collection with 1 feature 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: 1 × 9
#> WDPAID NAME DESIG_ENG ISO3 assetid instrument year active_fire_counts
#> <dbl> <chr> <chr> <chr> <int> <chr> <chr> <int>
#> 1 478140 Sierra de … National… DOM 1 VIIRS 2021 21
#> # ℹ 1 more variable: geom <POLYGON [°]>