Skip to content

ISI and FWI calculation problems using FWI_Daily #14

@achubaty

Description

@achubaty

Calling generateWeather(modelNames = "FWI_Daily", ....) can generate incorrect ISI values, which carryover into the FWI calculations, resulting in nonsensical values.

library(BioSIM)
#> Welcome to BioSIM!
#> The BioSIM package implements a client that retrieves climate variables from the
#> original BioSIM application hosted on a server.
#> Please, make sure that Java (version 8 or later) is installed on your computer.
#> For more information, visit https://github.com/RNCan/BioSimClient_R/wiki.
library(dplyr)
#> 
#> Attaching package: 'dplyr'
#> The following objects are masked from 'package:stats':
#> 
#>     filter, lag
#> The following objects are masked from 'package:base':
#> 
#>     intersect, setdiff, setequal, union
library(tidyr)

locations <- BioSIM::twoLocationsInSouthernQuebec

FWI_Daily <- BioSIM::generateWeather(
  modelNames = "FWI_Daily",
  fromYr = 2001,
  toYr = 2002,
  id = locations$Name,
  latDeg = locations$Latitude,
  longDeg = locations$Longitude,
  elevM = locations$Elevation
)$FWI_Daily
#> Starting local Java server...
#> If you are using BioSIM Web API for a scientific publication, please cite it. Type citation("BioSIM") in your R console to obtain the full citation.

FWI_Daily <- FWI_Daily |>
  dplyr::mutate(across(where(is.numeric), ~ replace(., . == -9999, NA))) |>
  tidyr::drop_na(FWI)

high_ISI <- FWI_Daily |> dplyr::filter(ISI > 1000)

high_ISI |>
  dplyr::mutate(NEW_ISI = cffdrs:::initial_spread_index(FFMC, WS), .after = "ISI") |>
  dplyr::mutate(NEW_FWI = cffdrs:::fire_weather_index(NEW_ISI, BUI), .after = "FWI") |>
  dplyr::select(FFMC, WS, ISI, NEW_ISI, FWI, NEW_FWI)
#>       FFMC      WS       ISI      NEW_ISI        FWI      NEW_FWI
#> 1 14.01030 17.7613    246571 2.441490e-05    7376970 7.304514e-06
#> 2 15.85420 10.3613    395228 3.915720e-05     206389 2.044796e-05
#> 3  1.15175 17.7613 112686000 1.110267e-08 2253720000 2.220534e-09

Created on 2026-02-26 with reprex v2.1.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions