Reads NIFC wildfire perimeters from a local NIFC ZIP downloaded with
get_nifc() and returns either a spatial object or a plain
attribute table.
Usage
read_nifc(
years = NULL,
geometry = TRUE,
output = c("vect", "sf", "terra"),
cache = FALSE,
verbose = TRUE
)Arguments
- years
integervector of years to keep. Accepts a single year (2020), a contiguous range created with:notation (2010:2020), or a vector of specific years (c(2000, 2010, 2020)). Only fires whoseFireYearappears inyearsare returned.NULL(the default) returns all years without filtering.- geometry
logical(1)WhenTRUE(the default) the result is a spatial object (sforterra::SpatVectordepending onoutput). WhenFALSEthe attributes are returned as a plaindata.frame.- output
character(1)The class of the returned spatial object. Either"vect"/"terra"(default) for aterra::SpatVector, or"sf"for ansfobject. Ignored whengeometry = FALSE.- cache
logical(1)orcharacter(1). Controls whereread_nifc()looks for the downloaded ZIP file. WhenFALSE(the default), the current working directory is used. WhenTRUE, the platform user cache directory (tools::R_user_dir("fireR", "cache")) is used. Supply a directory path as a string to specify a custom location.- verbose
logical(1)print progress messages.
Value
A
terra::SpatVectorwhenoutput = "vect"/"terra"andgeometry = TRUE.An
sfobject whenoutput = "sf"andgeometry = TRUE.A
data.framewhengeometry = FALSE.
Details
read_nifc() does not download data. Use get_nifc() first
to obtain the perimeters ZIP archive.
The ZIP is expected to contain either a GeoPackage (.gpkg) or a
shapefile (.shp). Year filtering uses the integer FireYear
column present in the NIFC historical perimeters data.
Examples
if (FALSE) { # \dontrun{
zip_path <- get_nifc()
perims <- read_nifc(output = "sf")
# Single year
perims_2020 <- read_nifc(years = 2020, output = "sf")
# Contiguous range
perims_recent <- read_nifc(years = 2015:2020, output = "sf")
# Specific years only
perims_sel <- read_nifc(years = c(2010, 2015, 2020), output = "sf")
# Attribute table only (no geometry)
tbl <- read_nifc(geometry = FALSE)
} # }