From 30f4c95c74c40d7a15385329ca0bad32e6abafea Mon Sep 17 00:00:00 2001 From: Jonathan Van Elslander Date: Mon, 12 Jan 2026 15:20:13 -0800 Subject: [PATCH 1/2] pipe to cache --- fireSense_dataPrepPredict.R | 48 +++++++++++++++++++------------------ 1 file changed, 25 insertions(+), 23 deletions(-) diff --git a/fireSense_dataPrepPredict.R b/fireSense_dataPrepPredict.R index a4ca5ee..62c1a88 100644 --- a/fireSense_dataPrepPredict.R +++ b/fireSense_dataPrepPredict.R @@ -561,19 +561,20 @@ prepare_SpreadPredict <- function(sim) { if (suppliedElsewhere("rstLCCs", sim)) { sim$rstLCC <- tail(sim$rstLCCs, 1)[[1]] } else { - rstLCC <- Cache(makeFireSenseLCC, - neededYear = P(sim)$dataYear, - writeTo = .suffix( - "rstLCC.tif", - paste0(P(sim)$dataYear, "_", P(sim)$.studyAreaName) - ), - destinationPath = inputPath(sim), - studyArea = sim$studyArea, - rasterToMatch = sim$rasterToMatch, - overwrite= TRUE, - nonflammableLCC = P(sim)$nonflammableLCC, - flammabilityThreshold = P(sim)$flammabilityThreshold, - userTags = c("makeFireSenseLCC", "predict") + rstLCC <- makeFireSenseLCC( + neededYear = P(sim)$dataYear, + writeTo = .suffix( + "rstLCC.tif", + paste0(P(sim)$dataYear, "_", P(sim)$.studyAreaName) + ), + destinationPath = inputPath(sim), + studyArea = sim$studyArea, + rasterToMatch = sim$rasterToMatch, + overwrite = TRUE, + nonflammableLCC = P(sim)$nonflammableLCC, + flammabilityThreshold = P(sim)$flammabilityThreshold + ) |> Cache( + userTags = c("makeFireSenseLCC", "predict") ) sim$rstLCC <- rstLCC$lcc sim$propFlammable <- rstLCC$flammableProp @@ -582,16 +583,17 @@ prepare_SpreadPredict <- function(sim) { # } # if (!suppliedElsewhere("standAgeMap", sim)) { - if (suppliedElsewhere("standAgeMaps", sim)) { - sim$standAgeMap <- tail(sim$standAgeMaps, 1)[[1]] - } else { - sim$standAgeMap <- Cache(prepInputsStandAgeMap, - rasterToMatch = sim$rasterToMatch, - studyArea = sim$studyArea, - destinationPath = dPath, - startTime = P(sim)$dataYear, - userTags = c(cacheTags, "prepInputsStandAgeMap2011")) - } + if (suppliedElsewhere("standAgeMaps", sim)) { + sim$standAgeMap <- tail(sim$standAgeMaps, 1)[[1]] + } else { + sim$standAgeMap <- prepInputsStandAgeMap( + rasterToMatch = sim$rasterToMatch, + studyArea = sim$studyArea, + destinationPath = dPath, + startTime = P(sim)$dataYear) |> + Cache( + userTags = c(cacheTags, "prepInputsStandAgeMap2011")) + } # } if (!suppliedElsewhere("fireSense_IgnitionFitted")) { From ad3feeb1ae7ea25a556432f879ca8553e399894e Mon Sep 17 00:00:00 2001 From: Jonathan Van Elslander Date: Thu, 22 Jan 2026 15:30:12 -0800 Subject: [PATCH 2/2] updating function call to match previous changes to function --- fireSense_dataPrepPredict.R | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fireSense_dataPrepPredict.R b/fireSense_dataPrepPredict.R index 62c1a88..ade8762 100644 --- a/fireSense_dataPrepPredict.R +++ b/fireSense_dataPrepPredict.R @@ -568,8 +568,8 @@ prepare_SpreadPredict <- function(sim) { paste0(P(sim)$dataYear, "_", P(sim)$.studyAreaName) ), destinationPath = inputPath(sim), - studyArea = sim$studyArea, - rasterToMatch = sim$rasterToMatch, + maskTo = sim$studyArea, + to = sim$rasterToMatch, overwrite = TRUE, nonflammableLCC = P(sim)$nonflammableLCC, flammabilityThreshold = P(sim)$flammabilityThreshold