Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/development' into development
Browse files Browse the repository at this point in the history
  • Loading branch information
achubaty committed Oct 13, 2023
2 parents bcc9d45 + a87c0cd commit 02cd250
Show file tree
Hide file tree
Showing 33 changed files with 429 additions and 176 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ URL:
https://landr.predictiveecology.org,
https://github.com/PredictiveEcology/LandR
Date: 2023-10-13
Version: 1.1.0.9068
Version: 1.1.0.9069
Authors@R: c(
person("Eliot J B", "McIntire", email = "[email protected]",
role = c("aut", "cre"), comment = c(ORCID = "0000-0002-6914-8316")),
Expand Down
5 changes: 4 additions & 1 deletion NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export(FireDisturbance)
export(FireDisturbancePM)
export(LANDISDisp)
export(NAcover2zero)
export(PeatlandThermokarst)
export(Ward)
export(addNoPixel2CohortData)
export(addPixels2CohortData)
Expand All @@ -29,7 +30,7 @@ export(assertERGs)
export(assertFireToleranceDif)
export(assertPixelCohortData)
export(assertPixelCohortDataValid)
export(assertPostFireDist)
export(assertPostPartialDist)
export(assertRepsAllCohortData)
export(assertRstLCChange)
export(assertSpeciesEcoregionCohortDataMatch)
Expand Down Expand Up @@ -62,6 +63,7 @@ export(equivalentName)
export(equivalentNameColumn)
export(extractMaxB)
export(fasterizeFromSp)
export(fitNLMModels)
export(genPGsPostDisturbance)
export(generatePixelGroups)
export(genericExtract)
Expand Down Expand Up @@ -93,6 +95,7 @@ export(modifySpeciesAndSpeciesEcoregionTable)
export(nonForestedPixels)
export(overlayLCCs)
export(overlayStacks)
export(partialggplotMLL_maxB)
export(partitionBiomass)
export(pixelFate)
export(plantNewCohorts)
Expand Down
12 changes: 6 additions & 6 deletions R/assertions.R
Original file line number Diff line number Diff line change
Expand Up @@ -651,26 +651,26 @@ assertSppVectors <- function(sppEquiv = NULL, sppNameVector = NULL, sppColorVect
#'
#' @return NULL
#' @export
assertPostFireDist <- function(cohortDataOrig, pixelGroupMapOrig, cohortDataNew, pixelGroupMapNew,
postFirePixelCohortData, burnedPixelCohortData, doAssertion = getOption("LandR.assertions", TRUE)) {
assertPostPartialDist <- function(cohortDataOrig, pixelGroupMapOrig, cohortDataNew, pixelGroupMapNew,
postDistPixelCohortData, distrbdPixelCohortData, doAssertion = getOption("LandR.assertions", TRUE)) {
if (doAssertion) {
oldPCohortData <- addPixels2CohortData(cohortDataOrig, pixelGroupMapOrig, doAssertion = FALSE)
newPCohortData <- addPixels2CohortData(cohortDataNew, pixelGroupMapNew)

testPGs <- oldPCohortData[pixelGroup %in% postFirePixelCohortData$pixelGroup, pixelGroup]
testPIs <- postFirePixelCohortData[pixelGroup %in% testPGs, pixelIndex]
testPGs <- oldPCohortData[pixelGroup %in% postDistPixelCohortData$pixelGroup, pixelGroup]
testPIs <- postDistPixelCohortData[pixelGroup %in% testPGs, pixelIndex]

cols <- c("pixelIndex", "speciesCode", "age")
test1 <- unique(newPCohortData[pixelIndex %in% testPIs, ..cols])
test2 <- unique(postFirePixelCohortData[pixelIndex %in% testPIs, ..cols])
test2 <- unique(postDistPixelCohortData[pixelIndex %in% testPIs, ..cols])
setorderv(test1, cols)
setorderv(test2, cols)

if (!identical(test1, test2)) {
stop("Post-fire disturbances miscalculated: missing survivor/regenerated cohorts")
}

test3 <- unique(burnedPixelCohortData[B == 0, ..cols])
test3 <- unique(distrbdPixelCohortData[B == 0, ..cols])
test4 <- unique(newPCohortData[, ..cols])
if (nrow(newPCohortData[test3, on = cols, nomatch = 0L])) {
stop("Killed cohorts are still in cohortData table")
Expand Down
40 changes: 20 additions & 20 deletions R/biomodWrappers.R
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ utils::globalVariables(c(
#' @param responseVarData a data.table or list of data.tables with environmental data.
#' If a list, it should be named according to `sp`, for subsetting.#'
#'
#' @param dir.name passed to `biomod2::BIOMOD_FormatingData`
#' @param dir.name passed to [biomod2::BIOMOD_FormatingData]
#'
#' @param BIOMOD_ModelingArgs a named list of arguments passed to `biomod2::BIOMOD_Modeling`
#' @param BIOMOD_ModelingArgs a named list of arguments passed to [biomod2::BIOMOD_Modeling]
#'
#' @param ... further arguments passed to `reproducible::Cache`
#' @param ... further arguments passed to [reproducible::Cache]
#'
#' @export
biomodModelingWrapper <- function(sp, responseVar, responseVarData, predictorVars, predictorVarsData,
Expand Down Expand Up @@ -165,10 +165,10 @@ biomodModelingWrapper <- function(sp, responseVar, responseVarData, predictorVar
}

#' BIOMOD_EnsembleModeling wrapper
#' @param bm.mod output of `biomod2::BIOMOD_Modeling`
#' @param metric.select.thresh passed `biomod2::BIOMOD_EnsembleModeling`.
#' @param bm.mod output of [biomod2::BIOMOD_Modeling]
#' @param metric.select.thresh passed [biomod2::BIOMOD_EnsembleModeling].
#' By default no thresholding is applied.
#' @param ... passed to Cache
#' @param ... passed to [reproducible::Cache]
#'
#' @export
biomodEnsembleWrapper <- function(bm.mod, metric.select.thresh = NULL, ...) {
Expand Down Expand Up @@ -202,13 +202,13 @@ biomodEnsembleWrapper <- function(bm.mod, metric.select.thresh = NULL, ...) {

#' BIOMOD_Projection wrapper
#'
#' @param bm.mod output of `biomod2::BIOMOD_Modeling`
#' @param bm.mod passed to `biomod2::BIOMOD_Projection`. If not supplied
#' @param bm.mod output of [biomod2::BIOMOD_Modeling]
#' @param bm.mod passed to [biomod2::BIOMOD_Projection]. If not supplied
#' the data used to fit the model will be used.
#' @param proj.name passed to `biomod2::BIOMOD_Projection`
#' @param new.env passed to `biomod2::BIOMOD_Projection`
#' @param new.env.xy passed to `biomod2::BIOMOD_Projection`
#' @param ... passed to Cache
#' @param proj.name passed to [biomod2::BIOMOD_Projection]
#' @param new.env passed to [biomod2::BIOMOD_Projection]
#' @param new.env.xy passed to [biomod2::BIOMOD_Projection]
#' @param ... passed to [reproducible::Cache]
#'
#' @export
biomodProjWrapper <- function(bm.mod, proj.name = "testProj", new.env = NULL, new.env.xy = NULL, ...) {
Expand Down Expand Up @@ -248,21 +248,21 @@ biomodProjWrapper <- function(bm.mod, proj.name = "testProj", new.env = NULL, ne
}


#' Simple wrapper around `biomod2::BIOMOD_EnsembleForecasting()`
#' Simple wrapper around [biomod2::BIOMOD_EnsembleForecasting()]
#'
#' @param bm.em output of `biomod2::BIOMOD_EnsembleModeling`
#' @param bm.em output of [biomod2::BIOMOD_EnsembleModeling]
#'
#' @param bm.proj output of `biomod2::BIOMOD_Projection`
#' @param bm.proj output of [biomod2::BIOMOD_Projection]
#'
#' @param proj.name passed to `biomod2::BIOMOD_Projection`
#' @param proj.name passed to [biomod2::BIOMOD_Projection]
#'
#' @param new.env passed to `biomod2::BIOMOD_EnsembleForecasting`
#' @param new.env passed to [biomod2::BIOMOD_EnsembleForecasting]
#'
#' @param new.env.xy passed to `biomod2::BIOMOD_EnsembleForecasting`
#' @param new.env.xy passed to [biomod2::BIOMOD_EnsembleForecasting]
#'
#' @param keep.in.memory passed to `biomod2::BIOMOD_EnsembleForecasting`
#' @param keep.in.memory passed to [biomod2::BIOMOD_EnsembleForecasting]
#'
#' @param ... passed to `reproducible::Cache`
#' @param ... passed to [reproducible::Cache]
#'
#' @export
biomodEnsembleFrcstWrapper <- function(bm.em, bm.proj = NULL, proj.name = NULL, new.env = NULL,
Expand Down
Loading

0 comments on commit 02cd250

Please sign in to comment.