fnc_get_params: Parameter-list creation

View source: R/fnc_get_params.R

fnc_get_paramsR Documentation

Parameter-list creation

Description

This function creates a list of parameter settings. Vegetation settings, by default, represent the findings of the WHH-KW project.

Usage

fnc_get_params(
  df.ids,
  tree_species = "spruce",
  df.ind.info = NULL,
  BW_or_D = "BW"
)

Arguments

df.ids

a data frame that contains at least the following columns:

  • ID_custom - a unique ID-column for assignment that all intermediate products as well as the output will be assigned to.

  • easting and northing - coordinates in UTM EPSG:32632


and may further contain the following meta information:

  • slope - slope at the modelling points in degree

  • aspect - aspect of the modelling points in degree

  • coord_x - longitude of points in degree, will be calculated automatically if missing

  • coord_y - latitude of points in degree, will be calculated automatically if missing


OR: A simple feature of type "POLYGON" with any of the columns above. If df.ids is a simple feature, site information "aspect" and "slope" will be averaged over the polygon area. Coord_y and coord_x will be taken from the centroid.

tree_species

name of the tree species to be modelled with. Either a single species name that is then used for all points in df.ids, or a vector of the same length as df.ids$ID if the main tree species of each point is known and differs. Must be one of beech, oak, spruce, pine, larch, douglasfir.
It is recommended (findings of project WHH-KW) to use the settings of spruce for fir and the settings of pine for larch. If certain tree specific parameters should be changed permanently, the corresponding object params_... should be overwritten manually before running the function.

df.ind.info

a data frame containing individual site information for each ID or if parameters are presumed to be different than the default settings of set_paramLWFB90. They need to be given here in the form of a data frame containing the column ID_custom, which should be identical to the ID_custom-column ofdf.ids, and additional columns that are named exactly like the parameters in set_paramLWFB90.

wuchsmaechtigkeit

function in progress. provides an approximation for the mean growth of an area in BW. Adjusts LAI, SAI and max height of the vegetation. Default is F, as still in progress.

Value

Returns a list of parameter settings that can be read and further processed by run_multisite_LWFB90 or run_LWFB90

Examples

ls.param <- fnc_get_params(df.ids = test.ids.bds,
                            tree_species = c("beech", "spruce", "pine", "douglasfir", "beech"))
# as we're working with a list of long lists. For comparative reasons, this function returns the n-th object of each list element
fun1 <- function(lst, n){
  sapply(lst, `[`, n)
}

# tree-species
fun1(ls.param, which(names(ls.param[[1]]) == "budburst_species"))
fun1(ls.param, which(names(ls.param[[1]]) == "glmax"))
fun1(ls.param, which(names(ls.param[[1]]) == "coords_x"))

# all oaks, but change height and age of stands at begin of simulation (parameter "height" & "age.ini")
df.infos <- data.frame("ID_custom" = LETTERS[5:1],
                  "height" = c(10, 15, 30, 20, 20),
                  "age.ini" = c(10, 20, 25, 70, 90))

ls.param <- fnc_set_params(df.ids = test.ids.bds,
                           tree_species = "oak",
                           df.ind.info = df.infos)
# tree-species
fun1(ls.param, which(names(ls.param[[1]]) == "budburst_species"))
fun1(ls.param, which(names(ls.param[[1]]) == "height"))
fun1(ls.param, which(names(ls.param[[1]]) == "age_ini"))


rhabel/modLWFB90 documentation built on Nov. 21, 2024, 3:28 a.m.