assertions: Assertions

Description Usage Arguments Note

Description

Assert that ecoregionCodes that were replaced, were correctly identified.

Assert that ecoregionCodes that were replaced, were correctly identified.

This is the full pixelCohortData, not the collapsed one.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
assert1(
  cohortData34to36,
  cohortData,
  rmZeroBiomassQuote,
  classesToReplace = 34:36,
  doAssertion = getOption("LandR.assertions", TRUE)
)

assert2(
  cohortDataNo34to36,
  classesToReplace = 34:36,
  doAssertion = getOption("LandR.assertions", TRUE)
)

assertUniqueCohortData(
  cohortData,
  columns,
  doAssertion = getOption("LandR.assertions", TRUE)
)

assertERGs(
  ecoregionMap,
  cohortData,
  speciesEcoregion,
  minRelativeB,
  doAssertion = getOption("LandR.assertions", TRUE)
)

assertColumns(
  obj,
  colClasses,
  doAssertion = getOption("LandR.assertions", TRUE)
)

assertCohortData(
  cohortData,
  pixelGroupMap,
  sim,
  maxExpectedNumDiverge = 1,
  message = "",
  doAssertion = getOption("LandR.assertions", TRUE),
  verbose = getOption("LandR.verbose", TRUE),
  cohortDefinitionCols = c("pixelGroup", "age", "speciesCode")
)

assertPixelCohortData(
  pixelCohortData,
  pixelGroupMap,
  doAssertion = getOption("LandR.assertions", TRUE)
)

assertSpeciesPlotLabels(
  speciesNames,
  sppEquiv,
  doAssertion = getOption("LandR.assertions", TRUE)
)

assertFireToleranceDif(
  burnedPixelCohortData,
  doAssertion = getOption("LandR.assertions", TRUE)
)

assertSpeciesLayers(
  speciesLayers,
  thresh,
  doAssertion = getOption("LandR.assertions", TRUE)
)

assertRstLCChange(
  rstLCChange,
  rasterToMatch,
  doAssertion = getOption("LandR.assertions", TRUE)
)

Arguments

cohortData34to36

A cohortData data.table with only the pixels what were LCC 34:36

cohortData

A data.table with columns: pixelGroup, ecoregionGroup, speciesCode, and optionally age, B, mortality, aNPPAct, and sumB.

rmZeroBiomassQuote

An expression to evaluate, in the form of quote(B>0), used to select cohorts with biomass.

classesToReplace

Integer vector of classes that are are to be replaced, e.g., 34, 35, 36 on LCC2005, which are burned young, burned 10 year, and cities.

doAssertion

A logical indicating whether some internal tests should be run to ensure the function is running correctly. Default: getOption("LandR.assertions", TRUE).

cohortDataNo34to36

A cohortData data.table with only the pixels what were LCC 34:36

columns

Vector of column names on which to test for unique cohortData

ecoregionMap

The ecoregionMap, a raster of all the unique groupings

speciesEcoregion

A data.table with speciesEcoregion values.

minRelativeB

TODO: add description

obj

A data.frame or data.table-like object

colClasses

A named vector of column classes, where the names are the column names

pixelGroupMap

A RasterLayer with pixel values equal to a pixel group number that corresponds exactly to pixelGroup column in cohortData.

sim

If the simList is included, then the browser() call will be more useful.

maxExpectedNumDiverge

A numeric, length 1, indicating by how many they can diverge. Default 1.

message

An optional message to print. This may help identify where this function was called.

verbose

Controls message output. Defaults to getOption("LandR.verbose")

cohortDefinitionCols

the columns in cohortData that define unique cohorts

pixelCohortData

The full cohortData data.table

speciesNames

A vector of species names for which the labels will be checked

sppEquiv

table with species name equivalencies between the kNN and final naming formats. See data("sppEquivalencies_CA", "LandR"). Only necessary if mixedType == 2. If not provided and mixedType == 2, will attempt to use data("sppEquivalencies_CA", "LandR").

burnedPixelCohortData

An expanded cohortData data.table with pixel-level cohort information on burnt pixels and columns: severity - fire severity in that pixel calculated based on fire behaviour properties; firetolerance - species-level fire tolerance; severityToleranceDif - the difference between severity and firetolerance.

speciesLayers

A RasterStack or RasterLayer that should contain species cover data in the study area

thresh

the minimum number of pixels where the species must have biomass > 0 to be considered present in the study area. Defaults to 1.

rstLCChange

a raster layer indicating pixels were land-use change occurred as 1s

rasterToMatch

A RasterLayer objects to use as the template for all subsequent raster operations (i.e., the one used throughout the simulation).

Note

TODO


PredictiveEcology/LandR documentation built on Jan. 24, 2021, 12:52 a.m.