View source: R/fire_index_functions.r
1 | index_FFDI(Temperature, Rain, DewPoint, Wind, KBDI)
|
Temperature |
|
Rain |
|
DewPoint |
|
Wind |
|
KBDI |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | ##---- 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, DewPoint, Wind, KBDI)
{
McA <- 0
McA_list <- c()
llength <- length(Temperature)
DSinceRain <- 0
LastRain <- 0
for (day in 1:llength) {
if (Rain[day] > 0) {
LastRain <- Rain[day]
DSinceRain <- 0
}
else {
DSinceRain <- DSinceRain + 1
}
satvp <- 6.11 * 10^((7.5 * Temperature[day]/(237.7 +
Temperature[day])))
actvp = 6.11 * 10^((7.5 * DewPoint[day]/(237.7 + DewPoint[day])))
Humid <- (actvp/satvp) * 100
DF <- (0.191 * (KBDI[day] + 104) * (DSinceRain + 1)^1.5)/((3.52 *
(DSinceRain + 1)^1.5) + LastRain - 1)
if (DF > 10) {
DF <- 10
}
F <- 2 * exp(-0.45 + 0.987 * log(DF + 0.001) - 0.0345 *
Humid + 0.0338 * Temperature[day] + 0.0234 * Wind[day])
McA_list <- append(McA_list, F)
}
McA_list
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.