prepInputsFireYear | R Documentation |
Create a raster of fire perimeters
prepInputsFireYear(..., rasterToMatch, fireField = "YEAR", earliestYear = 1950)
... |
Additional arguments passed to |
rasterToMatch |
A |
fireField |
field used to rasterize fire polys |
earliestYear |
the earliest fire date to allow |
a SpatRaster
layer of fire perimeters with fire year values.
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)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.