|
35 | 35 | #' @param destinationPath Character string. Directory path where source NTEMS data |
36 | 36 | #' will be downloaded/loaded (via `prepInputs_NTEMS_LCC_FAO`) and where the |
37 | 37 | #' output raster will be written if `writeTo` is specified. |
| 38 | +#' @param overwrite Logical. Overwrite NTEMS FAO and flammable pixels rasters. |
38 | 39 | #' |
39 | 40 | #' @return A list of two `SpatRaster` objects: |
40 | 41 | #' 1) the processed land cover classification at the resolution, extent, |
|
76 | 77 | makeFireSenseLCC <- function(neededYear, to, maskTo = NULL, # to, maskTo = NULL, |
77 | 78 | nonflammableLCC = c(20, 31, 32, 33), |
78 | 79 | flammabilityThreshold = 0.1, writeTo = NULL, |
79 | | - destinationPath) { |
| 80 | + overwrite = TRUE, destinationPath) { |
80 | 81 | # 1. Retrieve and prepare base NTEMS LCC data for the specified year |
81 | 82 | # - Crops to the extent of to |
82 | 83 | # - Masks to the maskTo polygon(s) |
83 | 84 | message("Preparing base NTEMS LCC data...") |
84 | | - |
| 85 | +browser() |
85 | 86 | maskToArg <- if (is.null(maskTo)) to else maskTo |
86 | 87 |
|
87 | 88 |
|
88 | 89 | # if (exists("aaaa", envir = .GlobalEnv)) browser() |
89 | 90 | rstLCC <- prepInputs_NTEMS_LCC_FAO(year = neededYear, |
90 | 91 | disturbedCode = 240, # Optional: specify disturbed code if needed |
91 | | - overwrite = TRUE, # Consider parameterizing overwrite? |
| 92 | + overwrite = overwrite, |
92 | 93 | destinationPath = destinationPath, |
93 | 94 | cropTo = to, |
94 | 95 | maskTo = maskToArg) |
@@ -134,7 +135,7 @@ makeFireSenseLCC <- function(neededYear, to, maskTo = NULL, # to, maskTo = NULL, |
134 | 135 | propFlamPath <- .suffix(outPath, "_propFlam") |
135 | 136 | message("Writing output raster to: ", outPath) |
136 | 137 | # Ensure data type supports 0 if original LCC didn't (though usually integer, so fine) |
137 | | - allFlam <- terra::writeRaster(allFlam, filename = outPath, overwrite = TRUE) |
| 138 | + allFlam <- terra::writeRaster(allFlam, filename = outPath, overwrite = overwrite) |
138 | 139 | flammableProp <- writeRaster(flammableProp, filename = propFlamPath, overwrite = TRUE) |
139 | 140 | } |
140 | 141 |
|
|
0 commit comments