check_inputs: Check spatial inputs

check_inputsR Documentation

Check spatial inputs

Description

Functions to check and correct spatial inputs for simulations

Usage

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",
  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
)

Arguments

x

An object of class sf to be checked.

missing_action

Action to perform for missing values, either "no_action" (for checks), "filter" (filter missing data), "default" (impute default values)

default_values

Vector of default values for locations with missing data.

verbose

Logical flag to indicate extra console output.

SpParams

A data frame with species parameters (see SpParamsMED).

progress

A logical flag to print information about progress.

check_equal_layers

Logical flag to test whether soils have the same number of layers.

Details

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.

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.

Value

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.

Examples

data(example_ifn)

check_topography(example_ifn)
check_land_cover(example_ifn)
check_forests(example_ifn)
check_soils(example_ifn)

emf-creaf/medfateland documentation built on April 17, 2025, 5:43 a.m.