#' Default index parameters
#'
#' This function stores some default properties of bioclimatic indices.
#' @param x character, name of the bioclimatic index. Possible values are: 'huglin', 'winkler',
#' 'GSTavg', or 'rad_sum'. There are some predefined indices within this function
#' (Currently: Winkler, Huglin, GSTavg, rad_sum). To use this parameter,
#' the columns in the input df have to be
#' named the following way: T_max, T_min, T_mean for maximum, minimum and mean
#' temperature and SolRad for solar radiation.
#' @keywords bioclimatic index, parameters
#' @export
#' @import data.table
#' @examples
#' get_index_params('huglin')
get_index_params <- function(x) {
index.param.list <- list('huglin' = list('frml' = huglin ~ (((((T_max + T_min) / 2) - 10) + (T_max - 10)) / 2) * 1.05,
'agg.func' = sum,
'period' = 91:273,
'set.zero' = T),
'winkler' = list('frml' = winkler ~ ((T_max + T_min) / 2) - 10,
'agg.func' = sum,
'period' = 91:304,
'set.zero' = T),
'GSTavg' = list('frml' = GSTavg ~ (T_max + T_min) / 2,
'agg.func' = mean,
'period' = 91:304,
'set.zero' = F),
'rad_sum' = list('frml' = rad_sum ~ SolRad,
'agg.func' = sum,
'period' = 91:304,
'set.zero' = F))
if (!x %in% names(index.param.list)) {
stop('Index name has not been found in parameter list')
}
return(index.param.list[[x]])
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.