View source: R/fire_index_functions.r
1 | index_Fosberg(Temp, Wind, Dew)
|
Temp |
|
Wind |
|
Dew |
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 36 | ##---- 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 (Temp, Wind, Dew)
{
humid <- calc_humid(Temp, Dew)
Wind <- Wind/1.6
Temp = Temp * (9/5) + 32
FFI_list <- c()
llength <- length(Temp)
for (day in 1:llength) {
if (is.na(humid[day])) {
FFI_list <- append(FFI_list, NA)
}
else {
if (humid[day] < 10) {
m = 0.03229 + 0.281073 * humid[day] - 0.000578 *
humid[day] * Temp[day]
}
if (humid[day] >= 10 & humid[day] <= 50) {
m = 2.22749 + 0.160107 * humid[day] - 0.01478 *
Temp[day]
}
if (humid[day] > 50) {
m = 21.0606 + 0.005565 * humid[day]^2 - 0.00035 *
humid[day] * Temp[day] - 0.483199 * humid[day]
}
n = 1 - 2 * (m/30) + 1.5 * (m/30)^2 - 0.5 * (m/30)^3
FFWI = n * ((1 + Wind[day]^2)^0.5)/0.3002
FFI_list <- append(FFI_list, FFWI)
}
}
FFI_list
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.