Skip to content

Commit

Permalink
streamline prepInputsFireRegimePolys for BEC
Browse files Browse the repository at this point in the history
  • Loading branch information
achubaty committed Feb 20, 2025
1 parent db91141 commit b5dbca2
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 11 deletions.
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ Description: The original fire model is described by Cumming et al. (1998),
URL: https://scfmutils.predictiveecology.org,
https://github.com/PredictiveEcology/scfmutils,
https://predictiveecology.github.io/scfmutils/
Date: 2025-02-13
Version: 2.0.8.9000
Date: 2025-02-19
Version: 2.0.8.9001
Authors@R: c(
person("Steve", "Cumming", email = "[email protected]",
role = c("aut")),
Expand Down
1 change: 1 addition & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# scfmutils (development version)

- add `withr` to Imports from Suggests, for use in examples;
- streamline `prepInputsFireRegimePolys()` for BEC;

# scfmutils 2.0.8

Expand Down
11 changes: 2 additions & 9 deletions R/utils_fireRegimePolys.R
Original file line number Diff line number Diff line change
Expand Up @@ -88,15 +88,8 @@ prepInputsFireRegimePolys <- function(url = NULL, destinationPath = tempdir(),
if (is.null(url)) {
if (grepl("BEC", type)) {
if (requireNamespace("bcdata", quietly = FALSE)) {
bcidList <- list(
becndt = "61044e1a-cd80-4ed6-9f95-907262b9910f",
becsubzone = "f358a53b-ffde-4830-a325-a5a03ff672c3",
beczone = "f358a53b-ffde-4830-a325-a5a03ff672c3"
)
bcid <- bcidList[[tolower(type)]]

tmp <- Cache({
bcdata::bcdc_get_data(bcid) |>
bcdata::bcdc_get_data("f358a53b-ffde-4830-a325-a5a03ff672c3") |>
sf::st_cast("MULTIPOLYGON")
})

Expand Down Expand Up @@ -151,7 +144,7 @@ prepInputsFireRegimePolys <- function(url = NULL, destinationPath = tempdir(),
} else if (grepl("^BEC.*ZONE", type)) {
cols2keep <- c("ZONE", "SUBZONE")
} else if (type == "BECNDT") {
cols2keep <- names(tmp)[names(tmp) %in% "NATURAL_DISTURBANCE_TYPE_CODE"]
cols2keep <- names(tmp)[names(tmp) %in% "NATURAL_DISTURBANCE"]
} else if (type == "FRT") {
cols2keep <- "Cluster"
} else if (type == "FRU") {
Expand Down

0 comments on commit b5dbca2

Please sign in to comment.