Skip to contents
library(landisutils)

tmp_pth <- withr::local_tempdir("example_BiomassSuccession_")

Sample extension inputs

All sample values from Biomass Succession v7.0 test files (for LANDIS-II v8): https://github.com/LANDIS-II-Foundation/Extension-Biomass-Succession/blob/master/testings/CoreV8.0-BiomassSuccession7.0/biomass-succession.txt

min_rel_b <- tibble::tribble(
  ~ShadeClass , ~Eco1 , ~Eco2  , ## TODO adjust colnames
  NA_integer_ , "101" , "102"  ,
  1L          , "25%" , "25%"  ,
  2L          , "45%" , "45%"  ,
  3L          , "56%" , "56%"  ,
  4L          , "70%" , "70%"  ,
  5L          , "90%" , "90% "
)

suff_light <- tibble::tribble(
  ~class , ~X0 , ~X1 , ~X2  , ~X3  , ~X4  , ~X5  ,
  1L     , 1.0 , 0.5 , 0.25 , 0.0  , 0.0  , 0.0  ,
  2L     , 1.0 , 1.0 , 0.5  , 0.25 , 0.0  , 0.0  ,
  3L     , 1.0 , 1.0 , 1.0  , 0.5  , 0.25 , 0.0  ,
  4L     , 1.0 , 1.0 , 1.0  , 1.0  , 0.5  , 0.25 ,
  5L     , 0.1 , 0.5 , 1.0  , 1.0  , 1.0  , 1.0
)

erp_df <- tibble::tribble(
  ~ecoregion , ~AET ,
  "101"      ,  600 ,
  "102"      ,  600
)

frp_df <- tibble::tribble(
  ~Severity , ~WoodLitterReduct , ~LitterReduct ,
  1L        , 0.0               , 0.5           ,
  2L        , 0.0               , 0.75          ,
  3L        , 0.0               , 1.0
)

hrp_df <- tibble::tribble(
  ~Name            , ~WoodLitterReduct , ~LitterReduct , ~CohortWoodRemoval , ~CohortLeafRemoval ,
  "MaxAgeClearcut" , 0.5               , 0.15          , 0.8                , 0.0                ,
  "PatchCutting"   , 1.0               , 1.0           , 1.0                , 0.0
)

Extension configuration

## don't need to function; just need to exist
clim_file <- file.path(tmp_pth, "biomass-succession_ClimateGenerator.txt")
init_comm_files <- c(
  file.path(tmp_pth, "biomass-succession_InitialCommunities.csv"),
  file.path(tmp_pth, "initial-communities.tif")
)
spp_file <- file.path(tmp_pth, "SpeciesData.csv")
spperd_file <- file.path(tmp_pth, "SppEcoregionData.csv")
all_files <- c(clim_file, init_comm_files, spp_file, spperd_file)
purrr::walk2(.x = rep("", length(all_files)), .y = all_files, .f = writeLines)

## create the Biomass Succession extension config object
ext_biomass_succession <- BiomassSuccession$new(
  path = tmp_pth,
  Timestep = 10,
  SeedingAlgorithm = "WardSeedDispersal",
  InitialCommunitiesFiles = init_comm_files,
  ClimateConfigFile = clim_file,
  CalibrateMode = NULL, ## optional
  SpinupCohorts = FALSE, ## optional; v7.1
  SpinupMortalityFraction = 0.05, ## v7.1
  MinRelativeBiomass = min_rel_b,
  SufficientLight = suff_light,
  SpeciesDataFile = spp_file,
  EcoregionParameters = erp_df,
  SpeciesEcoregionDataFile = spperd_file,
  FireReductionParameters = frp_df,
  HarvestReductionParameters = hrp_df
)

ext_biomass_succession$write()

Verify configuration files

readLines(file.path(tmp_pth, ext_biomass_succession$files[1])) |>
  cat(sep = "\n")
#> >> generated by `landisutils` (v0.0.2) on Wed Mar 18 17:26:17 2026
#> >> do not edit by hand; manual changes to this file may be overwritten
#> 
#> LandisData  "Biomass Succession"
#> 
#> Timestep    10
#> 
#> SeedingAlgorithm    "WardSeedDispersal"
#> 
#> InitialCommunities    "biomass-succession_InitialCommunities.csv"
#> InitialCommunitiesMap    "initial-communities.tif"
#> 
#> ClimateConfigFile    "biomass-succession_ClimateGenerator.txt"
#> 
#> CalibrateMode    "no"
#> 
#> SpinupCohorts    "no"
#> 
#> SpinupMortalityFraction    0.05
#> 
#> MinRelativeBiomass
#> >> Shade Class    Ecoregions
#> >> -----------    ------------------------
#>                   NA  101  102
#>    1              1  25%  25%
#>    2              2  45%  45%
#>    3              3  56%  56%
#>    4              4  70%  70%
#>    5              5  90%  90% 
#> 
#> SufficientLight
#> >> Shade Class  Probability by Actual Shade
#> >> -----------  ----------------------------------
#> >>              0     1     2     3     4     5
#>    1            # A tibble: 1 × 6       X0    X1    X2    X3    X4    X5    <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>  1     1   0.5  0.25     0     0     0
#>    2            # A tibble: 1 × 6       X0    X1    X2    X3    X4    X5    <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>  1     1     1   0.5  0.25     0     0
#>    3            # A tibble: 1 × 6       X0    X1    X2    X3    X4    X5    <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>  1     1     1     1   0.5  0.25     0
#>    4            # A tibble: 1 × 6       X0    X1    X2    X3    X4    X5    <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>  1     1     1     1     1   0.5  0.25
#>    5            # A tibble: 1 × 6       X0    X1    X2    X3    X4    X5    <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>  1   0.1   0.5     1     1     1     1
#> 
#> SpeciesDataFile    "SpeciesData.csv"
#> 
#> EcoregionParameters
#> >>    AET (mm)
#> 101  600
#> 102  600
#> 
#> SpeciesEcoregionDataFile    "SppEcoregionData.csv"
#> 
#> FireReductionParameters
#> >>  Severity    WoodLitter    Litter
#> >>  Fire        Reduction     Reduction
#> 1  0  0.5
#> 2  0  0.75
#> 3  0  1
#> 
#> HarvestReductionParameters
#> >>      Name    DeadWood    DeadLitter    Cohort        Cohort
#> >>              Reduction   Reduction     WoodRemoval   LeafRemoval
#> MaxAgeClearcut      0.5      0.15      0.8      0
#> PatchCutting      1.0      1.00      1.0      0

skip initial communities files

Cleanup

withr::deferred_run()
#> Ran 1/1 deferred expressions