Functions to check and correct spatial inputs for simulations
check_topography(
x,
missing_action = "no_action",
default_values = c(elevation = 0, slope = NA, aspect = NA),
verbose = TRUE
)check_land_cover(
x,
missing_action = "no_action",
default_values = "wildland",
verbose = TRUE
)
check_forests(
x,
SpParams = NULL,
missing_action = "no_action",
default_forest = NULL,
progress = FALSE,
verbose = TRUE
)
check_soils(
x,
check_equal_layers = FALSE,
missing_action = "no_action",
default_values = c(clay = 25, sand = 25, bd = 1.5, rfc = 25),
progress = FALSE,
verbose = TRUE
)
All functions return a modified sf object if missing_action is either "filter" or "default". Otherwise,
they return an invisible tibble with logical columns indicating where missing information is. In check_forests() the function will return a modified object if
parameter default_forest is provided.
An object of class sf to be checked.
Action to perform for missing values, either "no_action" (for checks), "filter" (filter missing data), "default" (impute default values)
Vector of default values for locations with missing data.
Logical flag to indicate extra console output.
A data frame with species parameters (see SpParamsMED).
Default forest object to fill locations where missing (e.g. default_forest = medfate::emptyforest()).
A logical flag to print information about progress.
Logical flag to test whether soils have the same number of layers.
Function check_topography() checks that columns "elevation", "slope" and "aspect" do not contain missing values.
Function check_land_cover() checks that column "land_cover_type" does not contain missing values.
Function check_forests() checks first that forest objects are defined in "wildland" locations. Then, it looks for missing
data in tree or shrub attributes required for simulations. If SpParams is provided, the function also checks
whether species names are within the taxa represented in SpParams. If default_forest is provided, the function will use it to fill locations with missing forests objects.
Function check_soils() checks first that "wildland" and "agriculture" locations have a defined soil object. Then it looks for missing data in required
soil physical parameters.
data(example_ifn)
check_topography(example_ifn)
check_land_cover(example_ifn)
check_forests(example_ifn)
check_soils(example_ifn)
Run the code above in your browser using DataLab