Package 'martelosim'

Title: Report Production from Marteloscopes with Capsis
Description: The goal of this package is to help users in using Capsis softawre and compile reports for field workshops. The workshop consist in predicting management effects on forest stand within the capsis platform.
Authors: Maxime Jaunatre [aut, cre, trl] (ORCID: <https://orcid.org/0009-0002-2816-1677>), INRAE [cph], Benoit Courbaud [aut] (ORCID: <https://orcid.org/0000-0002-3050-9559>)
Maintainer: Maxime Jaunatre <[email protected]>
License: MIT + file LICENSE
Version: 0.1.1
Built: 2026-05-22 13:40:07 UTC
Source: https://forge.inrae.fr/lessem/rpackages/martelosim

Help Index


Build Samsara txt files from xlsx inventory

Description

Build Samsara txt files from xlsx inventory

Usage

build_samsa2_files(
  file = file.path("data", sprintf("Data_Marteloscope_%s.xlsx", getOption("mart_site"))),
  verbose = TRUE
)

Arguments

file

inventory file in xlsx, by default Data_marteloscope_<site>.xlsx

verbose

Allow to print messages. False by default.


Check tinytex

Description

Check tinytex

Usage

check_tinytex_dep(verbose = FALSE)

Arguments

verbose

sho messages


Open or message marking file

Description

Open or message marking file

Usage

find_marking(open = TRUE, verbose = TRUE)

Arguments

open

Open files with sheet editor. TRUE by default

verbose

Write nice messages, TRUE by default


Sapplings height classes

Description

Sapplings height classes

Usage

HClasses

Format

An object of class data.frame with 4 rows and 3 columns.

Source

Benoit Courbaud


iplus traduction for martelage

Description

iplus traduction for martelage

Usage

iplus_action

Format

An object of class data.frame with 4 rows and 3 columns.

Source

Benoit Courbaud


iplus traduction for martelage

Description

iplus traduction for martelage

Usage

iplus_reason

Format

An object of class data.frame with 11 rows and 3 columns.

Source

Benoit Courbaud


Plots color scales for reports

Description

Plots color scales for reports

Usage

mart_scales

Format

An object of class list of length 9.

Source

Benoit Courbaud


Render maps for field identification of interesting trees

Description

Render maps for field identification of interesting trees

Usage

martelo_maps()

Value

Create a pdf file.


Render report for one group

Description

Render report for one group

Usage

martelo_report(
  marking_groups = "X",
  dendrometry = TRUE,
  regeneration = TRUE,
  light = TRUE,
  harvest = TRUE,
  carbon = TRUE,
  biodiversity = TRUE,
  rockfall = TRUE,
  snow = TRUE,
  economy = TRUE,
  multi = FALSE
)

Arguments

marking_groups

Group Name. Must be a group present.

dendrometry

Print the page about this subject. TRUE by default.

regeneration

Print the page about this subject. TRUE by default.

light

Print the page about this subject. TRUE by default.

harvest

Print the page about this subject. TRUE by default.

carbon

Print the page about this subject. TRUE by default.

biodiversity

Print the page about this subject. TRUE by default.

rockfall

Print the page about this subject. TRUE by default.

snow

Print the page about this subject. TRUE by default.

economy

Print the page about this subject. TRUE by default.

multi

Render a different report with only comparative plots

Value

Create a pdf file.


martelosim

Description

Report production from marteloscopes with Capsis

Details

The goal of this package is to help users in using Capsis softawre and compile reports for field workshops. The workshop consist in predicting management effects on forest stand within the capsis platform.

Author(s)

Maintainer: Maxime Jaunatre [email protected] (ORCID) [translator]

Authors:

Other contributors:

  • INRAE [copyright holder]

See Also

Useful links:


Plot the map of a marteloscope

Description

Choose with what column you need to fill the tree points

Usage

martelosim_evol(data, y_col, fill_col, fill_scale, ...)

Arguments

data

data.frame with columns Year.

y_col

column to use for y axis of the plot. Col is because it's geom_area

fill_col

column on which to fill. Write as ggplot input in aes()

fill_scale

manual fill scale to be given as values in scale_fill_manual()

...

scales for action shape and color. color_scale and shape_scale values are set


Plot the map of a marteloscope

Description

Choose with what column you need to fill the tree points

Usage

martelosim_hist(data, x, y, fill, fill_scale, ...)

Arguments

data

data.frame with columns Year.

x

column to plot in x

y

column to plot in y

fill

column on which to fill. Write as ggplot input in aes()

fill_scale

manual fill scale to be given as values in scale_fill_manual()

...

scales for action shape and color. color_scale and shape_scale values are set


Plot the map of a marteloscope

Description

Choose with what column you need to fill the tree points

Usage

martelosim_map(
  data,
  fill_col,
  fill_scale,
  poly,
  label = FALSE,
  action = FALSE,
  limits = NULL,
  ...
)

Arguments

data

data.frame with columns X_m, Y_m, D_cm, Id. Two first are the position of trees, Id a label, D_cm the diameter.

fill_col

column on which to fill. Write as ggplot input in aes()

fill_scale

manual fill scale to be given as values in scale_fill_manual()

poly

polygon of the marteloscope. From inventory

label

TRUE FALSE add labels to trees

action

TRUE FALSE add action shape and color to plot.

limits

NULL by default. Recompute x and y scales

...

scales for action shape and color. color_scale and shape_scale values are set


Log some options for the project.

Description

Log some options for the project.

Usage

martelosim_options(
  capsis_exe_path,
  site,
  date,
  animateur,
  mail_animateur,
  lang = c("en", "fr"),
  verbose = TRUE
)

Arguments

capsis_exe_path

capsis executable path

site

Name of the marteloscope site

date

Date of the marteloscope exercise

animateur

Name of the site animateur

mail_animateur

Contact for the animateur

lang

Language, still in development

verbose

Print nice messages. TRUE by default


Plot the map of a marteloscope with pixels

Description

Choose with what column you need to fill the tree points

Usage

martelosim_pixelmap(
  data,
  treedata,
  fill_col,
  fill_scale,
  poly,
  action = FALSE,
  limits = NULL,
  ...
)

Arguments

data

data.frame with columns X_m, Y_m, Cell_Id. Intended for polygons plots

treedata

data.frame with X_m, Y_m, D_cm and Action columns Two first are the position of trees, Id a label, D_cm the diameter.

fill_col

column on which to fill. Write as ggplot input in aes()

fill_scale

manual fill scale to be given as values in scale_fill_manual()

poly

polygon of the marteloscope. From inventory

action

TRUE FALSE add action shape and color to plot.

limits

NULL by default. Recompute x and y scales

...

scales for action shape and color. color_scale and shape_scale values are set


Create a new inventory from previous marteloscope

Description

Create a new inventory from previous marteloscope

Usage

new_inventory(
  inv_site = c("new", "copy", "Prelenfrey", "Soteska", "Bouges", "Brauze_1", "Crocq",
    "LaChaume", "Brin", "Rindbach", "Nevegal", "Sailershausen1", "Schneidersrangen",
    "ColDePorte", "ColDeLEpine", "Krivoklat", "Collemeluccio", "Haugimont"),
  inv_file = NULL,
  lang = c("en", "fr"),
  open = TRUE,
  verbose = FALSE
)

Arguments

inv_site

name of the site. If the site exist, it will initiate xlsx file for the users. If not, it propose a new empty file (default).

inv_file

NULL by default. If copy, the file to copy in active directory

lang

language, default is "en" but "fr" can be selected. "fr" option is not fully developped.

open

boolean, allow to lauch excell or libre office if available

verbose

Allow to print messages. False by default.

Details

The file name is always Data_Marteloscope_<inv_site>.xlsx and is stored in data/


Prepare Samsara

Description

Write command file for launching samsara2 software and prepare plot

Usage

prepare_samsara(
  create_periphery = TRUE,
  create_virtual_saplings = TRUE,
  range_dbh = c(as.numeric(getOption("mart_recdbh")), 92.5),
  inv_year = as.numeric(getOption("mart_year")),
  inv_mindbh = as.numeric(getOption("mart_recdbh")),
  simulation_year_step = 1,
  memory_perc = 75,
  verbose = FALSE
)

Arguments

create_periphery

Creation of the periphery of the plot. TRUE by default. Must be TRUE for the first simulation, and FALSE later to speed up simulations

create_virtual_saplings

Creation of the saplings of the plot. TRUE by default. Must be TRUE for the first simulation, and FALSE later to speed up simulations

range_dbh

range of dbh for tree diameter classes.

inv_year

year of the inventory. Used to define the starting year of simulations. Value retrievedfrom inventory file.

inv_mindbh

inventory minimum dbh. Value retrieved from inventory file.

simulation_year_step

Simulation year step, value by default is 1.

memory_perc

Percentage of computer RAM affected to CAPSIS. default is 75%.

verbose

Print messages or not.


Write a random marking file

Description

Write a random marking file

Usage

random_marking(name = "Random", verbose = TRUE, open = FALSE)

Arguments

name

name of the marking. Default is "Random"

verbose

Print nice messages. TRUE by default

open

Open the file. FALSE by default


Run Samsara software

Description

Run Samsara software

Usage

run_samsara(
  commandFile = sprintf("%s_Martelo_CommandFile.txt", getOption("mart_site")),
  combineOutputs = TRUE,
  memory_perc = 75,
  verbose = TRUE
)

Arguments

commandFile

Default command file to use is the one with the site name.

combineOutputs

Not used yet, if needs to combine outputs

memory_perc

75 percentage of RAM is used by default if memory > 4Gb.

verbose

print logs in terminal or not. TRUE by default


Write command file for launching samsara2 software and prepare plot

Description

Write command file for launching samsara2 software and prepare plot

Usage

write_prep_samsara_cmd(
  create_periphery = TRUE,
  create_virtual_saplings = TRUE,
  range_dbh = c(as.numeric(getOption("mart_recdbh")), 92.5),
  inv_year = as.numeric(getOption("mart_year")),
  inv_mindbh = as.numeric(getOption("mart_recdbh")),
  simulation_year_step = 1,
  verbose = FALSE
)

Arguments

create_periphery

Creation of the periphery of the plot. TRUE by default. Must be TRUE for the first simulation, and FALSE later to speed up simulations

create_virtual_saplings

Creation of the saplings of the plot. TRUE by default. Must be TRUE for the first simulation, and FALSE later to speed up simulations

range_dbh

range of dbh for tree diameter classes.

inv_year

year of the inventory. Used to define the starting year of simulations. Value retrievedfrom inventory file.

inv_mindbh

inventory minimum dbh. Value retrieved from inventory file.

simulation_year_step

Simulation year step, value by default is 1.

verbose

Print messages or not.


Write command file for launching samsara2 software

Description

Write command file for launching samsara2 software

Usage

write_samsara_cmd(
  marking_groups,
  thinning_time,
  evolution_time,
  create_periphery = FALSE,
  create_virtual_saplings = FALSE,
  range_dbh = c(as.numeric(getOption("mart_recdbh")), 92.5),
  inv_year = as.numeric(getOption("mart_year")),
  inv_mindbh = as.numeric(getOption("mart_recdbh")),
  simulation_year_step = 1,
  silviculture = c("auto", "expert"),
  verbose = FALSE
)

Arguments

marking_groups

list of marking_groups to build the command file for. Under development so it use all marking_groups at this time

thinning_time

Time between management actions

evolution_time

Total duration of the simulation

create_periphery

Creation of the periphery of the plot. TRUE by default. Must be TRUE for the first simulation, and FALSE later to speed up simulations

create_virtual_saplings

Creation of the saplings of the plot. TRUE by default. Must be TRUE for the first simulation, and FALSE later to speed up simulations

range_dbh

range of dbh for tree diameter classes.

inv_year

year of the inventory. Used to define the starting year of simulations. Value retrievedfrom inventory file.

inv_mindbh

inventory minimum dbh. Value retrieved from inventory file.

simulation_year_step

Simulation year step, value by default is 1.

silviculture

Choice between "auto" and "expert", for building data/Silviculture file.

verbose

Print messages or not.