prepInputsFireYear: Create a raster of fire perimeters

prepInputsFireYearR Documentation

Create a raster of fire perimeters

Description

Create a raster of fire perimeters

Usage

prepInputsFireYear(..., rasterToMatch, fireField = "YEAR", earliestYear = 1950)

Arguments

...

Additional arguments passed to reproducible::prepInputs()

rasterToMatch

A RasterLayer objects to use as the template for all subsequent raster operations (i.e., the one used throughout the simulation).

fireField

field used to rasterize fire polys

earliestYear

the earliest fire date to allow

Value

a SpatRaster layer of fire perimeters with fire year values.

Examples

library(SpaDES.tools)
library(terra)
library(reproducible)

options("reproducible.useTerra" = TRUE, "reproducible.rasterRead" = "terra::rast")

targetCRS <- crs(randomStudyArea())
randomPoly <- randomStudyArea(
  center = vect(cbind(-115, 50), crs = targetCRS),
  size = 1e+7,
)
buffExt <- buffer(randomPoly, 1e+3) |> ext()
ras2match <- rast(res = 10, ext = ext(randomPoly), crs = crs(randomPoly))
ras2match <- rasterize(randomPoly, ras2match)

firePerimeters <- prepInputsFireYear(
  url = paste0("https://cwfis.cfs.nrcan.gc.ca/downloads",
               "/nfdb/fire_poly/current_version/NFDB_poly.zip"),
  destinationPath = tempdir(),
  rasterToMatch = ras2match,
  earliestYear = 1930
)

if (interactive()) {
  plot(firePerimeters)
  plot(randomPoly, add = TRUE)
}

PredictiveEcology/LandR documentation built on June 7, 2024, 4:16 p.m.