Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update main! #86

Merged
merged 195 commits into from
Jun 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
195 commits
Select commit Hold shift + click to select a range
5609133
allow sppNameVector
eliotmcintire Mar 2, 2022
362c463
Merge branch 'development' into sppNameVector
eliotmcintire Mar 9, 2022
746a6b6
bugfix when cohortDefinitionCols has B (e.g., partial mortality)
eliotmcintire Mar 13, 2022
3477d23
minor improvement to example setup
Mar 29, 2022
94a25ab
spell out LBSE in header
Mar 29, 2022
d812a06
Merge branch 'addManualRmd' into development
Mar 29, 2022
7fba9d5
Merge branch 'development' into initialBglobal
Mar 29, 2022
f107a03
rm dot from `P(sim)$initialB` & check value across modules
Mar 29, 2022
599d9a2
knitr cache is only logical now
Apr 6, 2022
2861039
change pipe table to list
Apr 7, 2022
327f883
fixes for latex
Apr 7, 2022
7d57cb6
Merge branch 'addManualRmd' into initialBglobal
Apr 7, 2022
a770a30
need LandR@LANDISinitialB to pass `initialB = NA/NULL`
Apr 7, 2022
c9c35fb
use LandR::sppHarmonize to make sppEquiv etc.
Apr 12, 2022
8e0a17d
minor
Apr 12, 2022
4a3c79e
Merge pull request #59 from PredictiveEcology/sppNameVector
Apr 12, 2022
8a8149f
Merge remote-tracking branch 'upstream/development' into development
Apr 12, 2022
50f278c
bump LandR version
Apr 12, 2022
7aaa501
Merge branch 'development' into initialBglobal
Apr 12, 2022
2aedd94
bump LandR version
Apr 12, 2022
2c0ed25
bump LandR
Apr 12, 2022
703ba7c
add assertSppVectors
Apr 12, 2022
258c157
bump LandR
Apr 12, 2022
d1dded6
add missing dependency
Apr 12, 2022
832b8ce
add assertSppVectors
Apr 12, 2022
ce6a18a
add missing dependency
Apr 13, 2022
bfba27d
Merge branch 'temp' into sppNameVector
Apr 13, 2022
8f228a4
Merge pull request #63 from PredictiveEcology/sppNameVector
Apr 13, 2022
15b7be8
Merge remote-tracking branch 'upstream/development' into development
Apr 13, 2022
5c50017
merge branch from usptream
Apr 14, 2022
163421c
bugfix: sppEquivCol is a parameter
Apr 21, 2022
ab184fe
Merge pull request #64 from PredictiveEcology/sppNameVector
Apr 21, 2022
bcf284a
Merge remote-tracking branch 'upstream/development' into development
Apr 21, 2022
790dac5
Merge remote-tracking branch 'upstream/development' into initialBglobal
Apr 21, 2022
8e035b2
bugfix, can't assign to P(sim) (duh!)
Apr 22, 2022
bf382d8
Merge pull request #65 from CeresBarros/bugfix
Apr 22, 2022
931e97b
Merge remote-tracking branch 'upstream/development' into sppNameVector
May 2, 2022
e7f210a
bugfix: pass `studyArea` to `sppHarmonize`
May 2, 2022
4d33156
Merge pull request #66 from CeresBarros/sppNameVector
May 2, 2022
ac032f1
minor cleanup
achubaty May 3, 2022
3d1bc4b
Merge remote-tracking branch 'upstream/development' into development
May 5, 2022
cafee08
fix figure size -manual
May 27, 2022
2822d95
Merge pull request #67 from CeresBarros/manualFix
May 27, 2022
9876239
Merge remote-tracking branch 'upstream/development' into development
May 27, 2022
7148674
table fixes -- not finished
Jun 2, 2022
9fbf9d5
Merge branch 'manualFixes' into development
Jun 2, 2022
75a092c
manual edits: minor
Jun 2, 2022
d9b51b5
manual edits: add sppNamesVector
Jun 2, 2022
179b15c
re-knit
Jun 2, 2022
657d8f0
use LandR from PredictiveEcology instead of CeresBarros
achubaty Jun 21, 2022
025a0a0
Update Biomass_core.R
achubaty Jun 21, 2022
bbc4662
Merge branch 'development' into initialBglobal
achubaty Jun 21, 2022
c603c82
Merge pull request #62 from CeresBarros/initialBglobal
achubaty Jun 21, 2022
9866b41
bump min LandR version reqd
achubaty Jun 21, 2022
236d7a7
Merge remote-tracking branch 'upstream/development' into development
Jun 21, 2022
4b02305
need latest LandR
achubaty Jun 29, 2022
bc02fd8
v minor
achubaty Jun 30, 2022
12c4ad6
remove RandomFields dependency
achubaty Sep 7, 2022
adf7f3b
httr::config(ssl_verify) controlled by module param
achubaty Sep 8, 2022
0fb4fae
metadata description formatting
achubaty Sep 9, 2022
31edabf
use latest LandR pkg
achubaty Sep 9, 2022
bd93f35
Merge remote-tracking branch 'upstream/development' into development
Oct 14, 2022
f949108
Merge remote-tracking branch 'origin/development' into development
Oct 14, 2022
3530309
fix GitHub Actions wrkflow: need bookdown
Oct 14, 2022
f72956c
simplify GHA workflow to rubild Rmd
achubaty Oct 18, 2022
ba7303a
GHA: render rmd needs bookdown
achubaty Oct 18, 2022
5906930
sslVerify as integer
achubaty Oct 18, 2022
cadba84
Merge remote-tracking branch 'origin/development' into development
achubaty Oct 18, 2022
7861d43
Update render-module-rmd.yaml
achubaty Oct 19, 2022
edd5dbf
Re-build Biomass_core.Rmd
actions-user Oct 19, 2022
17234ec
Merge remote-tracking branch 'upstream/development' into development
Oct 19, 2022
a90060d
metadata cleanup
achubaty Oct 19, 2022
c535543
fix assertions during plotting (close #73)
achubaty Oct 19, 2022
f1556fd
need latest LandR (with prev and #73)
achubaty Oct 19, 2022
8a57a37
Re-build Biomass_core.Rmd
actions-user Oct 19, 2022
49f66c8
Merge remote-tracking branch 'upstream/development' into development
Oct 19, 2022
4cc5a8c
Merge pull request #61 from CeresBarros/development
achubaty Oct 19, 2022
a3943aa
temporary: example trait/parameter tables for manual
Oct 19, 2022
99423a1
Merge remote-tracking branch 'upstream/development' into development
Oct 19, 2022
0dfb09f
[skip-ci] GHActions: improved worfklow
Nov 3, 2022
0d05fa8
metadata: pkg bumps and re-organisation
Nov 3, 2022
28c742f
metadata: .sslVerify needs to be integer
Nov 3, 2022
403b621
bugfix: need Plots(..., usePlot = TRUE, fn = NULL)
Nov 3, 2022
12efc55
bump to v1.3.10
Nov 3, 2022
c6a8701
manual changes: formatting and rendering updates
Nov 3, 2022
0f74d5d
manual: clean up old code
Nov 3, 2022
ad9dd6c
manual: fix conflict between master & development
Nov 3, 2022
50e97d7
manual: revamp working example
Nov 3, 2022
c081e5b
manual: minor textual change
Nov 3, 2022
9118542
manual: render
Nov 3, 2022
8191b0b
manual: fix table formatting
Nov 4, 2022
a82173e
Merge pull request #76 from PredictiveEcology/resync-devel
Nov 4, 2022
af0134d
Re-build Biomass_core.Rmd
actions-user Nov 18, 2022
0a6af17
metadata cleanup
achubaty Feb 22, 2023
1353d41
metadata formatting
achubaty Feb 22, 2023
94e6bf7
Re-build Biomass_core.Rmd
actions-user Feb 22, 2023
d2334bf
fix typo (partial matching) in plotting
achubaty Feb 22, 2023
a7bd136
Merge branch 'development' of ssh://github.com/PredictiveEcology/Biom…
achubaty Feb 22, 2023
2bd6322
Re-build Biomass_core.Rmd
actions-user Feb 22, 2023
4dec6c3
Merge remote-tracking branch 'upstream/development' into development
Mar 9, 2023
94e03ef
metadata cleanup and improvement (minor)
Mar 9, 2023
58e7a1e
Re-build Biomass_core.Rmd
actions-user Mar 9, 2023
19d6a95
Re-build Biomass_core.Rmd
actions-user Mar 9, 2023
efca8c9
rm reproducible deprecated args
Jul 24, 2023
3583166
Merge remote-tracking branch 'upstream/development' into deprecatedArgs
Jul 26, 2023
6e2e9b2
metadata: RasterLayer -> SpatRaster
Jul 26, 2023
484ca7f
metadata: SPDF -> sfc
Jul 26, 2023
d8af514
compareRaster -> .compareRas
Jul 26, 2023
5db4cb8
compareCRS -> .compareCRS
Jul 26, 2023
439c42a
spTransform -> projectInputs
Jul 26, 2023
e86aa15
ras[]/getValues(ras) -> as.vector(ras[])/as.vector(values(ras))
Jul 26, 2023
078726e
raster::mask/projection-> mask/crs
Jul 26, 2023
3532a17
use new methods flow to make RTM
Jul 26, 2023
6844e89
do rawBiomassMap and RTM steps if needRTM==TRUE
Jul 27, 2023
4141496
rm unused object
Jul 27, 2023
f41530c
add Biomass_sspParameters to loadOrder
Aug 1, 2023
7bf8095
document functions
Aug 4, 2023
c7092e4
minorissimo
Aug 4, 2023
62c31e6
more documenting
Aug 4, 2023
3807b1f
add stage arg checks
Aug 4, 2023
c190474
minor: more code readability
Aug 4, 2023
dfcb9ef
minor: metadata desc
Aug 4, 2023
9caf7df
compareRaster -> .compareRas
Aug 4, 2023
6b2f0ce
more param checks and organize code
Aug 4, 2023
8c46b62
bugfix: .compareRas argument
Aug 4, 2023
d7f2bd4
arg name changed in .compareRas
Aug 21, 2023
7f68ce2
add LANDIS ref
Aug 21, 2023
48869a0
minor: metadata improvements
Aug 21, 2023
9801c2b
Merge remote-tracking branch 'upstream/development' into development
Sep 14, 2023
0ca6628
rm unused objs/args
Sep 14, 2023
940fcf2
export first `simulatedBiomassMap` (init) to sim
Sep 14, 2023
5b22b39
use `verbose` arg in dispersal functions
Sep 14, 2023
c29e2a3
minorissimo
Sep 14, 2023
f2e9249
Merge branch 'cleanup' into terra-migration
Sep 16, 2023
6b1c57a
cleanup + fix sections for use with Rstudio
achubaty Sep 21, 2023
c0f69d3
use figurePath()
achubaty Sep 21, 2023
171f838
update SpaDES.core
Sep 26, 2023
92fcb2e
Merge remote-tracking branch 'upstream/terra-migration' into terra-mi…
Sep 26, 2023
3ef5e77
add terra to module pkgDeps
achubaty Sep 27, 2023
c474226
Merge branch 'terra-migration' of ssh://github.com/PredictiveEcology/…
achubaty Sep 27, 2023
298b35e
add function prefix to allow building of manual
achubaty Aug 17, 2023
00f0224
citation cleanup + add Scheller et al. 2007
achubaty Aug 17, 2023
ba13500
more terra-izing
eliotmcintire Oct 21, 2023
c7b8e53
don't use "mod$groupSize"... just `groupSize`
eliotmcintire Nov 10, 2023
be53b67
calculateSumB -- add "verbose" so can limit noisiness
eliotmcintire Nov 10, 2023
6dae16b
tags -- use OtherFunction instead of function
eliotmcintire Nov 10, 2023
a7c3697
Re-build Biomass_core.Rmd
actions-user Nov 10, 2023
4d7c5f3
otherFunctions
eliotmcintire Nov 10, 2023
62973c5
Merge remote-tracking branch 'origin/development' into development
Nov 10, 2023
d2be97f
Re-build Biomass_core.Rmd
actions-user Nov 10, 2023
f6aef16
can't use mask; may be diff crs
eliotmcintire Dec 2, 2023
1225cfa
Re-build Biomass_core.Rmd
actions-user Dec 2, 2023
1bc62f3
cohortDefinitionCols -- rm ad hoc addition; must be in metadata
eliotmcintire Jan 22, 2024
df983f2
Re-build Biomass_core.Rmd
actions-user Jan 22, 2024
7c84846
use inputPath instead of dataPath per latest best practices
achubaty Apr 19, 2024
3eaae18
Re-build Biomass_core.Rmd
actions-user Apr 19, 2024
aedae8e
minor metadata formatting
achubaty May 7, 2024
c8279f6
Re-build Biomass_core.Rmd
actions-user May 7, 2024
999c303
[v1.4.0] use latest LandR with assertSpeciesTable
achubaty May 10, 2024
4fb5969
Re-build Biomass_core.Rmd
actions-user May 10, 2024
1005b40
minor metadata formatting
achubaty May 17, 2024
c3996de
Merge branch 'development' of ssh://github.com/PredictiveEcology/Biom…
achubaty May 17, 2024
a9ba455
Re-build Biomass_core.Rmd
actions-user May 17, 2024
949dddf
switch to stable versions of pkgs where possible
CeresBarros May 29, 2024
1e90fc4
bump v1.4.1
CeresBarros May 29, 2024
24ec319
bump reproducible
CeresBarros May 30, 2024
4311af7
minor
CeresBarros May 30, 2024
c043974
bump SpaDES.core & rm `figurePath()`
CeresBarros May 31, 2024
ab6ffde
Re-build Biomass_core.Rmd
actions-user May 31, 2024
3e5eac2
speciesLayers may not yet exist during .inputObjects
CeresBarros May 31, 2024
c7d5bc3
one .compareRas needs stopOnError = FALSE
CeresBarros May 31, 2024
93803e3
bump v1.4.1.9001
CeresBarros Jun 4, 2024
9d11977
LandR@development -> LandR
CeresBarros Jun 5, 2024
033203e
bump v1.4.1.9002
CeresBarros Jun 5, 2024
0678d84
minor
CeresBarros Jun 5, 2024
2028f1c
assert spp vectors/sppEquiv/species earlier
CeresBarros Jun 5, 2024
f9da844
filter sppEquiv/sppColorV/sppNameVect to simulated species
CeresBarros Jun 5, 2024
4b9ee2a
minor
CeresBarros Jun 5, 2024
5adee0d
use mo$sppEquiv throughout
CeresBarros Jun 5, 2024
85a3716
bump v1.4.1.9003
CeresBarros Jun 5, 2024
f821e2c
Re-build Biomass_core.Rmd
actions-user Jun 5, 2024
e956b81
Merge remote-tracking branch 'upstream/development' into bugfixes
CeresBarros Jun 6, 2024
ec7ed03
Update Biomass_core.R LandR@development >=1.1.3
eliotmcintire Jun 6, 2024
fe50711
Re-build Biomass_core.Rmd
actions-user Jun 6, 2024
6f61feb
2 cohorts become identical ... cohort 1 = 14 B and 2 = 15 B at start …
Jun 6, 2024
0325ab0
Merge branch 'development' into bugfixes
achubaty Jun 6, 2024
ec1f66e
Merge pull request #84 from CeresBarros/bugfixes
eliotmcintire Jun 6, 2024
29b1222
Merge branch 'development' into LandRAssertionFix
eliotmcintire Jun 6, 2024
07c9664
Re-build Biomass_core.Rmd
actions-user Jun 6, 2024
0c277e3
Merge pull request #85 from PredictiveEcology/LandRAssertionFix
eliotmcintire Jun 6, 2024
2ad1d2d
Re-build Biomass_core.Rmd
actions-user Jun 6, 2024
0e9e68e
allow mixedType = 0 with latest LandR
achubaty Jun 6, 2024
d3b3bb2
Re-build Biomass_core.Rmd
actions-user Jun 6, 2024
d2d0738
Merge remote-tracking branch 'upstream/main' into development
CeresBarros Jun 7, 2024
1cf62b6
rm development from GHA manual render
CeresBarros Jun 7, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions .github/workflows/render-module-rmd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,10 @@ on:
branches:
- main
- master
- development
push:
branches:
- main
- master
- development
paths:
- .github/workflows/render-module-rmd.yaml
- Biomass_core.Rmd
Expand Down
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,13 @@ citations/*.csl
*_cache/
*_files/

## don't ignore tables needed for manual
!tables/*

## these are downloaded automatically, no point in caching
figures/*Badge.png

CHECKSUMS.txt


Biomass_core2.Rmd
812 changes: 407 additions & 405 deletions Biomass_core.R

Large diffs are not rendered by default.

27 changes: 14 additions & 13 deletions Biomass_core.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -388,8 +388,8 @@ further detail.
\blandscape

```{r invariantSpptraits, echo = FALSE, eval = TRUE, message = FALSE, results = 'asis'}
tab <- read.xlsx("tables/exampleTables.xlsx", sheet = "invariantTraits",
colNames = TRUE, sep.names = " ")
tab <- openxlsx::read.xlsx("tables/exampleTables.xlsx", sheet = "invariantTraits",
colNames = TRUE, sep.names = " ")
caption <- paste("Example of an invariant species traits table (the",
"`species` table object in the module), with species (ref:Abie-sp),",
"(ref:Pice-eng), (ref:Pice-gla), (ref:Pinu-sp), (ref:Popu-sp) and (ref:Pseud-men).",
Expand Down Expand Up @@ -597,6 +597,13 @@ dynamics. Should contain one colour per species in the `species` table and,
potentially a colour for species mixtures (named "Mixed"). Vector names must
follow `species$speciesCode`.

- `sppNameVector` -- (OPTIONAL) a character vector of species to be simulated.
If provided, *Biomass_core* uses this vector to (attempt to) obtain `speciesLayers`
for the listed species. If not provided, the user (or another module) can pass a filtered `sppEquiv` table
(i.e., containing only the species that are to be simulated). If neither is provided,
then *Biomass_core* attempts to use any species for which if finds available species
(ref:percent) cover data in the study area.

**Cohort-simulation-related objects**

- `cohortData` -- a `data.table` containing initial cohort information per
Expand All @@ -618,7 +625,7 @@ columns:

- *mortality* -- integer. Cohort dead biomass of the current year in
$g/m^2$. Usually filled with 0s in initial conditions.

- *aNPPAct* -- integer. Actual aboveground net primary productivity of the
current year in $g/m^2$. `B` is the result of the previous year's `B`
minus the current year's `mortality` plus `aNPPAct`. Usually filled with
Expand Down Expand Up @@ -736,14 +743,11 @@ However, any of the objects changed/output by *Biomass_core* (listed in Table
\@ref(tab:moduleOutputs-Biomass-core)) can be saved via the `outputs` argument
in `simInit`[^biomass_core-5].

\newpage
\blandscape

```{r moduleOutputs-Biomass-core, echo = FALSE, eval = TRUE, message = FALSE, results = 'asis'}
df_outputs <- moduleOutputs("Biomass_core", "..")
caption <- "List of (ref:Biomass-core) output objects and their description."

panble(df_outputs, caption, landscape = TRUE,
panble(df_outputs, caption,
panderArgs = list("justify" = "left",
"digits" = 3, "split.cells" = c(15, 15, 40), "split.tables" = Inf),
kable_stylingArgs = list(full_width = TRUE))
Expand Down Expand Up @@ -1053,10 +1057,8 @@ dir.create(pkgPath, recursive = TRUE)
.libPaths(pkgPath, include.site = FALSE)

if (!require(Require, lib.loc = pkgPath)) {
remotes::install_github(
paste0("PredictiveEcology/",
"Require@5c44205bf407f613f53546be652a438ef1248147"),
upgrade = FALSE, force = TRUE)
remotes::install_github("PredictiveEcology/Require@5c44205bf407f613f53546be652a438ef1248147",
upgrade = FALSE, force = TRUE)
library(Require, lib.loc = pkgPath)
}

Expand All @@ -1077,8 +1079,7 @@ dependencies are installed in their correct version.
modules in the `paths$modulePath`, and `Require` installs them.

```{r getModule-Biomass-core, eval=FALSE}
Require(paste0("PredictiveEcology/",
"SpaDES.project@6d7de6ee12fc967c7c60de44f1aa3b04e6eeb5db"),
Require("PredictiveEcology/SpaDES.project@6d7de6ee12fc967c7c60de44f1aa3b04e6eeb5db",
require = FALSE, upgrade = FALSE, standAlone = TRUE)

paths <- list(inputPath = normPath(file.path(tempDir, "inputs")),
Expand Down
222 changes: 163 additions & 59 deletions Biomass_core.html

Large diffs are not rendered by default.

31 changes: 22 additions & 9 deletions Biomass_core.md
Original file line number Diff line number Diff line change
Expand Up @@ -837,6 +837,13 @@ dynamics. Should contain one colour per species in the `species` table and,
potentially a colour for species mixtures (named "Mixed"). Vector names must
follow `species$speciesCode`.

- `sppNameVector` -- (OPTIONAL) a character vector of species to be simulated.
If provided, *Biomass_core* uses this vector to (attempt to) obtain `speciesLayers`
for the listed species. If not provided, the user (or another module) can pass a filtered `sppEquiv` table
(i.e., containing only the species that are to be simulated). If neither is provided,
then *Biomass_core* attempts to use any species for which if finds available species
(ref:percent) cover data in the study area.

**Cohort-simulation-related objects**

- `cohortData` -- a `data.table` containing initial cohort information per
Expand Down Expand Up @@ -969,6 +976,12 @@ and `B` composition, even if the user supplies other initial groupings
<td style="text-align:left;"> table of species equivalencies. See `LandR::sppEquivalencies_CA`. </td>
<td style="text-align:left;"> NA </td>
</tr>
<tr>
<td style="text-align:left;"> sppNameVector </td>
<td style="text-align:left;"> character </td>
<td style="text-align:left;"> an optional vector of species names to be pulled from `sppEquiv`. Species names must match `P(sim)$sppEquivCol` column in `sppEquiv`. If not provided, then species will be taken from the entire `P(sim)$sppEquivCol` column in `sppEquiv`. See `LandR::sppEquivalencies_CA`. </td>
<td style="text-align:left;"> NA </td>
</tr>
<tr>
<td style="text-align:left;"> studyArea </td>
<td style="text-align:left;"> SpatialPolygonsDataFrame </td>
Expand Down Expand Up @@ -1093,6 +1106,14 @@ event (growth and mortality are always yearly);
<td style="text-align:left;"> NA </td>
<td style="text-align:left;"> A numeric scalar indicating how large each chunk of an internal data.table is, when processing by chunks </td>
</tr>
<tr>
<td style="text-align:left;"> initialB </td>
<td style="text-align:left;"> numeric </td>
<td style="text-align:left;"> 10 </td>
<td style="text-align:left;"> 1 </td>
<td style="text-align:left;"> NA </td>
<td style="text-align:left;"> initial biomass values of new age-1 cohorts. If `NA` or `NULL`, initial biomass will be calculated as in LANDIS-II Biomass Suc. Extension (see Scheller and Miranda, 2015 or `?LandR::.initiateNewCohorts`) </td>
</tr>
<tr>
<td style="text-align:left;"> gmcsGrowthLimits </td>
<td style="text-align:left;"> numeric </td>
Expand Down Expand Up @@ -1133,14 +1154,6 @@ event (growth and mortality are always yearly);
<td style="text-align:left;"> NA </td>
<td style="text-align:left;"> Initial time for the growth event to occur </td>
</tr>
<tr>
<td style="text-align:left;"> initialB </td>
<td style="text-align:left;"> numeric </td>
<td style="text-align:left;"> 10 </td>
<td style="text-align:left;"> 1 </td>
<td style="text-align:left;"> NA </td>
<td style="text-align:left;"> initial biomass values of new age-1 cohorts </td>
</tr>
<tr>
<td style="text-align:left;"> initialBiomassSource </td>
<td style="text-align:left;"> character </td>
Expand Down Expand Up @@ -1243,7 +1256,7 @@ event (growth and mortality are always yearly);
<td style="text-align:left;"> NA </td>
<td style="text-align:left;"> NA </td>
<td style="text-align:left;"> NA </td>
<td style="text-align:left;"> defines the plotting time step. If `NA`, the default, .plotInterval is set to successionTimestep. </td>
<td style="text-align:left;"> defines the plotting time step. If `NA`, the default, `.plotInterval` is set to `successionTimestep`. </td>
</tr>
<tr>
<td style="text-align:left;"> .plots </td>
Expand Down
Binary file added LBSE_LandR_comparisonTables.xlsx
Binary file not shown.
30 changes: 29 additions & 1 deletion R/age-cohorts.R
Original file line number Diff line number Diff line change
@@ -1,3 +1,31 @@
#' Reclassify cohort ages
#'
#' Collapses cohorts into age bins defined by `successionTimestep`,
#' thereby reducing the number of cohorts in a `pixelGroup`.
#'
#' @param cohortData A `data.table` with columns: `pixelGroup`, `ecoregionGroup`,
#' `speciesCode`, and optionally `age`, `B`, `mortality`, `aNPPAct`, and `sumB`.
#' @param successionTimestep The time between successive seed dispersal events.
#' In LANDIS-II, this is called "Succession Timestep".
#' @param stage `character`. Either "spinup" or "nonSpinup", depending on whether
#' the functions is running during spin-up stage or not. See details.
#' @param byGroups columns in `cohortData` defining that will define groups of
#' cohorts whose ages will be collapsed.
#'
#' @detail at each step defined by `successionTimestep` (i.e. if `successionTimestep` = 10,
#' at every 10 years), cohorts are collapsed into age bins defined by
#' `successionTimestep` (i.e. if `successionTimestep` = 10, 10-year bins). When
#' collapsing cohorts, their biomass (B), lost biomass (mortality) and primary
#' productivity (aNPPact) are summed.
#' If `stage == "spinup"` cohorts are not collapsed.
#'
#' @references Scheller, R.M. & Miranda, B.R. (2015). LANDIS-II Biomass Succession v3.2 Extension – User Guide.
#'
#' @return
#' @export
#'
#' @importFrom data.table rbindlist
#' @importFrom LandR asInteger
ageReclassification <- compiler::cmpfun(function(cohortData, successionTimestep, stage,
byGroups = c("pixelGroup", "speciesCode", "age")) {

Expand All @@ -21,7 +49,7 @@ ageReclassification <- compiler::cmpfun(function(cohortData, successionTimestep,
# NOTE: We do not need to squash if there is nothing to squash, i.e., cases with 1 species in a pixelGroup that is <successionTimestep old,
# don't need to be squashed.
anyDuplicates <- duplicated(targetData, by = byGroupsNoAge)
cdColNames <- colnames(cohortData)

message(" Setting all ages <= ", successionTimestep, " to ", successionTimestepPlusOne)
if (any(anyDuplicates)) {
# pull out only duplicated types. NOTE "which = TRUE" gives only the indices of the joined rows;
Expand Down
Loading
Loading