replaceAgeInFires | R Documentation |
Replace stand age with time since last fire
replaceAgeInFires(standAgeMap, firePerimeters, startTime)
standAgeMap |
a raster layer stand age map |
firePerimeters |
the earliest fire date to allow |
startTime |
date of the last fire year to be considered (e.g., start of fire period counting backwards). If missing, last fire year available will be used. |
a raster layer stand age map corrected for fires, with an attribute vector of pixel IDs
for which ages were corrected. If no corrections were applied the attribute vector is integer(0)
.
## Not run:
library(SpaDES.tools)
library(terra)
library(reproducible)
randomPoly <- vect(randomStudyArea(size = 1e7))
randomPoly
ras2match <- rast(res = 250, ext = ext(randomPoly), crs = crs(randomPoly))
ras2match <- rasterize(randomPoly, ras2match)
tempDir <- tempdir()
standAge <- prepInputsStandAgeMap(destinationPath = tempDir,
rasterToMatch = ras2match,
fireURL = NA) ## or NULL
attr(standAge, "imputedPixID")
firePerimeters <- Cache(prepInputsFireYear,
url = paste0("https://cwfis.cfs.nrcan.gc.ca/downloads",
"/nfdb/fire_poly/current_version/NFDB_poly.zip"),
destinationPath = tempDir,
rasterToMatch = ras2match)
standAge <- replaceAgeInFires(standAge, firePerimeters)
attr(standAge, "imputedPixID")
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.