View source: R/fire_index_functions.r
1 | index_KBDI(Temperature, Rain, MAP = sum(Rain)/length(Rain/365.25))
|
Temperature |
|
Rain |
|
MAP |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | ##---- Should be DIRECTLY executable !! ----
##-- ==> Define data, use random,
##-- or do help(data=index) for the standard data sets.
## The function is currently defined as
function (Temperature, Rain, MAP = sum(Rain)/length(Rain/365.25))
{
KBDI <- 200
KBDI_list <- c()
llength <- length(Temperature)
for (day in 1:llength) {
pKBDI <- KBDI
KBDI <- KBDI - Rain[day]
if (KBDI < 0) {
KBDI <- 0
}
todayET <- lookupET(pKBDI, Temperature[day], MAP)
KBDI <- KBDI + todayET
KBDI_list <- append(KBDI_list, KBDI)
}
KBDI_list
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.