diff --git a/R/comparePredictions.R b/R/comparePredictions.R index b3bf8f4..dcefa90 100644 --- a/R/comparePredictions.R +++ b/R/comparePredictions.R @@ -61,8 +61,8 @@ comparePredictions_summaryDT <- function(scfmDriverPars = NULL, ## This is a long way of saying 'sum of fires / (flammable landscape * fire epoch)'. ## hist_mfs will be NaN if there were no fires larger than one pixel - #median fire size is not used by scfm but is worth recording - #regimes where mean is much greater than median will be hard to recreate + ## median fire size is not used by scfm but is worth recording + ## regimes where mean is much greater than median will be hard to recreate escaped <- fireRegimePoints[fireRegimePoints$SIZE_HA > landscapeAttr$cellSize,] medianFireSize <- median(escaped$SIZE_HA) #should be no need for na.rm @@ -111,8 +111,8 @@ comparePredictions_summaryDT <- function(scfmDriverPars = NULL, "achievedIgnitions" = achievedIgnitions, "targetEscapes" = targetEscapes, "achievedEscapes" = achievedEscapes, - "pEscape" = regime$pEscape, #escape prob (no. fires > cellSize / no. fires) - "p0" = driver$p0, #p0 and pEscape may indicate something incorrect + "pEscape" = regime$pEscape, ## escape prob (no. fires > cellSize / no. fires) + "p0" = driver$p0, ## p0 and pEscape may indicate something incorrect "pSpread" = pSpread, ## spread probability estimated from the SCAM model "pIgnition" = pIg) ## ignition probability of a single pixel return(pred) @@ -133,7 +133,8 @@ comparePredictions_meanFireSize <- function(dt) { ggplot(dt, aes(x = histMeanSize, y = modMeanSize)) + geom_point(aes(histMeanSize, modMeanSize)) + - labs(x = "historical mean fire size", y = "modeled mean fire size") + + xlab("historical mean fire size") + + ylab("modeled mean fire size") + theme_bw() + scale_y_continuous(limits = c(0, NA)) + scale_x_continuous(limits = c(0, NA)) + @@ -214,14 +215,15 @@ comparePredictions_annualEscapes <- function(dt) { #' @export #' @rdname comparePredictions -comparePredictions_fireDistribution <- function(dt){ +comparePredictions_fireDistribution <- function(dt) { if (any(is.null(dt))) { stop("all arguments must be provided and cannot be NULL.") } ggplot(dt, aes(x = histMedianSize, y = histMeanSize)) + geom_point() + - labs(y = "estimated mean fire size (ha)", x = "estimated median fire size (ha)") + + xlab("estimated median fire size (ha)") + + ylab("estimated mean fire size (ha)") + theme_bw() + geom_abline(slope = 1) + scale_y_continuous(limits = c(0, NA)) + diff --git a/R/utils_scfmRegime.R b/R/utils_scfmRegime.R index 0a04e77..e00eca7 100644 --- a/R/utils_scfmRegime.R +++ b/R/utils_scfmRegime.R @@ -29,8 +29,7 @@ calcZonalRegimePars <- function(polygonID, firePolys, targetBurnRate = NULL, targetMaxFireSize = NULL) { - idx <- firePolys$PolyID == polygonID - tmpA <- firePoints[firePoints$PolyID == as.numeric(polygonID),] + tmpA <- firePoints[firePoints$PolyID == as.numeric(polygonID), ] landAttr <- landscapeAttr[[polygonID]] cellSize = landAttr[["cellSize"]] nFires <- dim(tmpA)[1] @@ -134,8 +133,8 @@ calcZonalRegimePars <- function(polygonID, firePolys, ## max fire size is returned twice - I think this is a backwards compatibility decision return(list( - ignitionRate = rate, #per ha per yr - pEscape = pEscape, + ignitionRate = rate, ## per ha per yr + pEscape = pEscape, ## escape probability xBar = xBar, ## mean fire size lxBar = lxBar, ## mean log(fire size) xMax = xMax, ## maximum observed size