Package {FeNEU}


Type: Package
Title: Routines for Evaluating Forest Inventory Data
Version: 3.0.2
Date: 2026-08-27
Description: Provides a collection of routines for evaluating data from larger forest management units, typically sample inventories, but also stand-wise inventories. The idea is to support modern forest planning approaches and to be open by design to new data sources and evaluation methods. For the methodological background of forest inventories see Kangas and Maltamo (2006) "Forest Inventory: Methodology and Applications" <doi:10.1007/1-4020-4381-3>.
License: AGPL (≥ 3)
Encoding: UTF-8
Imports: tibble, dplyr, purrr, rlang, Rdpack, tidyr, readr, ggplot2, tidyselect (≥ 1.2.0), foreach, doSNOW, lifecycle, parallel, progressr, stringr, stringdist, sf
RdMacros: Rdpack
Depends: R (≥ 4.4), ForestElementsR (≥ 3.0.0)
Suggests: knitr, kableExtra, rmarkdown, tinytex, testthat (≥ 3.0.0)
SystemRequirements: pandoc (>= 1.12.3) and a LaTeX distribution (e.g. TinyTeX, see ?tinytex::install_tinytex) with the booktabs, longtable, siunitx, and makecell LaTeX packages are required for the *_pdf() output functions.
Config/testthat/edition: 3
LazyData: true
VignetteBuilder: knitr
Config/roxygen2/version: 8.1.0
NeedsCompilation: no
Packaged: 2026-08-27 16:15:25 UTC; casto
Author: Peter Biber ORCID iD [aut, cre], Astor Toraño Caicoya ORCID iD [aut]
Maintainer: Peter Biber <peter.biber@lwf.bayern.de>
Repository: CRAN
Date/Publication: 2026-09-09 15:00:10 UTC

Require a Complete Stand Age for an Age-Based Increment Estimate

Description

Two of FeNEU's three increment strands - the yield-table estimate and the gnfi3 (BWI 3) estimate - are driven by stand age: they age a tree forward (or backward) and take the difference. A tree without an age simply yields NA there, and because the aggregation drops NAs, the resulting table looks complete while silently covering only part of the collective. Rather than let that happen, the affected functions stop.

Usage

.assert_age_complete(x, fn_name)

Arguments

x

A trees data frame.

fn_name

Calling function name, used in the error message.

Details

The check runs on the collective the calling function actually evaluates (after its own layer / removal filtering), so an inventory whose understorey lacks ages can still be evaluated for the main stand.

Value

x, invisibly and unchanged, when every tree carries an age.


Require an explicit output directory

Description

The raw->pre converters write files, so they must be told where. Earlier versions defaulted to the raw-data folder, which writes into the user's own filespace – not permitted by CRAN policy, and against the package's principle of never guessing silently. output_dir is therefore a mandatory argument, and this helper turns the bare "argument missing" into a message that says what to pass. Shared by all three raw->pre converters so they stay symmetric.

Usage

.assert_output_dir(output_dir, fn)

Arguments

output_dir

The caller's output_dir argument, unevaluated-safe (checked with missing() in the caller and passed on).

fn

Name of the calling function, for the error message.

Value

Invisibly TRUE; called for the error it raises.


Reconstruct the Numeric Breaks of a Factor Produced by cut()

Description

Levels generated by cut read "(a,b]", so the break vector can be read back off them. Used to classify an aggregated value with exactly the breaks the incoming tree data were classified with, instead of guessing an interval that might differ from the caller's.

Usage

.breaks_from_cut_levels(f)

Arguments

f

An ordered factor as produced by cut().

Value

A numeric vector of breaks, or NULL if the levels do not have the expected shape.


File-Name Tag for an Increment Table's Tree Collective

Description

Derives the file-name fragment identifying which tree collective an increment table describes, from the collective descriptor the increment pipeline carries along (see .collective_from_filter). The standard kinds ("main_stand", "all_layers") are already file-safe and are used as they are; a "custom" collective is tagged with its sanitised definition (the tree-filter expression) rather than the bare word "custom", so that two PDFs built from different user-defined filters do not overwrite each other. This mirrors what .table_pdf_meta does for the base and structure tables.

Usage

.collective_file_tag(collective)

Arguments

collective

A collective descriptor list with kind and definition elements.

Value

A length-one character, safe to embed in a file name.


Convert plot-centre coordinates to a metric CRS for the pre files

Description

The BaySF-style pre columns are named gauss_rw/gauss_hw but, by convention, carry a projected metric CRS – real BaySF exports store UTM32 there (the “gauss” name is a legacy misnomer; verified on native FDINVKRS files, whose GAUSS_RW/GAUSS_HW hold UTM32 and whose GAUSS_KZ zone field is unreliable). FeNEU follows that convention when it writes a pre: geographic input (lonlat / ETRS89-geographic) is reprojected to UTM32 (EPSG:25832, ETRS89 / UTM zone 32N) so a pre file never holds degrees in a gauss_* column, while already-projected input (gk*, utm*) is passed through unchanged. The returned coord_sys describes the returned coordinates and is what the converter writes into the pre's coord_sys column, keeping the pre self-describing.

Usage

.coords_to_pre_metric(x, y, coord_sys)

Arguments

x, y

Numeric plot-centre coordinates in the CRS named by coord_sys.

coord_sys

FeNEU CRS key of the input coordinates.

Value

list(x, y, coord_sys): the (possibly reprojected) coordinates and the key of their CRS.


Resolve the inventory year for a raw-to-pre conversion

Description

Downstream only the survey year is used: each plot object carries a single time_yr, and fe_inventory() validates that a plot covers one survey year. The converters therefore need a year, not a full date.

Usage

.derive_inventory_year(date_vec, inventory_year = NULL)

Arguments

date_vec

Character vector of per-plot dates from the file, or NULL when the file carries no date column.

inventory_year

Optional single year overriding the file dates.

Details

An explicit inventory_year always wins, and the file dates are then not parsed at all. Otherwise the year is taken as the plain calendar year of the per-plot file date. If neither an inventory_year nor a usable file date is available, the caller must stop and ask for inventory_year.

The vegetation-period convention (a survey in, e.g., April counts for the previous growing season) is deliberately not applied automatically – that is a silvicultural judgement the user expresses through inventory_year, not a hidden cut-off inside the importer.

Value

A list list(ok, years, key, arg). On success ok = TRUE and years is either a single year (override) or one year per element of date_vec. On failure ok = FALSE and key names the i18n message to report (with optional arg).


Detect the character encoding of a text file

Description

Returns the encoding of a source text file without the user having to know it. The detection is deterministic for the only distinction that occurs in practice for this package's German-language forestry exports – UTF-8 vs. Latin-1/Windows-1252 – because valid UTF-8 is a self-identifying byte pattern: a Latin-1 file with umlauts (e.g. a lone 0xE4 for "ä") is almost never a valid UTF-8 byte sequence. A byte-order mark (BOM) is honoured when present.

Usage

.detect_file_encoding(path)

Arguments

path

Path to the file (character).

Details

Logic: (1) an UTF-8 BOM -> "UTF-8"; a UTF-16 BOM -> "UTF-16"; (2) otherwise, if the raw bytes form valid UTF-8 -> "UTF-8"; (3) otherwise "windows-1252" (a superset of ISO-8859-1 that also covers the few CP1252 punctuation bytes, harmless for umlaut data).

Not covered: UTF-16 without a BOM (extremely rare for these exports); such a file would be mis-read and is treated as an input error elsewhere.

Value

A single encoding string usable in readr::locale(encoding=).


Drop trees that need a position but do not have one

Description

The BaySF-style pre format needs no tree coordinates for trees of the innermost concentric circle: those are tallied as a group rather than located individually, so a missing azimuth / distance is legitimate and they are kept (with NA coordinates). Every larger tree does need a position – without one it cannot be placed on its circle and would be meaningless downstream.

Usage

.drop_trees_without_coords(normalised_trees, second_circle_dbh_cm)

Arguments

normalised_trees

Tree data after normalisation: koord, bhd (cm), pol_wink, pol_entf.

second_circle_dbh_cm

Lower DBH bound (cm) of the second circle, i.e. the threshold at or above which a position is required. Inf or NA means there is no second circle – nothing is dropped.

Details

Such trees are excluded rather than treated as a fatal error, so a user with not-yet-complete data can carry on working; the caller is expected to surface the returned message prominently (report and console), as the excluded trees take part in no evaluation.

The DBH limit is not hard-coded: it is the lower DBH bound of the second circle, i.e. it follows the circle definition of the actual inventory. With only one circle every tree is an innermost-circle tree, so nothing is dropped.

Both concentric raw formats normalise to the same column names before this runs (koord, bhd in cm, pol_wink, pol_entf), which is what lets Format 1 and Format 2 share this helper and stay symmetric.

Value

list(trees, msg): the (possibly reduced) tree data, and either NULL or a ready-to-emit warning message naming the count, the threshold and the affected inventory points.


Drop trees that carry no stand-layer code (with an identifiable report)

Description

Every living tree must be assigned to a stand layer – it is what places the tree in the main stand, the understorey, etc. A raw file may leave the layer blank for an individual tree (empty layer / bestku); such a tree ends up with best_ku = NA after normalisation, which ForestElementsR::fe_ccircle_spatial() later rejects with the cryptic “column(s) layer_key must be complete”, aborting the whole import over a single defective tree. FeNEU cannot guess the layer, so – exactly like a tree without a required position – the tree is excluded (not a fatal error, so the rest of the intact plot and inventory still build), and reported identifiably so the user can add the missing code and re-import. Dead trees always carry best_ku = -1 (set during normalisation), so only living trees with a genuinely missing layer are affected. Both concentric raw formats normalise the layer to the same best_ku column, which lets Format 1 and Format 2 share this helper and stay symmetric.

Usage

.drop_trees_without_layer(normalised_trees)

Arguments

normalised_trees

Tree data after normalisation: koord, bhd (cm), best_ku (integer layer code, NA when the raw layer was missing).

Value

list(trees, msg): the (possibly reduced) tree data, and either NULL or a ready-to-emit warning message naming the affected trees.


Aggregate Per-Tree gnfi3 Increments to the Inventory Level

Description

Shared aggregation core for the single-inventory gnfi3 increment. Takes a per-tree frame that already carries iv_hub_m3_ha_yr (the tree's increment scaled to a per-hectare contribution) and aggregates it to the level of the whole inventory, overall and by species group.

Usage

.gnfi3_overview_core(trees_with_iv, area_info, fill_label)

Arguments

trees_with_iv

Per-tree frame with at least plot_id, species_group, v_hub_m3, n_rep_ha and iv_hub_m3_ha_yr.

area_info

One row per inventory plot, with plot_id and area_rep_ha. This is the authoritative plot list: plots without any tree must be present here, otherwise their area is missing from the denominator.

fill_label

Value written into the fill_option column, which identifies the estimate downstream.

Details

Plots without trees of a given species group enter with an increment of zero in the numerator but with their full area in the denominator, so the species groups sum to the overall value.

Confidence intervals are deliberately NA throughout: a gnfi3 estimate carries no empirical between-plot variation of a measured increment. The columns exist so that the result is structurally identical to the corresponding block of the repeated-survey overview.

Value

A list with the elements overall and by_species_group, structured exactly like one collective block of inv_inc_big_overview.


Take the Per-Tree Frame Out of an Increment Bundle

Description

The class-table functions work on a per-tree increment frame. They accept either that frame directly or one of the bundles that carry it – the result of inv_increment_repeated_survey or of inv_increment_gnfi3, both of class fe_increment.

Usage

.increment_bundle_trees(x, fn_name)

Arguments

x

The object passed by the caller.

fn_name

Name of the calling function, for the error message.

Details

Not every fe_increment object holds trees: the yield-table strand estimates at stand level and has no per-tree increment at all. Such an object is refused here with a pointer to the function that does fit, rather than failing later on a missing column.

Value

A per-tree increment data frame, with its inc_meta attribute intact.


File-Name Tag for an Increment Table's Method

Description

Derives the file-name fragment identifying which of the three increment strands a base table came from. Without it the three strands collide: the file name is built from the table title, the tree collective and the class axis, all three of which a repeated-survey, a gnfi3 and a yield-table table of the same enterprise share. The rendered PDFs are distinguishable (their subtitle names the method) – only the file names were not, so the last one rendered silently replaced the others.

Usage

.increment_method_tag(meta)

Arguments

meta

The header meta list carried on an increment output table (its "meta" attribute), or NULL.

Details

The tag is read from the source element of the header meta the pipeline already carries: inv_inc_tree_extend_single stamps "gnfi3" and increment_ytables_base_table stamps "ytable". The repeated survey sets no source – it is the reference case and keeps its file name unchanged, so PDFs and scripts that already exist do not shift.

Value

A length-one character: the sanitised method tag, or "" for the repeated survey (and whenever no source is recorded). Callers append it with a separator only when it is non-empty.


Reject inventory points without plot-centre coordinates

Description

Every concentric sample plot is built around its centre coordinate – the whole circle geometry (and every tree position derived from it) hangs off that one point. A plot whose centre coordinate is empty cannot be placed and must not travel into the pre files, where it would otherwise surface much later as a cryptic “missing values in coordinates not allowed” error from sf when the pre reader turns the centre into a geometry. Catching it here, at the raw->pre stage, turns that into a clear, early failure. Called after the coordinate columns have been parsed to numeric (so an empty cell is already NA). Shared by both concentric raw->pre converters so they stay symmetric.

Usage

.missing_coords_msg(points, x_col, y_col, id_col, filename)

Arguments

points

Inventory-point data frame with numeric coordinate columns.

x_col, y_col

Names of the plot-centre coordinate columns.

id_col

Name of the plot-identifier column ("koord" / "plot_id").

filename

The point file name, for the error message.

Value

NULL when every plot has both coordinates, otherwise a ready-to-emit error message naming the affected plots.


Null incomplete positions of innermost-circle trees (with an identifiable report)

Description

Innermost-circle trees (dbh below the second circle) need no position. A raw file may nonetheless give such a tree only PART of a position – a distance but no azimuth, or vice versa. A half-position is unusable and, left in place, makes ForestElementsR::fe_ccircle_spatial() build an NA geometry that sf rejects with “missing values in coordinates not allowed”, aborting the import. This nulls both components so the tree is treated as unpositioned (it stays in the evaluation – count / volume – but is not placed spatially), and returns an identifiable report of the affected trees. Trees that DO require a position were already handled by .drop_trees_without_coords, which is why only innermost trees remain here. Shared by both concentric raw->pre converters so they stay symmetric; make_object_lists() nulls the same case again as a safety net for pre files supplied directly (not produced by these converters).

Usage

.null_partial_positions(normalised_trees, second_circle_dbh_cm)

Arguments

normalised_trees

Tree data after normalisation: koord, bhd (cm), pol_wink, pol_entf.

second_circle_dbh_cm

Lower DBH bound (cm) of the second circle. Inf/NA means a single circle – then every tree is innermost.

Value

list(trees, msg): the tree data with incomplete positions nulled, and either NULL or a ready-to-emit warning message naming the affected trees.


Parse selected columns of a raw/pre import table as numbers

Description

Decimal-mark-tolerant numeric parsing for exactly the columns a reader actually consumes. Only the columns named in cols are touched (via .parse_numeric_vec); every other column is passed through unchanged. This is deliberately a whitelist: a raw or pre file that comes from outside may carry extra, optional, or free-text columns FeNEU does not use – those ride through untouched, and legitimate commas in text fields are never harmed (unlike the older df-global convert_numbers_with_commas).

Usage

.parse_numeric_cols(df, cols)

Arguments

df

A data frame just read from a raw or pre import file.

cols

Character vector of canonical column names expected to hold numbers.

Details

Column names in cols that are not present in df are silently skipped, so an optional numeric column that a given file happens to omit is no problem. Identifier columns (plot / stand / tree keys) must NOT be listed here: they are kept as character and guarded separately (see .assert_id_cols_integer()).

cols is expected to hold canonical column names, so the call belongs after any header normalisation / alias renaming has run. The canonical numeric-column sets are defined per format next to the alias maps in R/import_column_standards.R, so a format change is a single-file edit.

Value

df with the targeted character columns converted to numeric.


Parse one vector as numbers, tolerant of the decimal mark

Description

Locale-agnostic numeric parsing for a single column. Accepts both point decimals ("1.69") and German comma decimals ("1,69") as well as plain integers, so a file exported on a German-locale system and one exported on an English-locale system yield the same numbers. A value that already parses as a plain point-decimal number is taken as is; a pure comma-decimal value has its comma turned into a point and is then parsed. Empty strings and NA become NA.

Usage

.parse_numeric_vec(x, col_label = NULL)

Arguments

x

A vector (character or already numeric) from a column that is expected to hold numbers.

col_label

Column name used in the warning message (character or NULL).

Details

Anything else – free text, a thousands separator, scientific notation, mixed punctuation – is returned as NA and reported with a warning: a measurement column should not contain such tokens, and turning them into NA silently would hide a data problem. A vector that is already numeric is returned unchanged.

Value

A numeric vector the same length as x.


Reject a duplicated plot identifier in the inventory-point file

Description

The plot-identifier column of the inventory-point file (koord in Format 2, plot_id in Format 1) must be unique – it is THE key that links a plot to its trees, its coordinates and its circle definition. A duplicate is never harmless: the pre reader nests each plot's circle definition by that key, so two rows sharing an id silently collapse into one plot carrying both circle sets, which only surfaces much later as the cryptic “dbh_lower is not unique” error. Catching it here, at the raw->pre stage, turns that into a clear, early failure. Shared by both concentric raw->pre converters so they stay symmetric.

Usage

.plot_id_duplicate_msg(points, id_col, filename)

Arguments

points

Inventory-point data frame.

id_col

Name of the plot-identifier column ("koord" / "plot_id").

filename

The point file name, for the error message.

Value

NULL when the identifier is unique, otherwise a ready-to-emit error message naming the duplicated ids.


Read a delimited text file with automatic encoding detection

Description

The single entry point every raw/pre reader in this package uses to read a delimited text file, so that character encoding is handled uniformly and users never have to choose one. With encoding = "auto" (the default) the encoding is detected via .detect_file_encoding; any other value is passed through as an explicit override for pathological cases.

Usage

.read_delim_auto(
  file,
  delim = "\t",
  encoding = "auto",
  decimal_mark = ".",
  as_text = FALSE,
  ...
)

Arguments

file

Path to the file (character).

delim

Field delimiter. Default tab.

encoding

"auto" (default) to detect, or an explicit encoding string to force.

decimal_mark

Decimal mark for numeric columns. Default "."; pass "," for comma-decimal exports. (Numeric robustness itself is handled separately by .parse_numeric_cols; this only sets the readr locale.)

as_text

If TRUE, read every column as character and defer all numeric parsing to an explicit .parse_numeric_cols step. This is the robust choice for raw user files: readr's type guessing would otherwise treat a comma decimal in a mixed column (e.g. a height column of mostly integers plus a few "23,4") as a thousands grouping mark and silently turn "23,4" into 234 at read time, before any whitelist can recover it. Reading as text sidesteps that entirely. Default FALSE (readr guesses types) for backward compatibility.

...

Passed to readr::read_delim() (e.g. col_types).

Details

Project convention: do not call readr::read_delim() (or set a fixed locale(encoding = )) directly in a reader. Route every text-file read through this helper and expose an encoding = "auto" argument on the reader so the override is available. This keeps encoding handling in one place and consistent across all import functions.

Value

A tibble, as returned by readr::read_delim().


Sanitise a String for Use in a File Name

Description

Turns an arbitrary string - a user-supplied table title, a plot identifier, or a captured tree_filter expression - into a compact, file-name-safe token: runs of characters outside [A-Za-z0-9.] collapse to single underscores, and leading or trailing dots and underscores are trimmed.

Usage

.safe_filename_part(s, empty = "x")

Arguments

s

A length-one character.

empty

A length-one character used when s contains nothing that survives sanitising and would yield an empty string.

Details

Dots are kept inside the token on purpose, because plot identifiers are commonly dotted (900000002.1.99900002) and should stay recognisable in the file name. Only a leading dot is removed - it would make the rendered PDF a hidden file on unix-alikes - along with a trailing one, which Windows does not accept in a file name.

This is the single sanitiser used by all *_pdf() functions, so the rendered file names follow one convention across the table families.

Value

A length-one character, safe to embed in a file name.


Build the species-guessing mapping report

Description

Summarises how each raw species abbreviation was resolved during check_and_guess_species: one row per distinct (normalised) raw abbreviation with its tree count, the canonical abbreviation it maps to, the resulting species_id/name_ger, and a tier of either "confirmed" (exact or case-insensitive match) or "review" (resolved only by substring / fuzzy / mojibake matching, so worth a manual check). Rows are ordered review-first, then by descending tree count.

Usage

.species_map_report(work_raw, rev_map, species_table)

Arguments

work_raw

Character vector of per-row normalised raw abbreviations.

rev_map

Named character vector mapping review-tier raw abbreviations to their guessed canonical abbreviation (empty when nothing needed the fuzzy tiers).

species_table

The standard species table (must carry abbreviation, species_id, name_ger).

Value

A tibble with columns raw, n_trees, canonical, species_id, name_ger, tier.


Derive Renderer Meta-Information from an Output Table

Description

Reads the self-describing attributes an output base/structure table carries (class_type and tree_selection, stamped by output_base_table / output_structure_table) and turns them into everything the *_pdf() functions need without a user-supplied type or layer_filter argument.

Usage

.table_pdf_meta(x, fn_name)

Arguments

x

An output base or structure table.

fn_name

Calling function name, used only in the error message.

Value

A list with type ("age"/"dq"), cohort (the raw tree-selection tag: "mainstand", "alllayers", or a raw tree_filter expression), and file_tag (the cohort in a file-name-safe form).


Compact per-tree identifier list for report messages

Description

When FeNEU excludes or alters individual trees (missing position, partial position, ...), the report must let the user find those trees in their OWN raw data. A per-plot identifier is not enough – a plot has many trees. This builds a compact, per-plot listing that names each affected tree by its tree number when the raw file supplied one (baumnummer / tree_nr, both optional under the grouping taxonomy) and otherwise by its dbh (cm) – so the trees stay identifiable even without tree numbers. The format is symbolic and language-neutral ("<plot>: <dbh>, <dbh>; <plot>: #<nr>(<dbh>)"); the surrounding message text explains it.

Usage

.tree_ident_label(trees, plot_col = "koord")

Arguments

trees

Affected-tree subset with at least koord and bhd (cm); baumnummer/tree_nr used when present.

plot_col

Name of the plot-identifier column (default "koord").

Value

A single character string.


Warn When Structure Table Input Shows No Concentric-Circle Structure

Description

Structure tables break an inventory down by single-tree diameter class within age or dq classes. That is worth doing for a sample inventory, where the diameter distribution is estimated from a sample of trees; for a standwise inventory the same table can be computed but says much less. Nothing is refused here - the table is produced either way - the caller is only told what the data look like.

Usage

.warn_if_not_sample_inventory(inv_trees_plus, fn_name)

Arguments

inv_trees_plus

A tree list as passed to a structure_table_*() function.

fn_name

Calling function name, used only in the message.

Details

What can actually be observed is dbh_trshld: pull_trees fills that column with each tree's concentric-circle threshold if - and only if - the plot is an fe_ccircle_spatial, and leaves it NA otherwise. An all-NA column therefore means "no concentric-circle structure in these data", which today implies a standwise inventory but will not stay equivalent to it: a sample inventory taken by relascope would look exactly the same here while being a perfectly legitimate case. That is why this is a warning naming the observation, not a rule refusing a combination - the wording has to survive the day FeNEU supports more (type x method) pairs. Deciding it properly needs the inventory type declared on the fe_inventory object and carried down; that is a post-CRAN item recorded in CLAUDE.md. An attribute cannot do the carrying, incidentally - measured: group_by() plus ungroup() already drops one, and the aggregation code groups constantly.

Value

Invisibly TRUE; called for the warning it may raise.


Species-Group Overview From the Per-Cohort Yield-Table Increments

Description

Aggregates the cohort-level estimate (plot_agg_for_yt followed by apply_ytables) to one row per species group plus a total row. All volume figures are harvested volume under bark (Erntefestmeter ohne Rinde); the collective is the main stand, because yield-table species areas are only formed there.

Usage

.ytables_overview_from_cohorts(cohorts, plot_area_weight = TRUE, fe_inv = NULL)

Arguments

cohorts

Per-cohort estimate, one row per inventory plot and species.

plot_area_weight

Logical, if TRUE (default), cohorts are weighted with the ideal area they represent; if FALSE all count equally.

fe_inv

Optional fe_inventory object. If supplied, the per-hectare total is expressed over the entire operation area, and the area of points that carry no living main stand – treeless points as well as points whose only trees are removals or belong to other layers – appears as a separate is_no_main_stand_row so that the areas add up to the operation total. Those points contribute no yield-table increment.

Value

A tibble with one row per species group, an optional is_no_main_stand_row, and a total row whose site_index is NA because the index scales differ between yield tables.


Calculate ha-wise Increments per Species Group and Age Class on Inventory Level

Description

Aggregates the plot level output of ha_inc_main_stand_age_class to the level of the whole inventory

Usage

agg_ha_inc_main_stand_age_class(x, plot_area_weight)

Arguments

x

A data frame with per-plot increment values, typically the output of ha_inc_main_stand_age_class.

plot_area_weight

Logical, if TRUE (default), the single plots are weighted with the area they represent. If FALSE all plots are equally weighted

Value

A data frame which is an aggregation of the input x to the inventory level


Aggregate Yield Table Increments From Plot Level to Inventory Level

Description

Aggregate Yield Table Increments From Plot Level to Inventory Level

Usage

agg_ha_yt_inc_main_stand_age_class(x, plot_area_weight)

Arguments

x

Output of apply_ytables()

plot_area_weight

Logical, if TRUE, the single plots are weighted with the area they represent. If FALSE all plots are equally weighted

Value

A data frame (tibble) with the grouping variables species_group, and age_class. For each so-defined group the tibble provides the area/ha, the average site index, and the yield table average increments per year and ha.


Apply the Selected Yield Tables on Plot Level

Description

Apply the Selected Yield Tables on Plot Level

Usage

apply_ytables(x, ytable_selection)

Arguments

x

A data frame, the output of plot_agg_for_yt

ytable_selection

A data frame assigning yield table names to species groups; typically produced by inv_increment_ytables.

Value

An extended version of the input x, containing yield table names, site index, stocking level and yield table increments. The increment iv_hub_m3_ha_yr_yt is the table's unreduced periodic annual increment (pai_m3_ha_yr, Vorratsfestmeter mit Rinde), corrected by the stocking level and then reduced exactly once to harvested volume under bark (Erntefestmeter ohne Rinde) via v_red_harvest_ubark. The pre-reduced red_pai_m3_ha_yr is not used, because it is not guaranteed to be present in every yield table.


Create a Background Table for All Mean Diameter Class Based Evaluations From an Inventory Tree Data Frame

Description

Calculates the quadratic mean diameter on the nested levels of layer in species group in plot, attributes these values to categories which are the basis for further aggregation with other functions. The function was designed for producing often required information only once.

Usage

back_table_dclass(inv_trees_plus, d_q_interval = 10)

Arguments

inv_trees_plus

Data frame which covers trees from an inventory (each row is a tree), typically obtained from an fe_inventory object with pull_trees and pre-treated with trees_add_essentials (see example).

d_q_interval

Integer indicating the interval breaks for the d_q (quadratic mean diameter) classes to be formed. The breaks are internally handed over to cut as its parameter breaks. Default is 10-cm-classes, where all d_q values over 60 cm are all put into the same class.

Value

A data frame which reports for each plot, species group and layer the actual quadratic mean diameter and the d_q-class (as an ordered factor) it belongs to.

Examples

# The prepared tree list ships with the package; see
# ?data_ex3_trees_essentials for the chain that builds it.
data_ex3_sample_trees_essentials |>
  back_table_dclass()


Species Group Information Table by Age Class

Description

Inventory tree data are grouped by species group and age class. A data frame with group-wise aggregated inventory information is returned.

Usage

base_table_age_class(inv_trees_plus, tree_filter = !.data$removal)

Arguments

inv_trees_plus

Data frame which covers trees from an inventory (each row is a tree), typically obtained from an fe_inventory object with pull_trees and pre-treated with trees_add_essentials (see example).

tree_filter

Expression describing which trees to use in the function, internally passed to filter. Default is !removal, i.e. trees that died or were removed are not included.

Value

A list containing four data frames. The first one, called detail contains the aggregated information by species group and age class. The second one, total is aggregated on species level, i.e. one level higher. These values are mostly sums, but not in all cases. Confidence intervals must be calculated differently and also n_plot in total will not always be the sum of the values in detail, as there might be plots which contain two layers with different d_q classes. The third data frame, all_species, holds the cross-species aggregation by age class (the body of the "Summe" block of the base table (Basistabelle)); the fourth, all_total, is the grand total across all species and all classes.

Attached attribute

The returned list carries a tree_selection attribute recording which tree cohort it represents: "mainstand" for the *_main_stand() functions, "alllayers" for the general functions called with their default tree_filter, or the raw tree_filter expression for a custom filter. output_base_table / output_structure_table carry this attribute through to their own output, where the *_pdf() renderers read it for a self-describing file name and the cohort disclaimer.

See Also

Other inventory tables: base_table_age_class_main_stand(), base_table_d_q_class(), base_table_d_q_class_main_stand(), output_base_table(), output_increment_overall(), output_structure_table(), structure_table_age_class(), structure_table_age_class_main_stand(), structure_table_d_q_class(), structure_table_d_q_class_main_stand()

Examples

# The prepared tree list ships with the package; see
# ?data_ex3_trees_essentials for the chain that builds it.
data_ex3_sample_trees_essentials |>
  base_table_age_class()



Species Group Information Table by Age Class For the Main Stand Cohort

Description

Species Group Information Table by Age Class For the Main Stand Cohort

Usage

base_table_age_class_main_stand(inv_trees_plus)

Arguments

inv_trees_plus

Data frame which covers trees from an inventory (each row is a tree), typically obtained from an fe_inventory object with pull_trees and pre-treated with trees_add_essentials (see example).

Value

A list containing four data frames, similar as the output from base_table_age_class, however restricted to the main stand, but with information about the areas covered by species (sub-groups). The first data frame in the list, called detail contains the aggregated information by species group and age class. The second one, total is aggregated on species level, i.e. one level higher. These values are mostly sums, but not in all cases. Confidence intervals must be calculated differently. The third data frame, all_species, holds the cross-species aggregation by age class (the body of the "Summe" block of the base table (Basistabelle)); the fourth, all_total, is the grand total across all species and all classes.

Attached attribute

The returned list carries a tree_selection attribute recording which tree cohort it represents: "mainstand" for the *_main_stand() functions, "alllayers" for the general functions called with their default tree_filter, or the raw tree_filter expression for a custom filter. output_base_table / output_structure_table carry this attribute through to their own output, where the *_pdf() renderers read it for a self-describing file name and the cohort disclaimer.

See Also

Other inventory tables: base_table_age_class(), base_table_d_q_class(), base_table_d_q_class_main_stand(), output_base_table(), output_increment_overall(), output_structure_table(), structure_table_age_class(), structure_table_age_class_main_stand(), structure_table_d_q_class(), structure_table_d_q_class_main_stand()

Examples

# The prepared tree list ships with the package; see
# ?data_ex3_trees_essentials for the chain that builds it.
data_ex3_sample_trees_essentials |>
  base_table_age_class_main_stand()



Species Group Information Table by Mean Diameter Class

Description

Inventory tree data are grouped by species group and mean diameter class. A data frame with group-wise aggregated inventory information is returned.

Usage

base_table_d_q_class(inv_trees_plus, dclass_back, tree_filter = !.data$removal)

Arguments

inv_trees_plus

Data frame which covers trees from an inventory (each row is a tree), typically obtained from an fe_inventory object with pull_trees and pre-treated with trees_add_essentials (see example).

dclass_back

Data frame listing quadratic mean diameter classes per species group and layer on plot level. Typically the output of back_table_dclass.

tree_filter

Expression describing which trees to use in the function, internally passed to filter. Default is !removal, i.e. trees that died or were removed are not included.

Value

A list containing four data frames. The first one, called detail contains the aggregated information by species group and mean diameter class. The second data frame, total is aggregated on species level, i.e. one level higher. These values are mostly sums, but not in all cases. Confidence intervals must be calculated differently and also n_plot in total will not always be the sum of the values in detail, as there might be plots which contain two layers with different d_q classes. The third data frame, all_species, holds the cross-species aggregation by mean diameter class (the body of the "Summe" block of the base table (Basistabelle)); the fourth, all_total, is the grand total across all species and all classes.

Attached attribute

The returned list carries a tree_selection attribute recording which tree cohort it represents: "mainstand" for the *_main_stand() functions, "alllayers" for the general functions called with their default tree_filter, or the raw tree_filter expression for a custom filter. output_base_table / output_structure_table carry this attribute through to their own output, where the *_pdf() renderers read it for a self-describing file name and the cohort disclaimer.

See Also

Other inventory tables: base_table_age_class(), base_table_age_class_main_stand(), base_table_d_q_class_main_stand(), output_base_table(), output_increment_overall(), output_structure_table(), structure_table_age_class(), structure_table_age_class_main_stand(), structure_table_d_q_class(), structure_table_d_q_class_main_stand()

Examples


# The prepared tree list is shipped with the package: it is this inventory
# put through pull_trees() -> height_complete_inventory() ->
# fill_heights_back() -> pull_trees() -> trees_add_essentials(). See
# ?data_ex3_trees_essentials for that chain spelled out.
trees_with_heights <- data_ex3_sample_trees_essentials

peg_back_d <- back_table_dclass(trees_with_heights)

base_table_d_q_class(trees_with_heights, dclass_back = peg_back_d)


Species Group Information Table by Mean Diameter Class and Single Tree Diameter Class For the Main Stand Cohort

Description

Very similar aggregation table to the one produced by base_table_d_q_class, but restricted to to the main stand (layer_key == 1) only. It contains, however, estimates of areas covered by species (sub-)groups and ha-related values o these cohorts. Due the methodological dubiousness of species area calculations in mixed stands, this is only done for the main stand (comparably to how this was handled in the 3rd German National Forest Inventory).

Usage

base_table_d_q_class_main_stand(inv_trees_plus, dclass_back)

Arguments

inv_trees_plus

Data frame which covers trees from an inventory (each row is a tree), typically obtained from an fe_inventory object with pull_trees and pre-treated with trees_add_essentials (see example).

dclass_back

Data frame listing quadratic mean diameter classes per species group and layer on plot level. Typically the output of back_table_dclass.

Value

A list containing four data frames, similar as the output from base_table_d_q_class, however restricted to the main stand, but with information about the areas covered by species (sub-groups). The first data frame in the list, called detail contains the aggregated information by species group and mean diameter class. The second one, total is aggregated on species level, i.e. one level higher. These values are mostly sums, but not in all cases. Confidence intervals must be calculated differently. The third data frame, all_species, holds the cross-species aggregation by mean diameter class (the body of the "Summe" block of the base table (Basistabelle)); the fourth, all_total, is the grand total across all species and all classes.

Attached attribute

The returned list carries a tree_selection attribute recording which tree cohort it represents: "mainstand" for the *_main_stand() functions, "alllayers" for the general functions called with their default tree_filter, or the raw tree_filter expression for a custom filter. output_base_table / output_structure_table carry this attribute through to their own output, where the *_pdf() renderers read it for a self-describing file name and the cohort disclaimer.

See Also

Other inventory tables: base_table_age_class(), base_table_age_class_main_stand(), base_table_d_q_class(), output_base_table(), output_increment_overall(), output_structure_table(), structure_table_age_class(), structure_table_age_class_main_stand(), structure_table_d_q_class(), structure_table_d_q_class_main_stand()

Examples

# The prepared tree list is shipped with the package: it is this inventory
# put through pull_trees() -> height_complete_inventory() ->
# fill_heights_back() -> pull_trees() -> trees_add_essentials(). See
# ?data_ex3_trees_essentials for that chain spelled out.
trees_with_heights <- data_ex3_sample_trees_essentials

peg_back_d <- back_table_dclass(trees_with_heights)

base_table_d_q_class_main_stand(
  trees_with_heights, dclass_back = peg_back_d
)


Build fcbestku (standard BaySF layer definition)

Description

Returns the standard BaySF layer code table. This default is used whenever no external layers_filename is supplied to the orchestrator.

Usage

build_fcbestku()

Value

Data frame ready to be written as fcbestku.txt.


Build fdinvba from normalised tree data

Description

Build fdinvba from normalised tree data

Usage

build_fdinvba(normalised_trees)

Arguments

normalised_trees

Tibble with common normalised columns.

Value

Tibble ready to be written as fdinvba.txt.


Build fdinvbhd from normalised tree data

Description

Build fdinvbhd from normalised tree data

Usage

build_fdinvbhd(normalised_trees)

Arguments

normalised_trees

Tibble with common normalised columns (see file header for required column names).

Value

Tibble ready to be written as fdinvbhd.txt.


Build fdinvkrs from normalised inventory-point data

Description

Build fdinvkrs from normalised inventory-point data

Usage

build_fdinvkrs(normalised_points)

Arguments

normalised_points

Tibble with common normalised columns: koord, gauss_rw, gauss_hw, erfdat, bestkey, bestlfd, fe_period. Any additional columns are passed through unchanged.

Value

Tibble ready to be written as fdinvkrs.txt.


Build fdinvtot from normalised deadwood data

Description

Converts normalised deadwood measurements into the fdinvtot format used by the BaySF processing chain. Per BaySF instructions (Erstanlage 2024, §6.2.8), deadwood is always recorded on a fixed 500 m² circle (radius 12.62 m), independent of the live-tree concentric circles.

Usage

build_fdinvtot(normalised_deadwood, source = "inputmask")

Arguments

normalised_deadwood

Tibble with source-specific columns as described above.

source

Character scalar: "inputmask" (default) or "concentric".

Details

Volume per piece is estimated with a half-cylinder approximation (form factor 0.5):

v_{ha} = 0.5 \cdot \pi \cdot \left(\frac{d_{cm}}{200}\right)^2 \cdot h_m \cdot n_{ha}

Two input sources are supported via the source argument:

"inputmask" (Eingabemaske / input mask app export) — normalised input must contain:

koord

Plot identifier.

lfd_tot

Sequential deadwood piece number within plot.

totholz_lage

Position code: "1" = standing, "2" = lying. Standing pieces cannot be distinguished as whole vs. partial stem, so all are mapped to totkat = 91.

totzer

Decomposition grade (integer 1–5).

totbag

Species group code; 4 (Nicht bestimmbar) is recoded to 0.

dm

Mid-diameter in mm (converted to cm internally).

hoehe

Length / height in dm (converted to m internally).

fe_nr, fe_period, bestkey, bestlfd

Administrative keys.

"concentric" (Kraus / concentric-circle survey) — normalised input must contain:

koord

Plot identifier.

lfd_tot

Sequential deadwood piece number within plot.

kategorie

Position code: 1 = stehend ganzer Stamm (totkat = 90), 2 = stehend Stammteil (totkat = 91), 3 = liegend (totkat = 92). Any other value is mapped to NA and filtered out.

grad

Decomposition grade (integer 1–3), mapped directly to totzer.

totbag

Species group code: 1 = Eiche, 2 = Nadelholz, 3 = Laubholz, 4 = nicht zuzuordnen (recoded to 0).

dm

Mid-diameter in cm (no conversion needed).

hoehe

Length / height in m (no conversion needed).

fe_nr, fe_period, bestkey, bestlfd

Administrative keys.

Value

Tibble ready to be written as fdinvtot.txt with columns fe_period, bestkey, bestlfd, koord, lfd_tot, totkat, totzer, totbag, dm (cm), hoehe (m), fe_nr, v_ha, n_ha.


Build fdvikrs (circle definitions)

Description

Returns the standard fdvikrs data frame. When circle_definitions is NULL (the default), a single circle class (fe_ikl = 1) is created from bhds_from and radiuses. When circle_definitions is supplied, it must be a data frame with columns fe_ikl, bhd_von, and radius, and multiple circle classes are created.

Usage

build_fdvikrs(bhds_from = NULL, radiuses = NULL, circle_definitions = NULL)

Arguments

bhds_from

Numeric vector of lower DBH limits per circle. Ignored when circle_definitions is not NULL.

radiuses

Numeric vector of circle radii in metres. Ignored when circle_definitions is not NULL.

circle_definitions

Optional data frame with columns fe_ikl (integer circle-class key), bhd_von (numeric, cm), and radius (numeric, m). Default NULL.

Value

Data frame ready to be written as fdvikrs.txt.


Internal Helper Function for Calculating Tree Volumes at Sampling Thresholds

Description

Required for all tree-increment calculation options in tree_inc_repsurv, where sampling thresholds have to be taken into account.

Usage

calc_v_hub_m3_at_thrsh(
  tree_matches,
  inv_1st,
  inv_2nd,
  inv_1st_trees,
  inv_2nd_trees
)

Check and guess species names

Description

This is a convenience function that helps in the context of inconsistently coded German species name abbreviations. It tries to guess correct species names and connects them to species codes that are supported by the package ForestElementsR. Despite the function applies clever techniques, a manual check ot the outcome is absolutely recommended.

Usage

check_and_guess_species(tree_list, species_table)

Arguments

tree_list

A data frame containing a column "baumart" which contains the species name abbreviations to be checked.

species_table

A data frame containing with the columns "name_ger", "species_id", and "abbreviation". The first two columns have to come from a species coding table provided by the package ForestElementsR. The third column contains the standard abbrevations that the function will try to guess from the entries in tree_list$baumart. In FeNEU we provide one such data frame called species_abbreviations_bavrn_state. It supports the species coding "bavrn_state" (Bavarian State Forest) supported by ForestElementsR.

Details

Remark by Peter: The current version operates on data frames and requires column naming conventions. A future streamlined version can be more generic and based on named vectors.

Value

A duplicate-free data frame containing all successful matches


Check Circle Definition Compatibility of Matched Inventory Plots

Description

Internal helper called by match_2_inventories. For each matched plot pair, the circle definitions (columns dbh_lower and c_area) are compared. Pairs with incompatible circle definitions are removed from matches and stored in a new list element circle_def_mismatch. The comparison uses tolerances: dbh_lower is rounded to 1 decimal place (0.1 cm = 1 mm) and c_area is rounded to 5 decimal places (0.00001 ha = 0.1 m²). This accounts for potential rounding artifacts in the data while still detecting genuine differences in circle setup. Plots with empty circle definitions (notrees plots) are always considered compatible, because ingrowth and mortality are handled separately in the increment calculation.

Usage

check_circle_def_compatibility(match_rslt, inv_a, inv_b)

Arguments

match_rslt

List as returned by match_2_inventories_by_plot_id or match_2_inventories_by_center_coord.

inv_a, inv_b

fe_inventory objects.

Value

The input list match_rslt with an additional element circle_def_mismatch containing the incompatible plot pairs. These pairs are removed from matches.


Check R Package and System Dependencies for PDF Rendering

Description

Gate function called at the top of every ⁠*_pdf()⁠ function. Throws an informative error when rmarkdown, kableExtra, or pandoc is missing, so users get a clear install message rather than a cryptic backtrace from inside rmarkdown::render().

Usage

check_pdf_dependencies(fun_name)

Arguments

fun_name

Character string — the name of the calling ⁠*_pdf()⁠ function, used in the error message.

Value

NULL invisibly when all dependencies are present.

See Also

pdf_dependencies, diagnose_pdf_toolchain

Other pdf_output: output_base_table_pdf(), output_increment_base_table_pdf(), output_increment_overall_pdf(), output_increment_overview_gnfi3_pdf(), output_increment_overview_ytables_pdf(), output_structure_table_pdf(), pdf_dependencies, plot_info_sheet_pdf()

Examples

# The gate every *_pdf() function calls first: silent when everything is in
# place, an informative error otherwise. Guarded here so that the example
# itself stays harmless on a machine without the toolchain.
if (requireNamespace("kableExtra", quietly = TRUE) &&
    rmarkdown::pandoc_available()) {
  check_pdf_dependencies("output_base_table_pdf")
}

Checks if Input Data Compise all Necessary Information According to the Bavarian State Forest standards

Description

Checks if Input Data Compise all Necessary Information According to the Bavarian State Forest standards

Usage

check_raw_data_BaySF(raw_data)

Arguments

raw_data

Input data to be checked, i.e. a list of data frames, each representing one of the standard tables of the Bavarian State Forest inventory data definitions, including the names of the tables. Currently four tables are required, namely fdinvbhd, fdinvba, fdinvkrs, and fdvikrs

Value

If the check fails, the function terminates with an error. If not, it returns a list of column name vectors that are required to build an intermediate inventory list with the function read_rawdata_BaySF


Check Compatibility of a Yield Table Selection With Given Data

Description

Check Compatibility of a Yield Table Selection With Given Data

Usage

check_ytable_selection_vs_data(inv_dat, ytable_selection)

Arguments

inv_dat

Inventory data frame (pulled from an fe_inventory object, with completed heights and essentials added

ytable_selection

Yield table selection to be tested against the data; see documentation of inv_increment_ytables for details

Value

A list comprising a flag called success (TRUE if check result ok, FALSE otherwise), and a character string called message that contains an error message in case the check is not successful


Convert numbers with commas to point format

Description

Helper function for handling input data generated on German systems.

Usage

convert_numbers_with_commas(df)

Arguments

df

A data frame containing numbers with commas

Details

Remark by Peter: Operates on a data frame. Future versions could be more simple and generic by just taking one vector as the input; the current version would also replace correct commas in text fields. The vector-based version would be called from outside only for those columns of a data frame, that are intended to be numeric.

Value

A data frame similar to the input, however with all commas replaced by points and all colums converted to numeric if possible


Count inventory points by regeneration plants per point (long format)

Description

[Experimental]

Usage

count_reg_points_by_plants_long(
  inv_dat_trees_ext_reg,
  mixture_per_plot,
  pulled_circles
)

Arguments

inv_dat_trees_ext_reg

Tibble from pull_trees(..., small_trees = TRUE) containing regeneration trees, including plot_id, layer_key, species_group, n_rep_ha.

mixture_per_plot

Tibble with plot_id and mixture_class as created inside structure_regeneration_output_table().

pulled_circles

Tibble of circle definitions with plot_id, slope, and c_area, typically the output of pull_circle_definitions().

Details

Counts the number of inventory points ("Probkreise") by classes of plant numbers per point, analogous to the "Zahl der Probkreise nach Pflanzenzahl je Probekreis" block in L43.

For each mixture_class × species_group, the function:

  1. approximates the counted plants (tree_count) per inventory point,

  2. sums plants per point across all regeneration trees on that point,

  3. assigns each point to a plant-number class (e.g. 0, 1-9, 10-19, ...),

  4. counts how many points fall into each class.

An additional "total" block aggregates across all mixture classes per species.

Value

Tibble with one row per mixture_class × species_group × plant_count_class (plus an overall "total" block), containing:

mixture_class

Mixture block ("total" or specific mixture)

species_group

Species identifier

plant_count_class

Class of plants per point (character)

n_inv_points

Number of inventory points in this class


Example raw sample inventory tables (Format 1, 10 inventory points)

Description

Artificial but realistic raw forest inventory tables (tree, plot and regeneration) in FeNEU's raw data Format 1 for sample inventories with concentric circles. They describe an inventory of only ten inventory points. The Gauss-Krueger coordinates in the point table are random numbers and do not refer to any real location. Only the columns the Format-1 converter consumes are kept (see import_sample_concentric_format1_raw_to_pre).

Format

data_ex1_sample_raw_points

Plot table linked by plot_id.

data_ex1_sample_raw_trees

Tree table linked by plot_id.

data_ex1_sample_raw_smalltrees

Regeneration table linked by plot_id.

Source

Internal example data (artificial, Format 1)

See Also

Other example data: data_ex2_sample_raw, data_ex3_increment_interim, data_ex3_previous_sample_fe_inventory, data_ex3_sample_fe_inventory, data_ex3_trees_essentials, data_ex4_previous_sample_fe_inventory, data_ex4_sample_fe_inventory, data_ex5_previous_sample_fe_inventory, data_ex5_sample_fe_inventory, data_ex6_standwise_fe_inventory, data_ex7_standwise_fe_inventory, data_examples_overview, inc_sub10_rep_classic, inc_sub10_rep_end, inc_sub10_rep_mean, inc_sub10_rep_trans, processed_heights_bav_sub10, processed_heights_nfi_sub10, processed_pulled_sub10


Example raw inventory tables in BaySF style (forestry-mask format, 10 inventory points)

Description

Artificial but realistic raw forest inventory tables (plot and tree data) in FeNEU's raw data format 2 for sample inventories. They describe an inventory in the style of the Bavarian State Forest Enterprise (BaySF), comprising only ten inventory points. Any stored coordinates are random numbers and do not refer to any real location.

Format

data_ex2_sample_raw_points

Plot table linked by koord.

data_ex2_sample_raw_trees

Tree table linked by koord.

Source

Internal example data (artificial, BaySF style)

See Also

Other example data: data_ex1_sample_raw, data_ex3_increment_interim, data_ex3_previous_sample_fe_inventory, data_ex3_sample_fe_inventory, data_ex3_trees_essentials, data_ex4_previous_sample_fe_inventory, data_ex4_sample_fe_inventory, data_ex5_previous_sample_fe_inventory, data_ex5_sample_fe_inventory, data_ex6_standwise_fe_inventory, data_ex7_standwise_fe_inventory, data_examples_overview, inc_sub10_rep_classic, inc_sub10_rep_end, inc_sub10_rep_mean, inc_sub10_rep_trans, processed_heights_bav_sub10, processed_heights_nfi_sub10, processed_pulled_sub10


Interim Increment Stages of the ex3 Inventory Pair

Description

The repeated-survey increment runs through several steps, each of them an exported function with its own help page. The first two steps are shipped here as ready-made objects, so that the examples of the later steps can start at their own subject instead of rebuilding the chain that leads up to it.

Usage

data_ex3_increment_matched

data_ex3_increment_fills

Format

data_ex3_increment_matched is a list of six elements: tree_increments (152 rows, 22 columns), plot_matches, match_plot_stats, match_tree_stats, inv_period and method ("rep_classic").

data_ex3_increment_fills is a list of five estimate data frames – fills_forward (31 rows), fills_backward (47), fills_backward_nomatch (0), fills_backward_implausible (1) and fills_backward_reptrees (56) – plus inv_period, plot_matches and method carried through from the matching.

An object of class list of length 6.

An object of class list of length 8.

Details

data_ex3_increment_matched is what matching the two surveys yields: the per-tree increments derived from the measured data of both surveys, together with the plot and tree matching statistics and the survey period.

data_ex3_increment_fills holds the GNFI 3 estimates that stand ready to fill the gaps the matching leaves – trees found in only one of the surveys, and trees whose match was flagged implausible. It is not a filled tree list: which of these estimates is actually used is decided one step later by inv_inc_tree_consolidate through its fill_option. Because it was built with include_reptrees = TRUE, it also carries estimates for trees measured in both surveys, which have no gap at all; fill_option = "all_estimates" needs those.

Interim data for examples and tests

These objects exist for the documentation and the test suite, not as a processing stage of their own. They are built in data-raw/data_ex3_increment_interim.R from the shipped ex3 inventory pair and its prepared tree lists (data_ex3_trees_essentials):

data_ex3_increment_matched <- inv_increment_repsurv_ccirc(
  data_ex3_previous_sample_fe_inventory,
  data_ex3_sample_fe_inventory,
  data_ex3_previous_sample_trees_essentials,
  data_ex3_sample_trees_essentials,
  match_type = "plot_id", plot_id_style = "baysf"
)

data_ex3_increment_fills <- inv_inc_fill_gaps_gnfi3(
  data_ex3_increment_matched,
  data_ex3_previous_sample_trees_essentials,
  data_ex3_sample_trees_essentials,
  include_reptrees = TRUE
)

Those are the settings the examples use throughout. An example that deliberately shows a different one – another increment method, matching by centre coordinates, or include_reptrees = FALSE – calls the function itself, because that difference is its subject. Whenever the increment chain changes, these objects have to be rebuilt with the script above, just like the prepared tree lists.

See Also

inv_increment_repsurv_ccirc and inv_inc_fill_gaps_gnfi3, the functions that produce them; inv_increment_repeated_survey, which runs the whole chain in one call and is what most users want.

Other example data: data_ex1_sample_raw, data_ex2_sample_raw, data_ex3_previous_sample_fe_inventory, data_ex3_sample_fe_inventory, data_ex3_trees_essentials, data_ex4_previous_sample_fe_inventory, data_ex4_sample_fe_inventory, data_ex5_previous_sample_fe_inventory, data_ex5_sample_fe_inventory, data_ex6_standwise_fe_inventory, data_ex7_standwise_fe_inventory, data_examples_overview, inc_sub10_rep_classic, inc_sub10_rep_end, inc_sub10_rep_mean, inc_sub10_rep_trans, processed_heights_bav_sub10, processed_heights_nfi_sub10, processed_pulled_sub10

Examples

  # Start at the consolidation step, without rebuilding what precedes it
  inv_inc_tree_consolidate(
    data_ex3_increment_fills, fill_option = "standard"
  )


Example Inventory Data as an fe_inventory object (10 inventory points, earlier survey)

Description

Example Inventory Data as an fe_inventory object (10 inventory points, earlier survey)

Details

This fe_inventory object holds artificial but realistic inventory data in the style of the Bavarian State Forest Enterprise (BaySF). It comprises only ten inventory points and was generated with fe_inventory from tab-delimited text files. The stored Gauss-Krueger coordinates are random numbers and do not refer to any real location. It contains the same inventory points as data_ex3_sample_fe_inventory and represents the earlier of two successive surveys (used to demonstrate increment estimation).

See Also

Other example data: data_ex1_sample_raw, data_ex2_sample_raw, data_ex3_increment_interim, data_ex3_sample_fe_inventory, data_ex3_trees_essentials, data_ex4_previous_sample_fe_inventory, data_ex4_sample_fe_inventory, data_ex5_previous_sample_fe_inventory, data_ex5_sample_fe_inventory, data_ex6_standwise_fe_inventory, data_ex7_standwise_fe_inventory, data_examples_overview, inc_sub10_rep_classic, inc_sub10_rep_end, inc_sub10_rep_mean, inc_sub10_rep_trans, processed_heights_bav_sub10, processed_heights_nfi_sub10, processed_pulled_sub10


Example Inventory Data as an fe_inventory object (10 inventory points)

Description

Example Inventory Data as an fe_inventory object (10 inventory points)

Details

This fe_inventory object holds artificial but realistic inventory data in the style of the Bavarian State Forest Enterprise (BaySF). It comprises only ten inventory points and was generated with fe_inventory from tab-delimited text files. The stored Gauss-Krueger coordinates are random numbers and do not refer to any real location. Five of the ten inventory points carry small-tree records, five do not.

See Also

Other example data: data_ex1_sample_raw, data_ex2_sample_raw, data_ex3_increment_interim, data_ex3_previous_sample_fe_inventory, data_ex3_trees_essentials, data_ex4_previous_sample_fe_inventory, data_ex4_sample_fe_inventory, data_ex5_previous_sample_fe_inventory, data_ex5_sample_fe_inventory, data_ex6_standwise_fe_inventory, data_ex7_standwise_fe_inventory, data_examples_overview, inc_sub10_rep_classic, inc_sub10_rep_end, inc_sub10_rep_mean, inc_sub10_rep_trans, processed_heights_bav_sub10, processed_heights_nfi_sub10, processed_pulled_sub10


Prepared Tree Lists of the ex3 Inventory Pair

Description

The tree lists of the two ex3 surveys, ready for analysis: heights complete, volumes, standing areas and species groups added. They are shipped so that the increment examples can start from a prepared tree list instead of repeating the five-step preparation in every single @examples block.

Usage

data_ex3_sample_trees_essentials

data_ex3_previous_sample_trees_essentials

Format

Each a tibble with one row per tree and 23 columns, among them plot_id, tree_id, species_id, species_group, age_yr, dbh_cm, height_m, n_rep_ha, area_rep_ha, layer_key, removal, g_m2, v_hub_m3 and standing_area_m2. data_ex3_sample_trees_essentials has 139 rows (second survey), data_ex3_previous_sample_trees_essentials 112 (first survey).

An object of class tbl_df (inherits from tbl, data.frame) with 139 rows and 23 columns.

An object of class tbl_df (inherits from tbl, data.frame) with 112 rows and 23 columns.

Details

These are not a fourth processing stage of the inventory taxonomy (raw -> pre -> fe_inventory, see data_examples_overview). They sit after the import, on the analysis side: an fe_inventory object carries the inventory, and pulling and preparing its trees is the first step of evaluating it.

How they were built

With the canonical chain, spelled out in data-raw/data_ex3_trees_essentials.R:

trees_with_heights <- inv |>
  pull_trees() |>
  height_complete_inventory()

inv |>
  fill_heights_back(trees_with_heights) |>
  pull_trees() |>
  trees_add_essentials(method = "BaySF")

The second pull_trees is what makes the chain canonical: fill_heights_back writes the estimated heights into the inventory object, so the re-pulled trees carry them in height_m and none of the estimation helper columns (h_est_m, d_q_cm, h_q_m) ride along. Folding h_est_m into height_m by hand instead gives the same increments but a tree list of a different shape – a difference that has caused real breakage, see inv_inc_tree_extend.

See Also

data_ex3_sample_fe_inventory and data_ex3_previous_sample_fe_inventory, the inventories they were pulled from; inv_increment_repeated_survey, the usual consumer.

Other example data: data_ex1_sample_raw, data_ex2_sample_raw, data_ex3_increment_interim, data_ex3_previous_sample_fe_inventory, data_ex3_sample_fe_inventory, data_ex4_previous_sample_fe_inventory, data_ex4_sample_fe_inventory, data_ex5_previous_sample_fe_inventory, data_ex5_sample_fe_inventory, data_ex6_standwise_fe_inventory, data_ex7_standwise_fe_inventory, data_examples_overview, inc_sub10_rep_classic, inc_sub10_rep_end, inc_sub10_rep_mean, inc_sub10_rep_trans, processed_heights_bav_sub10, processed_heights_nfi_sub10, processed_pulled_sub10

Examples

  # What the two objects are
  dim(data_ex3_sample_trees_essentials)
  dim(data_ex3_previous_sample_trees_essentials)
  names(data_ex3_sample_trees_essentials)

  # They are ready to use, no preparation needed. The usual consumer is
  # inv_increment_repeated_survey(); its help page runs the whole chain on
  # exactly this pair, so it is not repeated here.
  head(data_ex3_sample_trees_essentials[, c("plot_id", "species_id",
                                            "dbh_cm", "height_m", "v_hub_m3")])

Example Inventory Data as an fe_inventory object (earlier survey)

Description

Example Inventory Data as an fe_inventory object (earlier survey)

Details

This fe_inventory object holds artificial but realistic inventory data in the style of the Bavarian State Forest Enterprise (BaySF). It was generated with fe_inventory from tab-delimited text files. The stored Gauss-Krueger coordinates are random numbers and do not refer to any real location. It represents the earlier of two successive surveys and contains the same inventory points as data_ex4_sample_fe_inventory, except for three points that were newly established in the later survey; it therefore comprises 97 inventory points.

See Also

Other example data: data_ex1_sample_raw, data_ex2_sample_raw, data_ex3_increment_interim, data_ex3_previous_sample_fe_inventory, data_ex3_sample_fe_inventory, data_ex3_trees_essentials, data_ex4_sample_fe_inventory, data_ex5_previous_sample_fe_inventory, data_ex5_sample_fe_inventory, data_ex6_standwise_fe_inventory, data_ex7_standwise_fe_inventory, data_examples_overview, inc_sub10_rep_classic, inc_sub10_rep_end, inc_sub10_rep_mean, inc_sub10_rep_trans, processed_heights_bav_sub10, processed_heights_nfi_sub10, processed_pulled_sub10


Example Inventory Data as an fe_inventory object (100 inventory points)

Description

Example Inventory Data as an fe_inventory object (100 inventory points)

Details

This fe_inventory object holds artificial but realistic inventory data in the style of the Bavarian State Forest Enterprise (BaySF). It comprises one hundred inventory points and was generated with fe_inventory from tab-delimited text files. The stored Gauss-Krueger coordinates are random numbers and do not refer to any real location.

See Also

Other example data: data_ex1_sample_raw, data_ex2_sample_raw, data_ex3_increment_interim, data_ex3_previous_sample_fe_inventory, data_ex3_sample_fe_inventory, data_ex3_trees_essentials, data_ex4_previous_sample_fe_inventory, data_ex5_previous_sample_fe_inventory, data_ex5_sample_fe_inventory, data_ex6_standwise_fe_inventory, data_ex7_standwise_fe_inventory, data_examples_overview, inc_sub10_rep_classic, inc_sub10_rep_end, inc_sub10_rep_mean, inc_sub10_rep_trans, processed_heights_bav_sub10, processed_heights_nfi_sub10, processed_pulled_sub10


Simulated Inventory Data for Generic Matching Tests (10 plots, first survey)

Description

Simulated Inventory Data for Generic Matching Tests (10 plots, first survey)

Details

This fe_inventory object was derived from a simulated forest enterprise (pure spruce, 400 stands, 5 ha each). It contains a 10-plot subsample selected for unique within-plot tree IDs. The original simulation tree IDs are used as lfd_bhd, making the BaySF tree ID (paste(lfd_satz, lfd_bhd)) a permanent identifier that is stable across inventories. This enables testing of tree_id_style = "generic" (ID-based matching) in inv_increment_repsurv_ccirc.

Seven of the ten plots have both vanished and ingrown trees; three plots have all trees surviving between surveys. The dataset represents the first survey (year 2020). See data_ex5_sample_fe_inventory for the second survey.

Generated by data-raw/simulated_inventory_generic_matching.R.

See Also

Other example data: data_ex1_sample_raw, data_ex2_sample_raw, data_ex3_increment_interim, data_ex3_previous_sample_fe_inventory, data_ex3_sample_fe_inventory, data_ex3_trees_essentials, data_ex4_previous_sample_fe_inventory, data_ex4_sample_fe_inventory, data_ex5_sample_fe_inventory, data_ex6_standwise_fe_inventory, data_ex7_standwise_fe_inventory, data_examples_overview, inc_sub10_rep_classic, inc_sub10_rep_end, inc_sub10_rep_mean, inc_sub10_rep_trans, processed_heights_bav_sub10, processed_heights_nfi_sub10, processed_pulled_sub10


Simulated Inventory Data for Generic Matching Tests (10 plots, second survey)

Description

Simulated Inventory Data for Generic Matching Tests (10 plots, second survey)

Details

This fe_inventory object represents the second survey (year 2030) of the same 10 plots as data_ex5_previous_sample_fe_inventory. See that object's documentation for details on the data source and the permanent tree ID scheme used for testing tree_id_style = "generic" matching.

Generated by data-raw/simulated_inventory_generic_matching.R.

See Also

Other example data: data_ex1_sample_raw, data_ex2_sample_raw, data_ex3_increment_interim, data_ex3_previous_sample_fe_inventory, data_ex3_sample_fe_inventory, data_ex3_trees_essentials, data_ex4_previous_sample_fe_inventory, data_ex4_sample_fe_inventory, data_ex5_previous_sample_fe_inventory, data_ex6_standwise_fe_inventory, data_ex7_standwise_fe_inventory, data_examples_overview, inc_sub10_rep_classic, inc_sub10_rep_end, inc_sub10_rep_mean, inc_sub10_rep_trans, processed_heights_bav_sub10, processed_heights_nfi_sub10, processed_pulled_sub10


Stand-Wise Inventory as an fe_inventory object

Description

Stand-Wise Inventory as an fe_inventory object

Details

This fe_inventory object (fe_stand plots) was built via the two-stage import chain (import_standwise_relascope_format1_raw_to_pre + import_standwise_relascope_pre_to_fe_inventory) from the raw Silvarith-style example data shipped at system.file("extdata", "data_ex6_standwise_raw", package = "FeNEU"). It has two fictitious stands and carries no plot coordinates, as is typical for stand-wise inventories with angle-count (relascopic, “Winkelzählprobe”) surveys.

See Also

Other example data: data_ex1_sample_raw, data_ex2_sample_raw, data_ex3_increment_interim, data_ex3_previous_sample_fe_inventory, data_ex3_sample_fe_inventory, data_ex3_trees_essentials, data_ex4_previous_sample_fe_inventory, data_ex4_sample_fe_inventory, data_ex5_previous_sample_fe_inventory, data_ex5_sample_fe_inventory, data_ex7_standwise_fe_inventory, data_examples_overview, inc_sub10_rep_classic, inc_sub10_rep_end, inc_sub10_rep_mean, inc_sub10_rep_trans, processed_heights_bav_sub10, processed_heights_nfi_sub10, processed_pulled_sub10


Stand-Wise Inventory as an fe_inventory object

Description

Stand-Wise Inventory as an fe_inventory object

Details

This fe_inventory object (fe_stand plots) was built with import_standwise_relascope_pre_to_fe_inventory from the pre-processed Silvarith-style example data shipped at system.file("extdata", "data_ex7_standwise_pre", package = "FeNEU"). It has two fictitious stands and carries no plot coordinates, , as is typical for stand-wise inventories with angle-count (relascopic, “Winkelzählprobe”) surveys.

See Also

Other example data: data_ex1_sample_raw, data_ex2_sample_raw, data_ex3_increment_interim, data_ex3_previous_sample_fe_inventory, data_ex3_sample_fe_inventory, data_ex3_trees_essentials, data_ex4_previous_sample_fe_inventory, data_ex4_sample_fe_inventory, data_ex5_previous_sample_fe_inventory, data_ex5_sample_fe_inventory, data_ex6_standwise_fe_inventory, data_examples_overview, inc_sub10_rep_classic, inc_sub10_rep_end, inc_sub10_rep_mean, inc_sub10_rep_trans, processed_heights_bav_sub10, processed_heights_nfi_sub10, processed_pulled_sub10


FeNEU Example Data

Description

FeNEU ships a set of small example inventories used throughout the documentation, examples and tests. They are fully anonymised and artificial: plot coordinates are randomised and all identifiers are re-assigned, so the data carry no reference to any real forest enterprise and must not be used to draw conclusions about one. The sets are named data_ex1_... to data_ex7_.... The data represent three different processing stages, and the inventory types currently supported by FeNEU.

Processing stages

An inventory passes through up to three stages in FeNEU, and each example is provided at whichever stages are useful for demonstration:

raw

The unprocessed input tables as delivered by the field recording software, before any standardisation. Bundled as text files under system.file("extdata", ...), which is what the ⁠*_raw_to_pre()⁠ functions read. For ex1 and ex2, the same tables are additionally bundled as ⁠data/⁠ tibbles (⁠data_ex1_*⁠, ⁠data_ex2_*⁠) so that they can be inspected without reading a file; the text files are generated from those tibbles (⁠data-raw/⁠), so the two cannot drift apart.

pre (preprocessed)

The intermediate, standardised form the ⁠*_pre_to_fe_inventory()⁠ step consumes – BaySF-style tab-delimited text files for the concentric sample type, or a canonical WZP_Daten.txt for the stand-wise type. Bundled as folders under system.file("extdata", ...).

fe_inventory

The ready-to-analyse fe_inventory object, bundled as a ⁠data/⁠ object.

Inventory types

FeNEU supports sample and stand-wise inventories. Currently, we cover sample inventories that follow a concentric circle design, and stand-wise inventories with several angle-count samples per stand. In the overview table below, we refer to these types as sample, and standwise.

sample (concentric circles)

Sample-point inventory on concentric circles. Two raw input formats exist for sample inventories, "Format 1" and "Format 2"; both feed the same preprocessed BaySF-style form. Scope is counted in inventory points.

standwise (angle-count / relascope)

Stand-wise inventory in which each stand is sampled with several relascope angle-count (Winkelzaehlprobe) points. Currently, only one raw data format is supported for standwise relascope inventories ("Format 1"); the raw and the preprocessed data follow the Silvarith-style. Scope is counted in stands; in the resulting object every angle-count point becomes one fe_stand row.

Sample circle geometry

The raw formats of the sample inventories do not carry the geometry of the concentric circles – it is part of the inventory design, not of the field records. It therefore has to be passed to the ⁠*_raw_to_pre()⁠ functions, through the arguments dbh_cm_from (the lower dbh threshold of each circle, in cm) and radiuses_m (the matching radii, in m). Getting it wrong scales the representation factors and hence every per-hectare figure, so the designs of the two raw example sets are stated here:

Set dbh_cm_from radiuses_m resulting circle areas
ex1 c(0, 12, 30, 48) c(2.82, 5.64, 11.28, 17.84) 25 / 100 / 400 / 1000 m²
ex2 c(0, 12, 30) c(2, 6.31, 12.62) 12.6 / 125 / 500 m²

These are the designs of the inventories the anonymised examples were derived from; use them when running the raw import of ex1 or ex2. The sets bundled from the preprocessed stage onwards (ex3 to ex5) carry their circle definition in the data and need no such argument.

Overview

Set Type Stages bundled Scope
ex1 sample (concentric) raw (Format 1) 10 points
ex2 sample (concentric) raw (Format 2) 10 points
ex3 sample (concentric) pre, fe_inventory (+ previous) 10 points (previous 9)
ex4 sample (concentric) pre, fe_inventory (+ previous) 100 points (previous 95)
ex5 sample (concentric) pre (simulated), fe_inventory (+ previous) 10 points (previous 10)
ex6 standwise (relascope) raw (Format 1), pre, fe_inventory 2 stands (17 points)
ex7 standwise (relascope) pre, fe_inventory 2 stands (15 points)

Datasets in each set

ex1 – sample, Format 1, raw

extdata folder data_ex1_sample_raw (Baumschicht.txt, Inv_punkt.txt, Verjuengung.txt); objects data_ex1_sample_raw_trees (133 rows), data_ex1_sample_raw_points (10), data_ex1_sample_raw_smalltrees (43). Circle design: dbh_cm_from = c(0, 12, 30, 48), radiuses_m = c(2.82, 5.64, 11.28, 17.84). A dead-wood table exists for developers only (deadwood import is deferred); it is not shipped with the package.

ex2 – sample, Format 2, raw

extdata folder data_ex2_sample_raw (⁠02_probekreis.txt⁠, ⁠01_root_entity.txt⁠); objects data_ex2_sample_raw_trees (177 rows), data_ex2_sample_raw_points (10). Circle design: dbh_cm_from = c(0, 12, 30), radiuses_m = c(2, 6.31, 12.62). A small-tree and a dead-wood table are not bundled yet (see note).

ex3 – sample, concentric

extdata folder data_ex3_sample_pre; objects data_ex3_sample_fe_inventory and data_ex3_previous_sample_fe_inventory (an earlier survey of the same points, for increment estimation).

ex4 – sample, concentric

extdata folder data_ex4_sample_pre; objects data_ex4_sample_fe_inventory and data_ex4_previous_sample_fe_inventory. Same design as ex3, larger.

ex5 – sample, concentric, simulated

extdata folders data_ex5_sample_pre and data_ex5_previous_sample_pre; objects data_ex5_sample_fe_inventory and data_ex5_previous_sample_fe_inventory. Carries permanent tree ids (tree_id_style = "generic").

ex6 – standwise, relascope

extdata folders data_ex6_standwise_raw and data_ex6_standwise_pre; object data_ex6_standwise_fe_inventory.

ex7 – standwise, relascope

extdata folder data_ex7_standwise_pre; object data_ex7_standwise_fe_inventory.

Derived test fixtures

A few further bundled objects are derived from ex3 and kept under their historical names; they are not part of the ex1–ex7 scheme and exist for regression testing: inc_sub10_rep_classic, inc_sub10_rep_mean, inc_sub10_rep_end, inc_sub10_rep_trans (increment reference results), processed_pulled_sub10, processed_heights_nfi_sub10 and processed_heights_bav_sub10 (intermediate tree-preparation results).

Note on the Format-2 example (ex2)

ex2 currently provides only the tree and inventory-point tables. A Format-2 dead-wood table (the "07" sheet) and a regeneration table are not bundled yet; they can be added later.

Stand register (Revierbuch)

Besides the raw -> pre -> fe_inventory chain, FeNEU offers a separate strand that produces a stand register (Revierbuch) from the inventory input data. It needs stand-level attributes that an fe_inventory object does not carry. For stand-wise inventories these are read from a metadata file with import_standwise_relascope_format1_metadata(); import_standwise_relascope_format1_stand_register_bundle() orchestrates trees and metadata for stand_register_pdf(). Set ex6 bundles such a metadata file (stand_metadata.txt) as an example; the three processing stages above never touch it.

See Also

The exported import functions that move an inventory between the stages illustrated by these example data:

Other example data: data_ex1_sample_raw, data_ex2_sample_raw, data_ex3_increment_interim, data_ex3_previous_sample_fe_inventory, data_ex3_sample_fe_inventory, data_ex3_trees_essentials, data_ex4_previous_sample_fe_inventory, data_ex4_sample_fe_inventory, data_ex5_previous_sample_fe_inventory, data_ex5_sample_fe_inventory, data_ex6_standwise_fe_inventory, data_ex7_standwise_fe_inventory, inc_sub10_rep_classic, inc_sub10_rep_end, inc_sub10_rep_mean, inc_sub10_rep_trans, processed_heights_bav_sub10, processed_heights_nfi_sub10, processed_pulled_sub10


Add Essential Information to Deadwood Data

Description

Adds representative plot area (from an fe_inventory object) and fixed L46 diameter classes to a deadwood tibble imported from BaySF fdinvtot. No further transformations are performed; volume and number per hectare are already provided in the raw file.

Usage

deadwood_add_essentials(deadwood_dat, inventory_plots)

Arguments

deadwood_dat

Tibble containing deadwood data imported and renamed from fdinvtot.txt. Must include plot_id and d_mean_cm.

inventory_plots

Tibble containing plot-level data from an fe_inventory

Value

Tibble identical to deadwood_dat but with two additional variables:

area_rep_ha

Representative area of the sample plot (ha)

dclass_46

L46 diameter class (I, II, III)


Detect and validate a uniform date format in a character vector

Description

Attempts to determine the date format used in a character vector containing date strings. A small set of expected formats is tested on a representative non-empty value, and strict round-trip validation is applied. Exactly one format must match; otherwise the function raises an error. This ensures that all imported date fields follow a single, unambiguous, and internally convertible format.

Usage

detect_date_format(date_string)

Arguments

date_string

A character vector containing date values to be tested.

Value

A single character string representing the detected date format. If no format or more than one format matches, an informative error is thrown.


Diagnose the PDF Rendering Toolchain

Description

Checks whether the tools required for rendering PDF reports (pandoc and a LaTeX distribution) are available on the current system, and prints a message for each missing component explaining how to install it.

Usage

diagnose_pdf_toolchain()

Value

Invisibly, a named logical list with elements pandoc and latex.

See Also

setup_pdf_toolchain

Examples

diagnose_pdf_toolchain()


Aggregated hq and dq values from Single Tree to Inventory Level by User Defined Grouping

Description

Workhorse function used to complete heights at inventory level

Usage

dq_hq_perclass(inv_trees_ext, ...)

Arguments

inv_trees_ext

A tibble representing the trees of an inventory (or any subset), typically the outbput of trees_add_essentials, possibly merged with the output of base_table_d_q_class

...

Grouping variables defining the level of aggregation, internally passed to group_by

Value

A tibble containing the aggregated information for dq and hq


Generate a fe_ccircle_spatial Object From an Output Row of make_inventory_list

Description

Standard users do not need to call this function directly. Its typical usage is to apply it to each row of the output of make_inventory_list and to obtain a list of fe_ccircle_spatial objects this way. Data standard is Bavarian State Forest (BaySF) so far.

Usage

fe_ccircle_fromlist(
  x,
  trees_column_name,
  circles_column_name,
  center_coord_name,
  small_trees_name,
  height_method = c("NFI", "Bavaria")
)

Arguments

x

a data frame or a list with unequivocal key, and two columns with data frames for trees and circle definition, typically the output of make_inventory_list.

trees_column_name

name of the column where the tree lists are stored

circles_column_name

name of the column where the circle definitions are stored

center_coord_name

name of the column containing the center coordinates in Gauss-Krueger

small_trees_name

name of the column containing the small trees, i.e. trees with no dbh because their height is < 1.3 m

height_method

height estimation method for trees with missing heights, "NFI" height curves are defined as default, alternatively "Bavaria" can be selected, but in this case tree ages must be provided

Value

an object of fe_ccircle_spatial


Internal CRS registry

Description

A named vector mapping short CRS keys used internally in FeNEU to EPSG codes. The registry defines the coordinate reference systems supported by inventory import and conversion functions.

Usage

fe_crs_registry

Details

Supported CRS keys:

lonlat

WGS84 geographic coordinates (EPSG:4326)

etrs89

ETRS89 geographic coordinates (EPSG:4258)

utm32

ETRS89 / UTM zone 32N (EPSG:25832)

utm33

ETRS89 / UTM zone 33N (EPSG:25833)

gk2

DHDN / Gauss-Krueger zone 2 (EPSG:31466)

gk3

DHDN / Gauss-Krueger zone 3 (EPSG:31467)

gk4

DHDN / Gauss-Krueger zone 4 (EPSG:31468)

gk5

DHDN / Gauss-Krueger zone 5 (EPSG:31469)


Standard Construction of an fe_inventory Object

Description

Standard Construction of an fe_inventory Object

Usage

fe_inventory(
  inventory_list,
  object_type = c("fe_stand", "fe_stand_spatial", "fe_ccircle_spatial")
)

Arguments

inventory_list

A tibble with the inventory data containing the necessary three columns with plot_id, the plot objects, and the inv_rep_area

object_type

Character to define what type of objects will be save as inventory points: fe_stand or children, fe_stand_spatial or fe_ccircle_spatial

Value

If the information provided allows to construct a valid fe_inventory object, this object will be returned. The function will terminate with an error otherwise

Examples

  # fe_inventory() is the constructor at the end of the import pipeline. It
  # is normally reached through the public entry point read_and_convert_data(),
  # which builds the intermediate inventory list and calls fe_inventory()
  # internally.
  in_path <- system.file("extdata", "data_ex3_sample_pre", package = "FeNEU")
  read_and_convert_data(in_path, inventory_type = "sample_concentric",
                        coord_sys = "gk4")


Normalise plot center coordinates and attach CRS metadata

Description

Internal helper to standardise plot center coordinates and associate them with a coordinate reference system (CRS). The function resolves the CRS from a short key, applies Gauss-Krueger zone-prefix correction if required, and stores CRS information as attributes.

Usage

fe_normalise_coordinates(
  coordinate,
  coord_sys = coord_sys,
  epsg = NULL,
  x_col = "gauss_rw",
  y_col = "gauss_hw",
  coord_sys_declared = TRUE,
  check_envelope = TRUE
)

Arguments

coordinate

A data frame containing plot center coordinates.

coord_sys

Character CRS key (see Details). Default is "gk4".

epsg

Optional integer EPSG code, used only if coord_sys = "epsg".

x_col

Name of the x coordinate column. Default "gauss_rw".

y_col

Name of the y coordinate column. Default "gauss_hw".

Details

Supported CRS keys (Germany-focused):

lonlat

WGS84 geographic coordinates (EPSG:4326)

utm32

ETRS89 / UTM zone 32N (EPSG:25832)

utm33

ETRS89 / UTM zone 33N (EPSG:25833)

gk2

DHDN / Gauss-Krueger zone 2 (EPSG:31466)

gk3

DHDN / Gauss-Krueger zone 3 (EPSG:31467)

gk4

DHDN / Gauss-Krueger zone 4 (EPSG:31468)

gk5

DHDN / Gauss-Krueger zone 5 (EPSG:31469)

epsg

User-supplied EPSG code

For Gauss-Krueger systems, the function automatically checks whether the Rechtswert appears to be missing the zone prefix and adds it if necessary.

Value

The input data frame with unchanged structure, but with CRS metadata attached as attributes:

fe_crs

An sf::crs object

fe_coord_sys

Resolved CRS key

fe_coord_cols

Coordinate column names


Generate a fe_ccircle_spatial Object From an Output Row of make_inventory_list

Description

Standard users do not need to call this function directly. Its typical usage is to apply it to each row of the output of make_inventory_list and to obtain a list of fe_ccircle_spatial objects this way. Data standard is Bavarian State Forest (BaySF) so far.

Usage

fe_stand_fromlist(x, trees_column_name, height_method = c("NFI", "Bavaria"))

Arguments

x

a data frame or a list with unequivocal key, and two columns with data frames for trees and circle definition, typically the output of make_inventory_list.

trees_column_name

name of the column where the tree lists are stored

height_method

height estimation method for trees with missing heights, "NFI" height curves are defined as default, alternatively "Bavaria" can be selected, but in this case tree ages must be provided

Value

an object of fe_stand


Write Estimated Heights at Inventory Level Back Into the Original fe_inventory Object

Description

This procedure can be time consuming with large inventories, therefore parallel processing is used (see parameter free_cores).

Usage

fill_heights_back(
  inv_dat,
  pulled_est_height,
  small_trees = FALSE,
  .progress = TRUE,
  free_cores = 4
)

Arguments

inv_dat

Object of class fe_inventory

pulled_est_height

tibble which was pulled from an fe_inventory object with pull_trees, and where missing heights were completed with height_complete_inventory.

small_trees

[Experimental] logical, default is FALSE. Only users who absolutely know what they are doing, should use the setting TRUE. If TRUE also small trees (i.e. trees with heights < 1.3 m) will be dealt with.

.progress

Logical, if TRUE (default) a progress bar is displayed during execution.

free_cores

Integer, indicating the number of processor cores which will not be assigned to parallel processing tasks. If free_cores is equal or greater than the number of available cores, one core will be used (i.e. no parallel processing). Defaults to 4.

Value

The input fe_inventory object with updated heights

Examples


# Estimate heights - only the pulled tree tibble is affected so far
suppressWarnings(
# Warnings come from an intentional species code casts - no problem here
  inventory_est_heights <- data_ex3_sample_fe_inventory |>
    pull_trees() |>
    height_complete_inventory(method = "NFI")
)

# Now write the heights back into the original object or, as in this case,
# an otherwise identical copy of it
peg_fe_inventory_updated <- fill_heights_back(
  data_ex3_sample_fe_inventory, inventory_est_heights
)


Generate a Circle-Definition File for a Concentric Sample Inventory

Description

Writes an fe_ikl-keyed circle-definition file (default Probekreisdefinition.txt) for the concentric sample import chain (import_sample_concentric_format1_raw_to_pre, import_sample_concentric_format2_raw_to_pre). The concentric importers require a circle definition; when a ready-made one is not at hand, this helper produces a uniform definition – the same set of concentric circles for every plot – written as a single fe_ikl = "ALL" group. (For multiple circle classes, write the file yourself with one integer fe_ikl per class and link each inventory point to its class via its own fe_ikl column.)

Usage

generate_circle_definition(
  output_dir,
  dbh_cm_from,
  radiuses_m,
  filename = "Probekreisdefinition"
)

Arguments

output_dir

Folder the file is written to (character). Created if it does not exist.

dbh_cm_from

Numeric vector of lower DBH limits in cm, one per concentric circle (e.g. c(0, 12, 30)).

radiuses_m

Numeric vector of circle radii in m, the same length as dbh_cm_from (e.g. c(2.82, 5.64, 12.62)).

filename

Base file name with or without the .txt extension. Default "Probekreisdefinition".

Details

There is deliberately no default geometry: the caller must supply dbh_cm_from and radiuses_m, because the evaluation results depend directly on the circle sizes. These parameter names match those of the concentric raw importers.

Value

The path of the written file (invisibly).

See Also

import_sample_concentric_format1_raw_to_pre, import_sample_concentric_format2_raw_to_pre

Examples

dir <- tempdir()
generate_circle_definition(
  dir,
  dbh_cm_from = c(0, 12, 30),
  radiuses_m  = c(2.82, 5.64, 12.62)
)


Survey Year of an Inventory Object

Description

Returns the unique survey year (time_yr) of an inventory object. At present a method is provided for fe_inventory, where uniformity of time_yr across all plots is guaranteed by the fe_inventory constructor; the method does a defensive check regardless.

Usage

get_inv_year(x, ...)

## S3 method for class 'fe_inventory'
get_inv_year(x, ...)

Arguments

x

An inventory object.

...

Currently unused, reserved for method-specific extensions.

Value

A single numeric value: the survey year.

Examples

  get_inv_year(data_ex3_sample_fe_inventory)


Calculate ha-wise Increments per Plot, Species Group, and Age Class

Description

The increments added to the output of plot_inc_gnfi_2012 here relate to virtual species (group) area shares. The calculation is only done for the main stand, because otherwise the species area shares will not make too much sense.

Usage

ha_inc_main_stand_age_class(x, data_filter = !.data$removal)

Arguments

x

A data frame generated with plot_inc_gnfi_2012

data_filter

Logical expression relating to the columns of x. Default is !.data$removal, i.e. the removal stand is not included in the increment calculation. Independently, there is always an internal filter on layer_key == 1, which does only take into account main stand trees

Value

A data frame that is the input x with additional columns representing the species groups' area shares, absolute areas and the related increments per ha


Harmonize First Inventory for Repeated Survey Increment Calculation

Description

For matched plot pairs from two subsequent inventories, this function ensures that the slope values in the first inventory's circle definitions match those of the second inventory. This is important because differing slope assessments lead to different n_rep_ha values for the same tree in the same concentric circle, which can distort increment calculations and cause false circle-transition detections.

Usage

harmonize_inv_for_repsurv(inv_1st, inv_2nd, plot_matches)

Arguments

inv_1st

An object of class fe_inventory representing the earlier inventory.

inv_2nd

An object of class fe_inventory representing the later inventory.

plot_matches

Output of match_2_inventories.

Details

The function modifies the circle_definition$slope of matched plots in inv_1st to the value found in the corresponding plot of inv_2nd. Missing (NA) slopes are treated as 0 (flat terrain). Plots where neither circle definition contains a slope column are skipped, as are plots with empty circle definitions (notrees plots). After the slope correction, n_rep_ha is recalculated for affected trees using n_rep_ha, and the modified plot objects are revalidated with validate_fe_ccircle_spatial.

After harmonization, the user should re-derive the tree data from the returned inventory object (e.g. via pull_trees |> height_complete_inventory |> trees_add_essentials).

Value

A modified copy of inv_1st where the slope values in matched plots have been set to the corresponding values from inv_2nd and n_rep_ha has been recalculated accordingly. Unmatched plots are returned unchanged.

See Also

Other increment: increment_base_table(), increment_base_table_main_stand(), increment_ytables_base_table(), inv_inc_big_overview(), inv_inc_big_overview_2nd_only(), inv_inc_big_overview_matches_only(), inv_inc_fill_gaps_gnfi3(), inv_inc_summaric(), inv_inc_tree_2_plot(), inv_inc_tree_consolidate(), inv_inc_tree_extend(), inv_inc_tree_extend_combined(), inv_increment_gnfi3(), inv_increment_repeated_survey(), inv_increment_repsurv_ccirc(), inv_increment_ytables(), is_fe_increment_repsurv(), match_2_inventories(), match_2_inventories_by_center_coord(), match_2_inventories_by_plot_id(), match_plot_statistics(), match_trees_on_inventory_repsurv_ccirc(), match_trees_on_plot_repsurv_ccirc(), output_increment_base_table(), output_increment_base_table_pdf(), output_increment_overall(), output_increment_overall_pdf(), output_increment_overview_gnfi3(), output_increment_overview_gnfi3_pdf(), output_increment_overview_ytables_pdf(), reclassify_pseudo_ingrowth_ccirc(), tree_inc_repsurv()

Other repeated inventory: inv_increment_repsurv_ccirc(), match_2_inventories(), match_2_inventories_by_center_coord(), match_2_inventories_by_plot_id(), match_plot_statistics(), match_trees_on_inventory_repsurv_ccirc(), match_trees_on_plot_repsurv_ccirc(), reclassify_pseudo_ingrowth_ccirc()

Other inventory matches: match_2_inventories(), match_2_inventories_by_center_coord(), match_2_inventories_by_plot_id(), match_plot_statistics(), match_trees_on_inventory_repsurv_ccirc(), match_trees_on_plot_repsurv_ccirc()

Examples

  inv_a <- data_ex3_previous_sample_fe_inventory
  inv_b <- data_ex3_sample_fe_inventory

  plot_matches <- match_2_inventories(
    inv_a, inv_b, match_type = "plot_id", "baysf"
  )

  inv_a_harmonized <- harmonize_inv_for_repsurv(inv_a, inv_b, plot_matches)


Complete Heights for Non-Measured Trees in an Inventory

Description

Typically in an inventory, height measurements are done only for a part of the sampled trees. This function provides reasonable estimates for the missing heights.

Usage

height_complete_inventory(
  pulled_inventory,
  d_q_interval = 5,
  method = c("NFI", "Bavaria"),
  diagnostic = FALSE
)

Arguments

pulled_inventory

Tibble with tree list for the whole inventory, typically the output of pull_trees

d_q_interval

Integer indicating the interval breaks for the dq (quadratic mean diameter) classes to be formed. Default is 5-cm-classes, where all dq values over 60 cm are all put into the same class.

method

Height estimation method for trees with missing heights, "NFI" height curves are defined as default, alternatively "Bavaria" can be selected, but in this case an age must be provided for every tree (see Details)

diagnostic

Logical, if TRUE, the function provides diagnostic output, which is NOT compatible with the standard output and its usage. Default is FALSE. Use TRUE only, if you know exactly what you are doing.

Details

The function first identifies quadratic mean diameter (dq) classes grouped by species group (i.e. fe_species_tum_wwk_short), and stand layer level for each plot. These classes are then applied to the whole inventory (i.e. omitting the grouping by plot), to calculate a dq value for each dq class, species group, and stand layer. From the height-measured trees a corresponding hq (quadratic mean height) is calculated. In case there are no height measured trees in a group, so that there is no data-based estimate of hq possible the function h_q_from_d_q is used as a fallback. In this case a warning is issued.
Both, hq and dq are the entry points for the subsequent individual tree height estimates which are based on the individual trees' dbh. Note that for the height estimation method "Bavaria" also an age must be given for each tree (usually the stand or stand layer age).
The estimation methods "NFI", and "Bavaria" use the standard height curve systems h_standard_gnfi3, and h_standard_bv, respectively.

Value

A tibble in the same format as the input pulled_inventory, but with the additional columns h_est_m, i.e. height estimates for every tree, species_group, d_q_cm, and h_q_m.

Examples

 # Pull tree data from an fe_inventory object
 pulled_inventory <- data_ex3_sample_fe_inventory |>
   pull_trees()

 # Use the NFI method. The h_q fallback warning is expected here where a
 # species x layer group has no measured height.
 suppressWarnings(
   height_complete_inventory(pulled_inventory, method = "NFI")
 )

 # ... and the Bavaria method on the same data
 suppressWarnings(
   height_complete_inventory(pulled_inventory, method = "Bavaria")
 )


Import BaySF-style named flat files (experimental preview of Format 3)

Description

[Experimental]

Reads a folder that already contains BaySF-style named flat files (BHD.txt, Inventurpunkte.txt, SCH.txt) and re-shapes them into the standard BaySF intermediate output files (fdinvbhd.txt, fdinvba.txt, fdinvkrs.txt, fcbestku.txt, fdvikrs.txt). Unlike import_sample_concentric_format1_raw_to_pre() / import_sample_concentric_format2_raw_to_pre(), which convert field-collected raw data, this reader expects files that are already close to the BaySF target format.

Usage

import_data_BaySF_inraw(
  input_path,
  bhds_from = bhds_from,
  radiuses = radiuses,
  year = year
)

Arguments

input_path

Path of the input data folder (character)

bhds_from

A vector of the lower diameter limits of the concentric circles (numeric)

radiuses

A vector of the radiuses of the concentric circles (numeric)

year

The year of the inventory (numeric)

Details

This is an early, experimental reader for a third, “BaySF-named” raw input format. It is not part of the public import API, carries no correctness or stability guarantee, and its interface may change. It will probably converge into the future import_sample_concentric_format_3_raw_to_pre.


Import BaySF-style deadwood inventory data

Description

[Experimental]

Usage

import_deadwood_data_baysf(input_path)

Arguments

input_path

Path to the input data folder (character). The folder must contain the file fdinvtot.txt in BaySF format.

Details

Wrapper that reads BaySF-style deadwood inventory data from the text file fdinvtot.txt and converts the raw column names to the internal FeNEU / ForestElementsR naming convention used for deadwood processing. Deadwood import is not part of the first release and may change.

Value

A tibble with standardized deadwood variables (one row per deadwood object).


Convert raw sample inventory data (format 1) to preprocessed BaySF style data

Description

Reads format 1 raw sample inventory data collected with the concentric-circle method and writes the five standard BaySF-style intermediate files (fdinvbhd.txt, fdinvba.txt, fdinvkrs.txt, fcbestku.txt, fdvikrs.txt) into output_dir.

Usage

import_sample_concentric_format1_raw_to_pre(
  input_path,
  output_dir,
  treelist_filename = "Baumschicht.txt",
  inv_punkt_filename = "Inv_punkt.txt",
  small_trees_filename = NULL,
  circle_def_filename = NULL,
  species_guess = FALSE,
  dbh_cm_from = NULL,
  radiuses_m = NULL,
  coord_sys = NULL,
  inventory_year = NULL,
  encoding = "auto"
)

Arguments

input_path

Path to the folder holding the source files (character).

output_dir

Folder the preprocessed BaySF-style files are written to (character, required). There is deliberately no default: the function writes files, and a default would write into the folder the raw data came from, i.e. into the user's own filespace. Created if it does not exist. Untouched if validation fails.

Should the plot ids of the tree list and the inventory-point file not match, two diagnostic files listing the offending plots are written here as well: tree_not_in_inv.txt (plots with trees but no inventory point – their trees are dropped further down the build) and inv_not_in_tree.txt (inventory points without trees). They go to the output folder, never next to the input data, because this is the folder you chose to be written to.

treelist_filename

Name of the tree-list file (with or without the .txt extension).

Required columns (German alias in parentheses):

plot_id

Plot identifier (character or integer). Must match the plot_id values in inv_punkt_filename exactly.

dbh (bhd)

Diameter at breast height, in cm (numeric, >= 0; use 0 for small-tree / ingrowth records).

height (hoehe)

Total tree height, in m (numeric, 0-50; NA if not measured).

species (baumart)

Species code in BaySF integer coding, or a species abbreviation when species_guess = TRUE (see the species_guess argument).

angle (winkel)

Azimuth from plot centre to the tree stem, in decimal degrees (numeric, 0-360). May be NA for trees on the innermost circle, which need no position; a larger tree without a position is excluded (with a report warning).

distance (entfernung)

Horizontal distance from plot centre to the tree stem, in m (numeric, > 0). Same NA rule as angle.

layer (schicht)

Stand-layer code (integer): 1 = main stand (OS), 2 = understorey (US), 3 = advance regeneration (VVJ), 4 = residual stand (NHR), 5 = overstorey (UEH), 6 = veteran tree (ALT).

mortality (mortal)

Mortality status (integer): 0 = alive, 1 = recently dead (Frischmortalitaet), 2 = older snag (Altmortalitaet).

count (anzahl)

Number of trees this record represents (integer, usually 1; values > 1 are used for small-tree tally records where individual trees are not located).

Optional columns:

age (alter)

Stand (or stand-layer) age in years – never an individual-tree age, even though it is stored redundantly per tree row (numeric). Optional; used if present. Missing or incomplete age limits which analyses are possible and triggers a warning on import – see the “Stand age” section in Details.

tree_nr (baumnummer)

Tree number within the plot. It may be supplied but is not processed further: tree identification – in particular when linking two successive inventories – rests solely on the coordinates, and trees without coordinates (the innermost circle) are treated as unmatchable. So no tree number is ever consumed.

Any further columns are ignored – extra columns do not disturb the import, they are simply not used. As FeNEU develops, more columns may become supported (this applies to all raw import formats).

inv_punkt_filename

Name of the inventory-point file (with or without the .txt extension).

Required columns (German alias in parentheses):

plot_id

Plot identifier (character or integer). Must match the values in treelist_filename exactly.

coord_x

X coordinate (easting / longitude) of the plot centre, in the coordinate reference system declared either by the optional coord_sys column below or by the coord_sys argument (numeric).

coord_y

Y coordinate (northing / latitude) of the plot centre (numeric).

rep_area (repfl)

Area represented by this inventory plot, in ha (numeric, > 0).

slope (neigung)

Terrain slope at the plot centre, in percent (numeric, >= 0; e.g. 27 means a 27 percent slope). Used for the horizontal-projection (area) correction of the concentric circles; use 0 for level ground. The BaySF-native name neigung is accepted as an alias; the pre-reader converts the percent value to the internal slope in degrees.

Optional columns:

coord_sys

Coordinate reference system of coord_x/coord_y, one value for the whole file. Either a FeNEU key ("gk4", "lonlat", … – see the coord_sys argument) or an EPSG declaration ("EPSG:31468", "31468"). When absent, the coord_sys argument must supply it; when both are given they must agree (otherwise the import stops).

survey_date (erfdat)

Survey date in any format parseable by detect_date_format (character or Date). Only its year is used (see inventory_year); the day and month are discarded. If inventory_year is given it wins and this column is not read; if it is absent, either survey_date or inventory_year must be present.

fe_ikl

Circle-class key (integer). Only needed when the inventory uses more than one circle definition: it links each plot to its class in the per-class circle-definition file (circle_def_filename). Omit it when one circle definition applies to all plots (dbh_cm_from/radiuses_m or an fe_ikl = "ALL" file).

Further columns are ignored (they do not disturb the import).

small_trees_filename

Name of the small-tree file (with or without the .txt extension), or NULL (default) if none exists. Small trees are trees below the inventory's usual caliper threshold (“Kluppschwelle”) – often even below breast height (1.3 m) – and are therefore recorded with somewhat different methods: un-located tally records (no azimuth/distance). They are carried into the small_trees slot of each inventory plot. A record needs at least one size measure: a diameter (dbh > 0) or a height. Records with dbh > 0 are sorted into the regular trees slot; those with dbh = 0 stay small trees and must then carry a height. Required columns (German alias in parentheses):

plot_id

Plot identifier matching the tree-list.

dbh (bhd)

DBH in cm (0 for small trees below the caliper threshold).

height (hoehe)

Height in m (numeric, NA if not measured).

species (baumart)

Species code (same coding as main tree list).

count (anzahl)

Count of trees this record represents.

Optional columns:

layer (schicht)

Stand-layer code (integer), same coding as the tree list; used if present to place the small-tree records in a layer.

age (alter)

Stand (stand-layer) age in years; used if present.

tree_nr (baumnummer)

Tree / tally number – may be supplied but is not processed further (see the tree-list note above).

Any further columns are ignored (they do not disturb the import).

circle_def_filename

Name of the circle-definition file (with or without the .txt extension), or NULL (default). An fe_ikl-keyed Probekreisdefinition file with columns fe_ikl, dbh_cm_from (lower DBH limit, cm) and radiuses_m (circle radius, m), one row per concentric circle (the older bhd_cm_von / radius_m names are still accepted as aliases). Use fe_ikl = "ALL" for a single definition applied to every plot (it must then be the only definition); otherwise give one integer fe_ikl per circle class and link each inventory point to its class via the point file's own fe_ikl column. Create a uniform file with generate_circle_definition. Supply either this file or dbh_cm_from/radiuses_m, never both.

species_guess

Logical. If TRUE the function tries to map text species abbreviations to numeric BaySF codes using species_abbreviations_bavrn_state. Default is FALSE.

This is a stopgap for real-world data whose species column holds text abbreviations instead of codes. We strongly recommend supplying the proper numeric BaySF species codes (species_guess = FALSE) instead: guessing relies on exact, case-insensitive, and – as a last resort – fuzzy matching, and the fuzzy tier can silently mis-assign an ambiguous abbreviation. When guessing runs, always check the returned species_mapping (especially the tier == "review" rows, which also set needs_review = TRUE) before trusting the result.

dbh_cm_from

Numeric vector of lower DBH limits in cm for each concentric circle, or NULL. Alternative to circle_def_filename; must have the same length as radiuses_m. A circle definition (file or these arguments) is required.

radiuses_m

Numeric vector of circle radii in m, or NULL. Same length as dbh_cm_from.

coord_sys

Coordinate reference system of coord_x/coord_y in the inventory-point file, or NULL (default) to take it from that file's own optional coord_sys column. One of "lonlat" (EPSG:4326), "etrs89" (4258), "utm32"/"utm33" (25832, 25833), "gk2"-"gk5" (31466-31469).

The system is never guessed: if neither the column nor this argument states it, the import fails and says so; if both do and they disagree, it fails and names both; and if the declaration contradicts the magnitude of the coordinates (geographic values declared as projected or vice versa), it fails with a concrete suggestion.

The preprocessed fdinvkrs.txt stores the plot centres in a projected metric CRS – the gauss_rw/gauss_hw columns carry UTM/Gauss-Krueger by convention, as real BaySF exports do. Geographic input (lonlat/etrs89) is therefore reprojected to UTM32 (EPSG:25832) here, when the pre is written; already-projected input (gk*, utm*) is kept as is. The CRS of the written coordinates is recorded in the coord_sys column, so the pre reader picks it up without a second declaration.

inventory_year

Optional single survey year (e.g. 2025). It overrides any survey_date in the point file and is then the year for every plot; survey_date is not parsed. If omitted, the year is taken as the plain calendar year of each plot's survey_date. If neither is available the import stops and asks for inventory_year.

Downstream only the year is kept (each plot object carries a single time_yr). Set inventory_year deliberately by the growing season the survey belongs to: a survey done in, e.g., April counts for the previous season, since almost no growth has happened yet. This choice matters most when the increment between two successive inventories is computed later – the period length is the difference of the two inventory years, so an off-by-one year biases the whole increment rate.

encoding

Character encoding of the source .txt files. Default "auto" detects the encoding per file (UTF-8, including a byte-order mark, vs. Latin-1/Windows-1252), so users normally never set this. Pass an explicit encoding string only to force a particular one in a pathological case.

Details

Column names in the source files are case-insensitive (converted to lower case internally). Both English canonical names and their German equivalents are accepted; the German alias is silently renamed to the English canonical before validation.

In its raw encoding, Format 1 records measurements in familiar units (DBH in cm, height in m), the tree position as a single azimuth angle (degrees) plus a distance (m), the stand layer directly as BaySF layer codes, and both living and dead trees. Format 2 encodes the same information differently (DBH in mm, a gon-or-degree back azimuth with a unit flag, its own layer code, living trees only); see import_sample_concentric_format2_raw_to_pre.

Stand age. Age in forest inventories always refers to the stand or stand layer, never to the individual tree, even though it is recorded redundantly in every tree row. It is optional: in structure-rich, uneven-aged stands – increasingly important in practice – a meaningful stand age often cannot be given. When the age is missing or incomplete, the analyses that group by age class are unavailable: base tables and structure tables by age class, and the age-class breakdown of increment from a repeated inventory – all of these can be run by mean-diameter (dq) class instead. Increment from yield tables and from the BWI3 (gnfi3) functions requires the age and is not possible without it. A warning is issued on import whenever the age is absent or has gaps, so an accidental omission can be noticed and corrected; users whose forest structure genuinely precludes a stand age can ignore it.

No height completion is performed here. Measured tree heights are carried through as given (missing heights stay NA); the converter only records which heights were measured (internal hmb flag) and normalises their unit where the raw format requires it. Estimating the missing heights is a deliberate, separate downstream step – pull_trees() |> height_complete_inventory() |> fill_heights_back() – so that measured and estimated heights are never silently mixed.

Value

A named list (the common raw-to-pre report): ok (logical), errors (character), warnings (character), paths (the written files, or NULL if !ok), species_mapping and needs_review. On success it writes fdinvbhd.txt, fdinvba.txt, fdinvkrs.txt, fcbestku.txt, and fdvikrs.txt into output_dir.

When species_guess = TRUE, species_mapping is a tibble with one row per raw species abbreviation (raw, n_trees, canonical, species_id, name_ger, tier). A tier of "confirmed" means an exact or case-insensitive match; "review" means the code was resolved only by substring / fuzzy / mojibake matching and is worth a manual check. needs_review is TRUE whenever any row is "review" (with a matching warning); both are NULL/FALSE when species_guess = FALSE.

Format 1 and Format 2

FeNEU currently supports two raw data formats for sample inventories with concentric circles. The two grew up in parallel with FeNEU itself and have no fundamental differences in content – they simply reflect different user preferences for how the data are exported. We call them “Format 1” and “Format 2”. This function reads Format 1; Format 2 is read by import_sample_concentric_format2_raw_to_pre. Both produce the same BaySF-style preprocessed files, so everything downstream is identical.

Examples

# Use example raw input data shipped with the package
# and write them to a temporary folder.

td <- tempdir()

# Write example tables under the recommended Format-1 file names
readr::write_delim(
  data_ex1_sample_raw_trees,
  file = file.path(td, "Baumschicht.txt"),
  delim = "\t"
)

readr::write_delim(
  data_ex1_sample_raw_points,
  file = file.path(td, "Inv_punkt.txt"),
  delim = "\t"
)

readr::write_delim(
  data_ex1_sample_raw_smalltrees,
  file = file.path(td, "Verjuengung.txt"),
  delim = "\t"
)

# Definition of concentric sample circles
dbh_cm_from <- c(0, 12, 30, 48)
radiuses_m  <- c(2.82, 5.64, 11.28, 17.84)

# Create BaySF-style intermediate files in a separate temporary folder
# (function is called for its side effects). output_dir is mandatory --
# the converter never picks a target folder itself.
out_dir <- file.path(tempdir(), "pre_ex1")
import_sample_concentric_format1_raw_to_pre(
  input_path = td,
  output_dir = out_dir,
  treelist_filename = "Baumschicht",
  inv_punkt_filename = "Inv_punkt",
  small_trees_filename = "Verjuengung",
  species_guess = TRUE,
  dbh_cm_from = dbh_cm_from,
  radiuses_m = radiuses_m,
  coord_sys = "gk4"
)

# Check that one of the output files was created
file.exists(file.path(out_dir, "fdinvbhd.txt"))


Convert raw sample inventory data (format 2) to preprocessed BaySF style data

Description

Reads format 2 raw sample inventory data collected with the concentric circle method and writes the standard preprocessed BaySF-style intermediate files (fdinvbhd.txt, fdinvba.txt, fdinvkrs.txt, fcbestku.txt, fdvikrs.txt) into output_dir.

Usage

import_sample_concentric_format2_raw_to_pre(
  input_path,
  output_dir,
  treelist_filename = "02_probekreis.txt",
  inv_punkt_filename = "01_root_entity.txt",
  circle_def_filename = NULL,
  species_guess = FALSE,
  dbh_cm_from = NULL,
  radiuses_m = NULL,
  coord_sys = NULL,
  inventory_year = NULL,
  encoding = "auto"
)

Arguments

input_path

Path to the folder holding the source files (character).

output_dir

Folder the preprocessed BaySF-style files are written to (character, required). There is deliberately no default: the function writes files, and a default would write into the folder the raw data came from, i.e. into the user's own filespace. Created if it does not exist. Untouched if validation fails.

treelist_filename

Name of the tree-list file (Format 2 source table 02, with or without the .txt extension). Default "02_probekreis.txt" (the format's standard file name).

Required columns:

koord

Plot identifier (integer). Must match koord in the inventory-point file exactly.

ba_fe

Species code (BaySF bavrn_state integer coding).

bhd

Diameter at breast height, in mm (cm × 10); converted to cm internally.

hoehe_1

Total tree height, in dm; converted to m internally (NA if not measured).

pol_entf

Horizontal distance from plot centre, in cm.

pol_wink, rueckazimut_gon, rueckazimut_grad, einheit_azimut

Azimuth of the tree. pol_wink (degrees) is used if present; otherwise the back azimuth is read from the column that einheit_azimut declares – 1 = rueckazimut_gon (gon, converted × 0.9 to degrees), 2 = rueckazimut_grad (degrees). einheit_azimut is authoritative: if it does not match the populated column, the tree is treated as having no usable azimuth rather than reading a value in the wrong unit. Trees outside the innermost circle that end up without a usable position are excluded from the output, with a prominent warning in the report. An innermost-circle tree may legitimately carry no azimuth.

bestku

Stand-layer code in the Format-2 coding – not the BaySF coding; it is remapped internally. See the “Stand-layer coding” section below.

Optional columns:

alter_ba

Stand (or stand-layer) age in years – never an individual-tree age, even though it is stored redundantly per tree row. Used if present. Missing or incomplete age limits which analyses are possible and triggers a warning on import – see the “Stand age” section in Details.

baumnummer

A tree number within the plot. It may be supplied but is not processed further: tree identification – in particular when linking two successive inventories – rests solely on the coordinates, and trees without coordinates (the innermost circle) are treated as unmatchable, so no tree number is ever consumed.

Any further columns are ignored – extra columns do not disturb the import. Format 2 records only living trees (no mortality column); mortality is set to 0 for every record.

inv_punkt_filename

Name of the inventory-point file (Format 2 source table 01, with or without the .txt extension). Default "01_root_entity.txt" (the format's standard file name).

Required columns:

koord

Plot key linking the point to its trees.

lage_probekreismittelpunkt_x / lage_probekreismittelpunkt_y

Plot-centre coordinates. Their coordinate reference system is declared either by the file's own optional lage_probekreismittelpunkt_srs column (an EPSG declaration such as "EPSG:4326", as written by the native export) or by the coord_sys argument – see there.

repfl

Represented area (ha).

Optional columns:

date_created

Survey date, in any format parseable by detect_date_format. Only its year is used (see inventory_year); the day and month are discarded. If inventory_year is given it wins and this column is not read; if it is absent, either date_created or inventory_year must be present.

lage_probekreismittelpunkt_srs

CRS declaration; see coord_sys.

neigung (or slope)

Terrain slope, in percent. Format 2's multi-table source usually carries no slope; when the column is absent the slope defaults to 0 (level ground, no horizontal-projection area correction of the concentric circles) and a warning is issued. Supply neigung only if the plots actually lie on a slope.

Any further columns are ignored – extra columns do not disturb the import.

circle_def_filename

Name of the circle-definition file (with or without the .txt extension), or NULL (default). An fe_ikl-keyed Probekreisdefinition file with columns fe_ikl, dbh_cm_from (lower DBH limit, cm) and radiuses_m (circle radius, m); use fe_ikl = "ALL" for one uniform definition. Create a uniform one with generate_circle_definition. Supply either this file or dbh_cm_from/radiuses_m, never both.

In practice Format 2 runs uniform: its source tables carry no circle-class key (the inventory-point table has no fe_ikl column), so one circle definition applies to every plot – give it via dbh_cm_from/radiuses_m or an fe_ikl = "ALL" file. The per-class (multi-fe_ikl) path exists only for the shared machinery and is reached only if a user deliberately adds an fe_ikl column to the inventory-point file.

species_guess

Logical. Currently unused; reserved for future species-guessing support. Default is FALSE.

dbh_cm_from

Numeric vector of lower DBH limits (cm) for each concentric circle, or NULL. Alternative to circle_def_filename; must have the same length as radiuses_m. A circle definition (file or these arguments) is required.

radiuses_m

Numeric vector of circle radii (m), or NULL. Same length as dbh_cm_from.

coord_sys

Coordinate reference system of the plot-centre coordinates, or NULL (default) to take it from the point file's own optional lage_probekreismittelpunkt_srs column. One of "lonlat" (EPSG:4326), "etrs89" (4258), "utm32"/"utm33" (25832, 25833), "gk2"-"gk5" (31466-31469).

The native Format-2 export stores geographic coordinates and declares them (srs = "EPSG:4326"), so it normally needs no argument here. Nothing is guessed, though: if neither the column nor this argument states the system, the import fails and says so; if both do and they disagree, it fails and names both; and if the declaration contradicts the magnitude of the coordinates, it fails with a concrete suggestion. (Real exports do contain unusable srs values such as "GUESS!!"; those count as no declaration.)

The preprocessed fdinvkrs.txt stores the plot centres in a projected metric CRS – the gauss_rw/gauss_hw columns carry UTM/Gauss-Krueger by convention, as real BaySF exports do. Geographic input (lonlat/etrs89) is therefore reprojected to UTM32 (EPSG:25832) here, when the pre is written; already-projected input (gk*, utm*) is kept as is. The CRS of the written coordinates is recorded in the coord_sys column, so the pre reader picks it up without a second declaration.

inventory_year

Optional single survey year (e.g. 2025). It overrides any date in the point file and is then the year for every plot; the file's date_created is not parsed. If omitted, the year is taken as the plain calendar year of each plot's date_created. If neither is available the import stops and asks for inventory_year.

Downstream only the year is kept (each plot object carries a single time_yr). Set inventory_year deliberately by the growing season the survey belongs to: a survey done in, e.g., April counts for the previous season, since almost no growth has happened yet. This choice matters most when the increment between two successive inventories is computed later – the period length is the difference of the two inventory years, so an off-by-one year biases the whole increment rate. The native Format-2 date_created is the ambiguous DD-MM-YY; for such data passing inventory_year explicitly is the recommended path.

encoding

Character encoding of the source .txt files. Default "auto" detects the encoding per file (UTF-8, incl. BOM, vs. Latin-1/Windows-1252); pass an explicit encoding only to force one.

Details

Format 2 defines nine source tables in total. This converter currently supports only the narrow core – two tables: the main tree list (02) and the inventory-point / coordinate table (01). Importers for the remaining tables are under construction: the tree-property data (03), regeneration incl. height classes (04-06, 08), and dead wood (07, 09) are not read yet. In particular, Format 2 has its own dedicated small-tree / regeneration format, for which a reader will be added in the future; until then no regeneration / small-tree records are produced, so this converter never yields the bhd == 0 tally rows that the BaySF-style pre-reader would otherwise split off into small trees.

In its raw encoding, Format 2 records DBH in mm and heights in dm, the tree position as a back azimuth given in gon or degrees (disambiguated by a unit flag) plus a distance in cm, its own stand-layer code (remapped to BaySF codes, see above), and living trees only. Format 1 encodes the same information differently (cm and m, a single degree azimuth, BaySF layer codes directly, living and dead trees); see import_sample_concentric_format1_raw_to_pre.

Stand age. Age in forest inventories always refers to the stand or stand layer, never to the individual tree, even though it is recorded redundantly in every tree row. It is optional: in structure-rich, uneven-aged stands – increasingly important in practice – a meaningful stand age often cannot be given. When the age is missing or incomplete, the analyses that group by age class are unavailable: base tables and structure tables by age class, and the age-class breakdown of increment from a repeated inventory – all of these can be run by mean-diameter (dq) class instead. Increment from yield tables and from the BWI3 (gnfi3) functions requires the age and is not possible without it. A warning is issued on import whenever the age is absent or has gaps, so an accidental omission can be noticed and corrected; users whose forest structure genuinely precludes a stand age can ignore it.

No height completion is performed here. Measured tree heights are carried through as given (missing heights stay NA); the converter only records which heights were measured (internal hmb flag) and normalises their unit where the raw format requires it (Format 2 stores heights in dm). Estimating the missing heights is a deliberate, separate downstream step – pull_trees() |> height_complete_inventory() |> fill_heights_back() – so that measured and estimated heights are never silently mixed.

Value

A named list (the common raw-to-pre report): ok (logical), errors (character), warnings (character), and paths (the written files, or NULL if !ok). On success it writes fdinvbhd.txt, fdinvba.txt, fdinvkrs.txt, fcbestku.txt, and fdvikrs.txt into output_dir.

Format 1 and Format 2

FeNEU currently supports two raw data formats for sample inventories with concentric circles. The two grew up in parallel with FeNEU itself and have no fundamental differences in content – they simply reflect different user preferences for how the data are exported. We call them “Format 1” and “Format 2”. This function reads Format 2; Format 1 is read by import_sample_concentric_format1_raw_to_pre. Both produce the same BaySF-style preprocessed files, so everything downstream is identical.

Stand-layer coding (bestku)

Format 2 codes the stand layer in the tree-list column bestku differently from the BaySF-style pre format and from Format 1. The converter therefore remaps the Format-2 codes onto the BaySF layer codes that the rest of the pipeline (the fcbestku table and the internal layer_key) expects:

Format 2 (bestku) -> BaySF code
1 Hauptschicht -> 1 Oberschicht (main stand)
2 Zwischenschicht -> 2 Unterstand
3 Unterschicht -> 2 Unterstand
4 Vorausverjuengung -> 3 Vorausverjuengung
5 Ueberhaelter/Nachhiebsrest -> 5 Ueberhaelter

Note in particular that the same number means different things in the two codings (e.g. Format-2 bestku = 4 is advance regeneration, whereas BaySF/Format-1 code 4 is residual stand). The main stand (code 1) is identical in both. Format 2's two sub-canopy layers (Zwischenschicht, Unterschicht) are both mapped to the single BaySF Unterstand, and Format 2's combined Ueberhaelter/Nachhiebsrest maps to Ueberhaelter.

Examples

# Use example raw input data shipped with the package
# and write them to a temporary folder under the default
# file names, so the converter can be called with its defaults.

td <- tempdir()

readr::write_delim(
  data_ex2_sample_raw_trees,
  file = file.path(td, "02_probekreis.txt"),
  delim = "\t"
)

readr::write_delim(
  data_ex2_sample_raw_points,
  file = file.path(td, "01_root_entity.txt"),
  delim = "\t"
)

# Definition of concentric sample circles
dbh_cm_from <- c(0, 12, 30)
radiuses_m  <- c(2., 6.31, 12.62)

# Create BaySF-style intermediate files in a separate temporary folder
# (function is called for its side effects; the file names default to the
# format's standard names "02_probekreis.txt" / "01_root_entity.txt").
# output_dir is mandatory -- the converter never picks a target itself.
# The example points carry their own srs (EPSG:4326), so no coord_sys is
# needed; inventory_year is passed because the native date_created is the
# ambiguous DD-MM-YY.
out_dir <- file.path(tempdir(), "pre_ex2")
import_sample_concentric_format2_raw_to_pre(
  input_path = td,
  output_dir = out_dir,
  dbh_cm_from = dbh_cm_from,
  radiuses_m = radiuses_m,
  inventory_year = 2025
)

# Check that one of the output files was created
file.exists(file.path(out_dir, "fdinvbhd.txt"))


Concentric Sample Inventory: Preprocessed Files to fe_inventory

Description

The pre-to-fe_inventory step of the concentric sample import chain. Reads a folder of preprocessed BaySF-style files (fdinvbhd.txt, fdinvba.txt, fdinvkrs.txt, fcbestku.txt, fdvikrs.txt) – produced by import_sample_concentric_format1_raw_to_pre / import_sample_concentric_format2_raw_to_pre, or supplied directly in that shape – and builds an fe_inventory of fe_ccircle_spatial plots.

Usage

import_sample_concentric_pre_to_fe_inventory(
  input_path,
  style = "baysf",
  coord_sys = NULL,
  check_envelope = TRUE,
  encoding = "auto"
)

Arguments

input_path

Folder holding the preprocessed BaySF-style files (character).

style

Format family of the preprocessed data. Currently only "baysf" (Bavarian State Forest style); the argument exists so future concentric styles slot in without changing the call shape.

coord_sys

Coordinate reference system of the plot coordinates; see read_and_convert_data. If NULL, a format-specific default is used ("gk4" for the BaySF style).

Geographic coordinates ("lonlat", "etrs89") are accepted and are reprojected to the matching UTM zone on import – tree positions are built metrically from distance and azimuth around the plot centre, which degrees do not allow. The plot coordinates of the returned object are then in UTM, and a message states the zone.

State coord_sys explicitly for Gauss-Krueger data. BaySF files normally store the easting without the zone prefix (a six-digit Rechtswert), which on its own is not valid Gauss-Krueger. When you declare a "gk*" system, the prefix is added to match your declaration and a message says so. When coord_sys was left NULL and merely defaulted, the same step would be a guess – UTM eastings occupy exactly the same six-digit range – so the import stops and asks you to name the system instead of silently altering your coordinates.

check_envelope

Logical, default TRUE. Warn when the coordinates, interpreted with the given coord_sys, fall outside German-speaking Europe – the usual sign of a coord_sys that does not match the data. It is a plausibility hint, not a restriction: set FALSE for inventories that genuinely lie elsewhere.

encoding

Character encoding of the preprocessed .txt files. Default "auto" detects the encoding per file (UTF-8, incl. BOM, vs. Latin-1/Windows-1252); pass an explicit encoding only to force one. The files are read entirely as text and only the consumed numeric columns are parsed, so a comma decimal is never mis-read as a thousands mark – the same decimal-robustness / encoding handling as the raw converters.

Details

Counterpart to import_standwise_relascope_pre_to_fe_inventory.

Building the inventory objects can take a while for large forest units (thousands of plots). Progress is reported through the progressr framework, one step per plot. By default nothing is shown; wrap the call to see a progress bar, and the same code drives a native Shiny progress bar inside shiny::withProgress() / progressr::withProgressShiny():

progressr::handlers("cli")
progressr::with_progress(
  inv <- import_sample_concentric_pre_to_fe_inventory(input_path)
)

No height completion is performed here either: the returned inventory carries the measured heights as they are (missing ones stay NA). Estimating them is a deliberate, separate downstream step – pull_trees() |> height_complete_inventory() |> fill_heights_back().

Value

An fe_inventory of fe_ccircle_spatial plots.

A note on the BaySF-style column names

The plot-centre coordinate columns are named gauss_rw/gauss_hw (Gauss-Krueger Rechtswert / Hochwert) for historical reasons, but modern BaySF exports store UTM32 (ETRS89 / UTM zone 32N) values in them – the “gauss” name is a legacy label, not a statement about the CRS (native files even carry a GAUSS_KZ zone field that no longer reflects the actual system). FeNEU therefore never infers the CRS from the column name: pre files it writes itself record the real CRS in a coord_sys column (self-describing, so no argument is needed here), while a genuine BaySF export has no such column and you must pass coord_sys explicitly – for current data that is almost always "utm32".

See Also

import_sample_concentric_format1_raw_to_pre, read_and_convert_data

Examples

# The bundled example pre carries a coord_sys column (utm32), so it is
# self-describing and needs no coord_sys argument.
inv_path <- system.file("extdata", "data_ex3_sample_pre",
                        package = "FeNEU")
inv <- import_sample_concentric_pre_to_fe_inventory(inv_path)
inv


Import Per-Stand Metadata Companion to Format 1 Standwise Inventory Data

Description

Reads a per-stand metadata file (default name Inventuraufnahmen.txt) coming with Format 1 standwise inventory data (Silvarith-style) and returns one tibble row per stand with canonical lower-case ASCII column names. This is the metadata companion used by import_standwise_relascope_format1_stand_register_bundle and produces a tibble suitable as the stand_data argument of stand_register_pdf.

Usage

import_standwise_relascope_format1_metadata(
  input_path,
  filename = "Inventuraufnahmen",
  encoding = "auto"
)

Arguments

input_path

Path of the folder containing the source file (character).

filename

File name (without .txt extension). Default "Inventuraufnahmen".

encoding

Character encoding. Default "auto" (detected).

Details

The source file's headers are very long and can contain special characters (Ø, slashes, parentheses, German umlauts), so columns are matched by position rather than by name — the file must have exactly 13 columns in the order shown below.

Canonical columns (in order):

bestand

Stand identifier (character, matches the WZP bestand column).

bestandesform

Stand-form classification (e.g. "Kie-Lä-Bu").

alter_mittel

Mean stand age in years.

nutzungsart

Management type code (e.g. "VJT", "LB").

bemerkung

Free-text remark (may be empty).

bestflaeche

Stand area in ha.

bestockungsgrad

Stocking degree (BG, dimensionless).

vorrat_efm_ha

Standing volume in efm D.o.R. per ha.

aufnahmeart

Survey type: 1 = VK, 2 = WZP, 4 = fest. PK, 5 = konz. PK.

zaehlbreite

Angle-count factor or max. circle area, as a string (e.g. "ZB 4,0").

n_stichproben

Number of sample plots in the stand.

stp_pro_ha

Plot density (STP / ha).

stdfehler_pct

Sampling error of standing volume in percent (numeric, parsed from strings like "24,4%").

Value

A tibble with one row per stand and the 13 canonical columns described above.

See Also

import_standwise_relascope_format1_stand_register_bundle, stand_register_pdf


Import a Stand-Wise Angle-Count Inventory: Silvarith-style Raw to Preprocessed

Description

The raw-to-pre step of the stand-wise relascope (“Winkelzählprobe” / angle-count) import chain. Reads a Silvarith-style raw tree file (EingabedatenGesamt.txt: German locale – decimal comma, umlaut headers, DD.MM.YYYY dates), validates it (collecting every problem rather than stopping at the first), and – if valid – writes the preprocessed WZP_Daten.txt (the canonical ASCII / decimal-point form) that import_standwise_relascope_pre_to_fe_inventory reads.

Usage

import_standwise_relascope_format1_raw_to_pre(
  input_path,
  output_dir,
  treelist_filename = "EingabedatenGesamt.txt",
  encoding = "auto"
)

Arguments

input_path

Folder holding the raw file (character).

output_dir

Folder the preprocessed WZP_Daten.txt is written to (character, required). There is deliberately no default: the function writes files, and a default would write into the folder the raw data came from, i.e. into the user's own filespace. Created if it does not exist. Untouched if validation fails.

treelist_filename

Raw file name, with or without the .txt. Default "EingabedatenGesamt", the standard Silvarith export name.

encoding

Character encoding of the source file. Default "auto" detects it (UTF-8, incl. BOM, vs. Latin-1/Windows-1252); pass an explicit encoding only to force one.

Details

This is the direct counterpart to import_sample_concentric_format1_raw_to_pre for concentric sample inventories: a single top-level converter that performs its own validation (“plausi”) internally and returns a collected report. There is no separately exported plausi function.

“Silvarith-style” describes the shape of the data. Silvarith is a stand-wise angle-count software; this importer targets its export layout without claiming exact or official compatibility. A user who already holds a WZP_Daten.txt – Silvarith also produces one directly, or it was made earlier by this function – skips this step and goes straight to import_standwise_relascope_pre_to_fe_inventory.

Required columns (after tolower() of the header):

stpnr

Plot number within the stand (integer).

lfdnrstp

Sequential record number within the plot; renamed to lfd_nr.

bestand

Stand identifier (character).

best.-fläche

Stand area in ha (decimal comma); renamed to bestflaeche.

zf

Angle-count factor; renamed to zaehlfaktor.

ba

Species code in BaySF coding; renamed to baumart.

alter

Age in years (integer).

schicht

Silvarith layer code in {0, 1, 2, 3}: 0 = main stand (Hauptschicht), 1 = harvest remnants (Nachhiebsreste), 2 = veterans (Ueberhaelter) – 1 and 2 both fall into the remnant/veteran layer – 3 = understorey (Unter-/Zwischenschicht). Mapped to fe_stand layer_key in import_standwise_relascope_pre_to_fe_inventory; Silvarith has no code for advance regeneration.

anz.

Tree count for this record; renamed to anzahl.

bhd

DBH in cm (decimal comma).

höhe

Height in m (decimal comma); renamed to hoehe.

stichtag

Survey date in DD.MM.YYYY format.

Collected checks: bhd non-negative; schicht in {0, 1, 2, 3}; stichtag parseable as %d.%m.%Y; hoehe > 50 m raises a (non-blocking) warning.

No height completion is performed here, and missing heights are not rejected: measured tree heights are carried through as given (missing ones stay NA). Estimating the missing heights is a deliberate, separate downstream step – pull_trees() |> height_complete_inventory() |> fill_heights_back() – so that measured and estimated heights are never silently mixed. (Angle-count surveys usually measure a height for every tallied tree, so missing heights are uncommon here, but they are tolerated.)

Value

A named list (the common raw-to-pre report):

ok

Logical. TRUE if the file passed validation and was written.

errors

Character vector of validation problems; empty if ok.

warnings

Character vector of non-blocking notices; may be non-empty even when ok.

paths

Character vector of written files, or NULL if !ok.

See Also

import_standwise_relascope_pre_to_fe_inventory, import_sample_concentric_format1_raw_to_pre

Examples

# The bundled example uses the canonical Silvarith export name
# "EingabedatenGesamt.txt" (the default of `treelist_filename`).
sil_dir <- system.file("extdata", "data_ex6_standwise_raw", package = "FeNEU")
out_dir <- tempdir()
result  <- import_standwise_relascope_format1_raw_to_pre(
  sil_dir, output_dir = out_dir
)
result$ok
result$paths


Import a Standwise Format 1 Data Bundle (Trees + Stand Metadata) Required For a Stand Register (Revierbuch)

Description

Convenience orchestrator that reads both, a raw standwise Format 1 input file, and its metadata companion (both Silvarith-style) for one forest management unit from a single folder and returns the two artefacts needed for a stand_register_pdf call:

Usage

import_standwise_relascope_format1_stand_register_bundle(
  input_path,
  treelist_filename = "EingabedatenGesamt",
  inventuraufnahmen_filename = "Inventuraufnahmen",
  encoding = "auto"
)

Arguments

input_path

Path of the folder containing both source files (character).

treelist_filename

File name of the trees export (without .txt). Default "EingabedatenGesamt".

inventuraufnahmen_filename

File name of the metadata export (without .txt). Default "Inventuraufnahmen".

encoding

Character encoding for both files. Default "auto" detects it per file (UTF-8, incl. BOM, vs. Latin-1/Windows-1252); pass an explicit encoding only to force one.

Details

Cross-checks that every stand referenced in the inventory has a corresponding row in stand_data and emits a warning if any are missing (the inventory data is still returned in that case).

Value

A named list with elements fe_inv (an fe_inventory) and stand_data (a tibble).

See Also

import_standwise_relascope_format1_metadata, import_standwise_relascope_format1_raw_to_pre, stand_register_pdf


Stand-Wise Relascope Inventory: Preprocessed WZP_Daten.txt to fe_inventory

Description

The pre-to-fe_inventory step of the stand-wise relascope (“Winkelzählprobe” / angle-count) import chain. Reads the preprocessed WZP_Daten.txt – produced by import_standwise_relascope_format1_raw_to_pre, or a Silvarith-style WZP_Daten.txt supplied directly – and builds an fe_inventory of fe_stand plots.

Usage

import_standwise_relascope_pre_to_fe_inventory(
  input_path,
  style = "silvarith",
  encoding = "auto"
)

Arguments

input_path

Folder holding the preprocessed WZP_Daten.txt (character).

style

Format family of the preprocessed data. Currently only "silvarith" (Silvarith-style); the argument exists so future stand-wise styles slot in without changing the call shape.

encoding

Character encoding of the preprocessed WZP_Daten.txt. Default "auto" detects it (UTF-8, incl. BOM, vs. Latin-1/Windows-1252); pass an explicit encoding only to force one. The file is read entirely as text and only the consumed numeric columns are parsed, so a comma decimal is never mis-read as a thousands mark – the same decimal-robustness / encoding handling as the raw converter.

Details

Counterpart to import_sample_concentric_pre_to_fe_inventory.

Building the inventory objects can take a while for large forest units (thousands of plots). Progress is reported through the progressr framework, one step per plot. By default nothing is shown; wrap the call to see a progress bar, and the same code drives a native Shiny progress bar inside shiny::withProgress() / progressr::withProgressShiny():

progressr::handlers("cli")
progressr::with_progress(
  inv <- import_standwise_relascope_pre_to_fe_inventory(input_path)
)

No height completion is performed here either, and missing heights are not rejected: the returned inventory carries the measured heights as they are (missing ones stay NA). Estimating them is a deliberate, separate downstream step – pull_trees() |> height_complete_inventory() |> fill_heights_back().

Value

An fe_inventory of fe_stand plots.

See Also

import_standwise_relascope_format1_raw_to_pre, read_and_convert_data

Examples

# Build a preprocessed WZP_Daten.txt from the bundled Silvarith-style example,
# then read it into an fe_inventory.
sil_dir <- system.file("extdata", "data_ex6_standwise_raw", package = "FeNEU")
out_dir <- tempdir()
import_standwise_relascope_format1_raw_to_pre(sil_dir, output_dir = out_dir)
inv <- import_standwise_relascope_pre_to_fe_inventory(out_dir)
inv


Reference Tree Increment Data for Automated Tests (sub_10, rep_classic)

Description

Reference Tree Increment Data for Automated Tests (sub_10, rep_classic)

Details

Provided for automated testing. Contains the tree_increments tibble produced by inv_increment_repsurv_ccirc with method "rep_classic", applied to data_ex3_previous_sample_fe_inventory (first survey) and data_ex3_sample_fe_inventory (second survey), with match_type = "plot_id" and plot_id_style = "baysf".

See Also

Other example data: data_ex1_sample_raw, data_ex2_sample_raw, data_ex3_increment_interim, data_ex3_previous_sample_fe_inventory, data_ex3_sample_fe_inventory, data_ex3_trees_essentials, data_ex4_previous_sample_fe_inventory, data_ex4_sample_fe_inventory, data_ex5_previous_sample_fe_inventory, data_ex5_sample_fe_inventory, data_ex6_standwise_fe_inventory, data_ex7_standwise_fe_inventory, data_examples_overview, inc_sub10_rep_end, inc_sub10_rep_mean, inc_sub10_rep_trans, processed_heights_bav_sub10, processed_heights_nfi_sub10, processed_pulled_sub10


Reference Tree Increment Data for Automated Tests (sub_10, rep_end)

Description

Reference Tree Increment Data for Automated Tests (sub_10, rep_end)

Details

Provided for automated testing. Contains the tree_increments tibble produced by inv_increment_repsurv_ccirc with method "rep_end". See inc_sub10_rep_classic for details on the input data.

See Also

Other example data: data_ex1_sample_raw, data_ex2_sample_raw, data_ex3_increment_interim, data_ex3_previous_sample_fe_inventory, data_ex3_sample_fe_inventory, data_ex3_trees_essentials, data_ex4_previous_sample_fe_inventory, data_ex4_sample_fe_inventory, data_ex5_previous_sample_fe_inventory, data_ex5_sample_fe_inventory, data_ex6_standwise_fe_inventory, data_ex7_standwise_fe_inventory, data_examples_overview, inc_sub10_rep_classic, inc_sub10_rep_mean, inc_sub10_rep_trans, processed_heights_bav_sub10, processed_heights_nfi_sub10, processed_pulled_sub10


Reference Tree Increment Data for Automated Tests (sub_10, rep_mean)

Description

Reference Tree Increment Data for Automated Tests (sub_10, rep_mean)

Details

Provided for automated testing. Contains the tree_increments tibble produced by inv_increment_repsurv_ccirc with method "rep_mean". See inc_sub10_rep_classic for details on the input data.

See Also

Other example data: data_ex1_sample_raw, data_ex2_sample_raw, data_ex3_increment_interim, data_ex3_previous_sample_fe_inventory, data_ex3_sample_fe_inventory, data_ex3_trees_essentials, data_ex4_previous_sample_fe_inventory, data_ex4_sample_fe_inventory, data_ex5_previous_sample_fe_inventory, data_ex5_sample_fe_inventory, data_ex6_standwise_fe_inventory, data_ex7_standwise_fe_inventory, data_examples_overview, inc_sub10_rep_classic, inc_sub10_rep_end, inc_sub10_rep_trans, processed_heights_bav_sub10, processed_heights_nfi_sub10, processed_pulled_sub10


Reference Tree Increment Data for Automated Tests (sub_10, rep_trans)

Description

Reference Tree Increment Data for Automated Tests (sub_10, rep_trans)

Details

Provided for automated testing. Contains the tree_increments tibble produced by inv_increment_repsurv_ccirc with method "rep_trans". See inc_sub10_rep_classic for details on the input data.

See Also

Other example data: data_ex1_sample_raw, data_ex2_sample_raw, data_ex3_increment_interim, data_ex3_previous_sample_fe_inventory, data_ex3_sample_fe_inventory, data_ex3_trees_essentials, data_ex4_previous_sample_fe_inventory, data_ex4_sample_fe_inventory, data_ex5_previous_sample_fe_inventory, data_ex5_sample_fe_inventory, data_ex6_standwise_fe_inventory, data_ex7_standwise_fe_inventory, data_examples_overview, inc_sub10_rep_classic, inc_sub10_rep_end, inc_sub10_rep_mean, processed_heights_bav_sub10, processed_heights_nfi_sub10, processed_pulled_sub10


Inventory-Level Increment Base Table by Species Group and Age or Diameter Class

Description

Aggregates tree-level increments to the inventory level in the same four-element layout as the static base_table_age_class / base_table_d_q_class family, but for the annual volume increment (iv_hub_m3_ha_yr) instead of standing volume. It is the increment counterpart of the static base tables and the per-subunit breakdown analogue of inv_inc_big_overview_matches_only.

Usage

increment_base_table(
  tree_inc_extd,
  by_class = c("age", "dq"),
  tree_filter = TRUE
)

Arguments

tree_inc_extd

Either an increment bundle – the output of inv_increment_repeated_survey or of inv_increment_gnfi3, which is the usual case, its per-tree frame being taken from it – or a bare per-tree increment data frame.

by_class

Either "age" (default) or "dq", selecting aggregation by age class or by quadratic mean diameter class. Passed to inv_inc_tree_2_plot.

tree_filter

Expression describing which trees to keep, internally passed to filter on tree_inc_extd. Default TRUE, i.e. all trees of all layers – including those removed between the two inventories, whose increment is part of the period's total production. Pass e.g. !.data$removal to restrict to standing trees.

Details

The function operates on the per-tree increment frame produced by inv_increment_repeated_survey (repeated survey) or inv_increment_gnfi3 (single inventory). Both carry the same per-tree contract, so the same base table is produced regardless of the increment's origin. Internally the trees are first aggregated to plot level with inv_inc_tree_2_plot, then area-weighted to the inventory level via the shared primitive se_area_weighted_grouped.

This is the “plain” aggregation: each plot contributes its single representation area (area_rep_ha); there is no split into virtual monospecific areas (that is the job of a separate _main_stand variant). The per-hectare values therefore relate to one hectare of total forest, and the per-ha denominator is the full area across all plots in the input. Because totals are linear in the per-plot values, the species rows of detail sum (in iv_m3_yr_total) to the matching all_species row, and total sums to all_total – the central sum-consistency invariant (confidence intervals are not additive and are computed independently per level).

Value

A list of four tibbles, mirroring the static base table family:

detail

One row per species group and class.

total

One row per species group, across all classes.

all_species

One row per class, across all species groups (the body of the “Summe” block).

all_total

One row, the grand total.

Each carries n_plot_class (the number of inventory points falling into the group), the annual increment as both an absolute total (iv_m3_yr_total) and per hectare of operation area (iv_m3_ha_yr) with their 95% confidence half-widths (ci95_*), and the counts n_iv_filled / n_iv_total (gnfi3-estimated vs. total tree increments in the group). The plain table carries no per-species area_ha (that is the main-stand variant's job). The list additionally carries a collective element (a list with kind, label, definition) describing the tree collective the table represents: "all_layers" for the default tree_filter, otherwise a "custom" collective reporting the filter. It is carried through to the output and PDF steps so the collective can be labelled without re-deriving it. A meta element carries the header meta attached by inv_inc_tree_extend (survey years, period, area, point count, Berechnungs-/Ergänzungsmethode), or NULL for a single-inventory source.

See Also

Other increment: harmonize_inv_for_repsurv(), increment_base_table_main_stand(), increment_ytables_base_table(), inv_inc_big_overview(), inv_inc_big_overview_2nd_only(), inv_inc_big_overview_matches_only(), inv_inc_fill_gaps_gnfi3(), inv_inc_summaric(), inv_inc_tree_2_plot(), inv_inc_tree_consolidate(), inv_inc_tree_extend(), inv_inc_tree_extend_combined(), inv_increment_gnfi3(), inv_increment_repeated_survey(), inv_increment_repsurv_ccirc(), inv_increment_ytables(), is_fe_increment_repsurv(), match_2_inventories(), match_2_inventories_by_center_coord(), match_2_inventories_by_plot_id(), match_plot_statistics(), match_trees_on_inventory_repsurv_ccirc(), match_trees_on_plot_repsurv_ccirc(), output_increment_base_table(), output_increment_base_table_pdf(), output_increment_overall(), output_increment_overall_pdf(), output_increment_overview_gnfi3(), output_increment_overview_gnfi3_pdf(), output_increment_overview_ytables_pdf(), reclassify_pseudo_ingrowth_ccirc(), tree_inc_repsurv()

Examples

  inv_b <- data_ex3_sample_fe_inventory

  # Prepare a single inventory's tree data (warnings/messages are ok here)
  inv_b_trees <- data_ex3_sample_trees_essentials

  # Single-inventory increment, then the inventory base table
  inc <- inv_increment_gnfi3(inv_b, inv_b_trees)
  bt  <- increment_base_table(inc, by_class = "age")
  bt$detail
  bt$all_total


Inventory-Level Main-Stand Increment Base Table With Virtual Species Areas

Description

Main-stand counterpart of increment_base_table: it restricts the aggregation to the main stand (layer_key == 1, standing trees) and expresses the per-hectare increment relative to the cohort's virtual monospecific area rather than to one hectare of total forest. This mirrors the static base_table_age_class_main_stand / base_table_d_q_class_main_stand family. As there, species areas are only formed for the main stand, because area shares of species in mixed multi-layer stands are methodologically dubious (the same stance the Third German National Forest Inventory took).

Usage

increment_base_table_main_stand(tree_inc_extd, by_class = c("age", "dq"))

Arguments

tree_inc_extd

Either an increment bundle – the output of inv_increment_repeated_survey or of inv_increment_gnfi3, which is the usual case, its per-tree frame being taken from it – or a bare per-tree increment data frame.

by_class

Either "age" (default) or "dq", passed to inv_inc_tree_2_plot.

Details

The virtual areas are built exactly as on the static side: a per-plot correction factor normalises the plot's main-stand standing area to one hectare, and each cohort receives its standing-area share of the plot's representation area. Unlike the static side, the main stand here includes trees removed between the two inventories: their increment counts, and their (inv-1) standing area counts towards the ideal species area, so numerator and denominator span the same collective.

Because every tree that contributes increment also carries a positive standing area (removed trees at inv-1, surviving/ingrowth trees at inv-2), every group that appears has a positive ideal area – so the “species extinct but residual increment” edge case (division by a zero area) cannot arise. It also keeps strong species-share shifts (e.g. after a storm) from producing implausibly large per-ideal-hectare increments, because the removed area enters the denominator as well.

Value

A list of four tibbles (detail, total, all_species, all_total) like increment_base_table (with iv_m3_ha_yr and its CI over the whole operation area), additionally holding area_ha (the ideal monospecific species area) and iv_m3_ha_yr_virt (the increment per that ideal area, without a CI). Unlike the static main-stand base tables it deliberately carries no per-species area-share column (per_species): in the increment context the ideal area is that of a period collective (including removed trees), so a percentage share would be more misleading than informative. Like increment_base_table, the list also carries a collective element (here fixed to the "main_stand" collective, “Hauptbestand”) and a meta element with the header meta attached by inv_inc_tree_extend (NULL for a single-inventory source).

See Also

Other increment: harmonize_inv_for_repsurv(), increment_base_table(), increment_ytables_base_table(), inv_inc_big_overview(), inv_inc_big_overview_2nd_only(), inv_inc_big_overview_matches_only(), inv_inc_fill_gaps_gnfi3(), inv_inc_summaric(), inv_inc_tree_2_plot(), inv_inc_tree_consolidate(), inv_inc_tree_extend(), inv_inc_tree_extend_combined(), inv_increment_gnfi3(), inv_increment_repeated_survey(), inv_increment_repsurv_ccirc(), inv_increment_ytables(), is_fe_increment_repsurv(), match_2_inventories(), match_2_inventories_by_center_coord(), match_2_inventories_by_plot_id(), match_plot_statistics(), match_trees_on_inventory_repsurv_ccirc(), match_trees_on_plot_repsurv_ccirc(), output_increment_base_table(), output_increment_base_table_pdf(), output_increment_overall(), output_increment_overall_pdf(), output_increment_overview_gnfi3(), output_increment_overview_gnfi3_pdf(), output_increment_overview_ytables_pdf(), reclassify_pseudo_ingrowth_ccirc(), tree_inc_repsurv()

Examples

  inv_b <- data_ex3_sample_fe_inventory
  inv_b_trees <- data_ex3_sample_trees_essentials

  inc <- inv_increment_gnfi3(inv_b, inv_b_trees)
  bt  <- increment_base_table_main_stand(inc, by_class = "age")
  bt$detail
  bt$total


Main-Stand Yield-Table Increment Base Table by Species Group and Age or Diameter Class

Description

Yield-table (“Ertragstafel”) counterpart of increment_base_table_main_stand. It breaks the yield-table increment estimate down by species group and age or quadratic-mean-diameter class, for the main stand only, and returns the same four-element layout as the other increment base tables so it flows through output_increment_base_table and output_increment_base_table_pdf unchanged.

Usage

increment_ytables_base_table(
  inv_dat,
  ytable_selection,
  by_class = c("age", "dq"),
  plot_area_weight = TRUE,
  fe_inv = NULL
)

Arguments

inv_dat

Normally the result of inv_increment_ytables – the estimate is then taken from it and nothing is computed twice, which matters because determining the site index is the most expensive step of the increment side. Alternatively a tree data frame as pulled from an fe_inventory object after height completion (height_complete_inventory) and trees_add_essentials, in which case ytable_selection is required and the estimate is made here.

ytable_selection

A data frame assigning yield-table names to species, e.g. ytables_bavrn_state_var_1_feneu. Must cover all main-stand species in the data (see inv_increment_ytables). Not needed when inv_dat is an fe_increment_ytables bundle.

by_class

Either "age" (default) or "dq". Selects how the result is grouped, not what is estimated: a cohort has one age and one quadratic mean diameter, so both are labels on the same estimate and the two axes reach the same inventory total.

plot_area_weight

Logical; if TRUE (default) plots are weighted by their represented area, otherwise equally. Ignored when inv_dat is a bundle, which was built with its own setting.

fe_inv

Optional fe_inventory object. If supplied, the operation-wide per-ha increment (iv_m3_ha_yr) relates to the full operation area and the header meta (year, area, point count) is filled; otherwise the stocked main-stand ideal area is used as the reference. Taken from the bundle when one is supplied.

Details

Yield tables are age-indexed and their increment is expressed per hectare of a (virtual) monospecific stand, so this table exists only for the main stand and always relates to ideal species areas – there is no “all layers” variant. Each species-group cohort on a plot receives its yield-table increment (see inv_increment_ytables), which is then aggregated to the inventory level. For by_class = "dq" the cohorts are grouped by their quadratic mean diameter class (one per plot x species group, as in back_table_dclass); the underlying per-cohort increment is still the age-indexed yield-table value.

The confidence-interval columns are absent by design: only the repeated- inventory method carries an empirical CI.

Value

A list of four tibbles (detail, total, all_species, all_total) plus a collective element (fixed to “Hauptbestand”), a meta element (marking the source as "ytable" so the PDF is titled “Ertragstafelschätzung”), and a ytables_used element (the yield tables actually used, carried through so the PDF can list them). Each table carries n_plot_class, iv_m3_yr_total, iv_m3_ha_yr (over the operation area), area_ha (ideal species area), and iv_m3_ha_yr_virt (increment per ideal area). The per-species levels (detail, total) additionally carry site_index (mean Ertragsklasse); it is omitted from the cross-species all_species / all_total block, where averaging a site index would be meaningless.

See Also

Other increment: harmonize_inv_for_repsurv(), increment_base_table(), increment_base_table_main_stand(), inv_inc_big_overview(), inv_inc_big_overview_2nd_only(), inv_inc_big_overview_matches_only(), inv_inc_fill_gaps_gnfi3(), inv_inc_summaric(), inv_inc_tree_2_plot(), inv_inc_tree_consolidate(), inv_inc_tree_extend(), inv_inc_tree_extend_combined(), inv_increment_gnfi3(), inv_increment_repeated_survey(), inv_increment_repsurv_ccirc(), inv_increment_ytables(), is_fe_increment_repsurv(), match_2_inventories(), match_2_inventories_by_center_coord(), match_2_inventories_by_plot_id(), match_plot_statistics(), match_trees_on_inventory_repsurv_ccirc(), match_trees_on_plot_repsurv_ccirc(), output_increment_base_table(), output_increment_base_table_pdf(), output_increment_overall(), output_increment_overall_pdf(), output_increment_overview_gnfi3(), output_increment_overview_gnfi3_pdf(), output_increment_overview_ytables_pdf(), reclassify_pseudo_ingrowth_ccirc(), tree_inc_repsurv()

Examples

  inc <- inv_increment_ytables(
    data_ex3_sample_fe_inventory, data_ex3_sample_trees_essentials,
    ytables_bavrn_state_var_1_feneu
  )

  # Both axes rest on the same estimate
  increment_ytables_base_table(inc, by_class = "age")$all_total
  increment_ytables_base_table(inc, by_class = "dq")$all_total


Inventory-Wide Increment Overview for a Repeated Survey, Combining Matched and Second-Only Plots

Description

Top-level wrapper that runs both inv_inc_big_overview_matches_only (for the plots that appear in both surveys) and inv_inc_big_overview_2nd_only (for the plots that only appear in the second survey, with a short-window backward gnfi3 estimate) and combines their results into one whole-enterprise view. Designed as the data source for user-facing summary tables of the whole forest enterprise.

Usage

inv_inc_big_overview(
  tree_inc_rep_gapfill,
  inv_1st_trees,
  inv_2nd_trees,
  inv_2nd,
  style = c("generic", "baysf"),
  inc_summaric,
  dt_2nd_only = -5
)

Arguments

tree_inc_rep_gapfill

Output of inv_inc_fill_gaps_gnfi3.

inv_1st_trees, inv_2nd_trees

Tree data frames as in inv_inc_big_overview_matches_only.

inv_2nd

fe_inventory object of the second survey.

style

Passed through to inv_inc_big_overview_matches_only.

inc_summaric

Output of inv_inc_summaric, passed through to inv_inc_big_overview_matches_only.

dt_2nd_only

Estimation period in years for the second-only backward gnfi3 projection (negative for backward). Default -5. Passed through to inv_inc_big_overview_2nd_only.

Details

Output layout (the central design decision): three sub-overview slots that all keep the same internal shape ($overall + $by_species_group), plus the inv_period and method info passed through so downstream renderers can label survey years and the increment method without re-deriving them.

matches_only

Verbatim output of inv_inc_big_overview_matches_only.

second_only

Verbatim output of inv_inc_big_overview_2nd_only.

combined

Per-row addition of matches_only and second_only. One row per matched fill_option (combined_standard, combined_min_estimates, combined_all_estimates, combined_inc_summaric), each summing the matched fill_option result with the single gnfi3_backward second_only contribution. iv_m3_yr_total and area_total_ha are additive; iv_m3_ha_yr is the resulting ratio. Sum-consistency: each combined row's totals equal the corresponding matches_only row plus the second_only row.

inv_period

The same inv_period list element that is already carried by inv_increment_repsurv_ccirc and inv_inc_fill_gaps_gnfi3, with the two survey years and the period length.

method

The increment method used in the upstream inv_increment_repsurv_ccirc call (one of "rep_classic", "rep_mean", "rep_end", "rep_trans"); carried through so user-facing renderers can label the table accordingly.

CI95 in $combined: the ci95_* columns are kept for structural compatibility but are NA throughout. The second_only contribution carries no empirical CI by contract (see inv_inc_big_overview_2nd_only); an area-weighted pooling of variances with one variance unknown would require assumptions that we are not willing to make here. Users who need a CI on the combined value can fall back to the matches_only CI as a lower bound, and document the choice.

iv_by_groups in $combined is deliberately omitted. The matched side breaks down by id_able_tree × tree_status (categories that the second_only side does not share), so a mixed breakdown would have a heterogeneous schema. Users that need that detail should look at $matches_only$overall$iv_by_groups separately.

Value

A list with the three top-level slots described above.

See Also

Other increment: harmonize_inv_for_repsurv(), increment_base_table(), increment_base_table_main_stand(), increment_ytables_base_table(), inv_inc_big_overview_2nd_only(), inv_inc_big_overview_matches_only(), inv_inc_fill_gaps_gnfi3(), inv_inc_summaric(), inv_inc_tree_2_plot(), inv_inc_tree_consolidate(), inv_inc_tree_extend(), inv_inc_tree_extend_combined(), inv_increment_gnfi3(), inv_increment_repeated_survey(), inv_increment_repsurv_ccirc(), inv_increment_ytables(), is_fe_increment_repsurv(), match_2_inventories(), match_2_inventories_by_center_coord(), match_2_inventories_by_plot_id(), match_plot_statistics(), match_trees_on_inventory_repsurv_ccirc(), match_trees_on_plot_repsurv_ccirc(), output_increment_base_table(), output_increment_base_table_pdf(), output_increment_overall(), output_increment_overall_pdf(), output_increment_overview_gnfi3(), output_increment_overview_gnfi3_pdf(), output_increment_overview_ytables_pdf(), reclassify_pseudo_ingrowth_ccirc(), tree_inc_repsurv()

Examples

  inv_a <- data_ex3_previous_sample_fe_inventory
  inv_b <- data_ex3_sample_fe_inventory

  suppressWarnings(suppressMessages({
    inv_a_trees <- data_ex3_previous_sample_trees_essentials
    inv_b_trees <- data_ex3_sample_trees_essentials

    # Matching and gap filling are shipped ready-made for this pair
    inc_rep <- data_ex3_increment_matched
    inc_fl  <- data_ex3_increment_fills
    inc_sum <- inv_inc_summaric(
      inc_rep$tree_increments, inc_fl$fills_forward,
      inv_a_trees, inv_b_trees
    )
  }))

  bo <- inv_inc_big_overview(
    inc_fl, inv_a_trees, inv_b_trees, inv_b,
    style = "generic", inc_summaric = inc_sum
  )
  bo$combined$overall$iv_total


Inventory-Wide Increment Overview for Plots Only Present in the Second Inventory

Description

Counterpart to inv_inc_big_overview_matches_only for those plots that only appear in the second survey (typical case: sample extensions and newly established plots between two inventories). Their increment cannot be observed directly; it is estimated per tree by applying the third-German-NFI growth functions backwards over a short period (dt, default 5 years) and aggregating across plots with the same area-weighted machinery as in inv_inc_big_overview_matches_only.

Usage

inv_inc_big_overview_2nd_only(inc_repinv_fl, inv_2nd_trees, inv_2nd, dt = -5)

Arguments

inc_repinv_fl

Output of inv_inc_fill_gaps_gnfi3. Used for the inv_period and plot_matches elements only; the per-tree increment data frames inside are not consumed here.

inv_2nd_trees

Tree data frame from the second inventory, as produced by pull_trees() |> height_complete_inventory() |> trees_add_essentials().

inv_2nd

The corresponding fe_inventory object.

dt

Estimation period for the backward gnfi3 projection, in years, passed through to tree_inc_gnfi_2012. Default -5 — see the function description for the rationale. The sign matters: negative values mean backward projection (the only direction that makes sense here), positive values would project the trees into the future and are flagged via a warning. Magnitudes other than 5 are accepted but should be motivated explicitly.

Details

Why a short period and not the full inter-survey distance: on plots without a previous observation we do not know the mortality and removal history. A backward projection over ~10 years would attribute much of the standing volume to "still living" trees and miss the unknown fraction that would actually have died or been harvested in that span. Over a shorter window (~5 years) that bias stays small and the resulting per-year growth rate is a defensible estimate for the representative area of the second-only plots.

The output structure mirrors inv_inc_big_overview_matches_only so that the two can later be combined into one whole-enterprise table by the caller. There is, however, no fill_option dimension here: only one estimator is in play (backward gnfi3 over dt years). A single label "gnfi3_backward" is used in the fill_option column so that a row bind with the matched-plots output stays unambiguous.

Current scope and limitations (v1):

Value

A list with the same top-level structure as inv_inc_big_overview_matches_only: $overall (containing iv_by_groups, iv_total, v_total, n_plots) and $by_species_group (containing iv_by_groups, iv_total, v_total). All m3/ha values relate to the total area across all second-only plots, even when grouped by species; plots without trees of a given species_group contribute their area but a zero numerator, so sums of per-species values match the corresponding overall values.

If there are no second-only plots, an empty-shaped list is returned with zero rows in the tables and area_total_ha = 0 in n_plots; this lets downstream combination code merge the two overviews without special-casing.

See Also

Other increment: harmonize_inv_for_repsurv(), increment_base_table(), increment_base_table_main_stand(), increment_ytables_base_table(), inv_inc_big_overview(), inv_inc_big_overview_matches_only(), inv_inc_fill_gaps_gnfi3(), inv_inc_summaric(), inv_inc_tree_2_plot(), inv_inc_tree_consolidate(), inv_inc_tree_extend(), inv_inc_tree_extend_combined(), inv_increment_gnfi3(), inv_increment_repeated_survey(), inv_increment_repsurv_ccirc(), inv_increment_ytables(), is_fe_increment_repsurv(), match_2_inventories(), match_2_inventories_by_center_coord(), match_2_inventories_by_plot_id(), match_plot_statistics(), match_trees_on_inventory_repsurv_ccirc(), match_trees_on_plot_repsurv_ccirc(), output_increment_base_table(), output_increment_base_table_pdf(), output_increment_overall(), output_increment_overall_pdf(), output_increment_overview_gnfi3(), output_increment_overview_gnfi3_pdf(), output_increment_overview_ytables_pdf(), reclassify_pseudo_ingrowth_ccirc(), tree_inc_repsurv()

Examples

  inv_a <- data_ex3_previous_sample_fe_inventory
  inv_b <- data_ex3_sample_fe_inventory

  inv_a_trees <- data_ex3_previous_sample_trees_essentials
  inv_b_trees <- data_ex3_sample_trees_essentials

  suppressWarnings(suppressMessages({
    # Matching and gap filling are shipped ready-made for this pair
    inc_rep <- data_ex3_increment_matched
    inc_fl  <- data_ex3_increment_fills
  }))

  bo_2nd <- inv_inc_big_overview_2nd_only(inc_fl, inv_b_trees, inv_b)
  bo_2nd$overall$iv_total
  bo_2nd$by_species_group$iv_total


Inventory-Wide Increment Overview for the Matched Plots of a Repeated Survey

Description

Produces the area-weighted increment overview from those plots that appear in both inventories — i.e. the subset for which repeated tree-level measurements are available. The companion function inv_inc_big_overview_2nd_only covers the plots that only exist in the second survey (new establishments, sample extensions); the top-level inv_inc_big_overview_matches_only combines both.

Usage

inv_inc_big_overview_matches_only(
  tree_inc_rep_gapfill,
  inv_1st_trees,
  inv_2nd_trees,
  inv_2nd,
  style = c("generic", "baysf"),
  inc_summaric
)

Arguments

tree_inc_rep_gapfill

Output object of inv_inc_fill_gaps_gnfi3

inv_1st_trees

Tree data frame as pulled and extended from the the fe_inventory object that represents the first of two subsequent surveys. Should be the same as previously used as input for inv_increment_repsurv_ccirc.

inv_2nd_trees

Tree data frame as pulled and extended from the the fe_inventory object that represents the second of two subsequent surveys. Should be the same as previously used as input for inv_increment_repsurv_ccirc.

inv_2nd

fe_inventory object that represents the second of the two inventories of interest.

style

Two options "generic" and "baysf". The former groups the most important part of the output by the tree cohorts that are internally distinguished when calculating/estimating increments. The latter applies a similar grouping as common in the Bavarian State Forest. The two styles differ only in the tree_status categories used in the iv_by_groups breakdown:

"baysf"

"living", "missing", "rem_mort", "no_coord" (table-63-like, kept stable).

"generic"

"regular", "ingrown", "missing", "rem_mort_regular", "rem_mort_ingrown", "no_track", plus "pseudo_ingrown" for trees that reclassify_pseudo_ingrowth_ccirc reclassified from ingrowth to re-measured (inner-circle Inv-1 cohort). They carry a regular increment but are split out here so the pseudo-ingrowth contribution is visible in the aggregate. Only the "generic" style breaks this cohort out; under "baysf" they remain part of "living".

inc_summaric

Output of inv_inc_summaric, i.e. a list with the elements $overall (per-plot summaric increment) and $by_species_group (per plot × species group). Its area-weighted mean is appended as an additional row "inc_summaric" in the iv_total elements of both $overall and $by_species_group (one row per species group there). The summaric increment is the most reliable overall increment estimate available from a repeated survey, as it relies purely on volume balances. The tree-level methods exist because they enable breakdowns by layers, diameter class, etc., which a pure balance can also provide once it is partitioned (here: by species group).

Value

A list with three top-level elements:

overall

A sub-list with

iv_by_groups

Increments aggregated by fill_option, tree identification status, and tree status category

iv_total

Total increments per fill_option, plus an additional row "inc_summaric" with the summaric (yield-history) increment as the most reliable reference value

v_total

Total standing volume at the second inventory

n_plots

Number of plots and total represented area

by_species_group

A sub-list with the same structure as overall (minus n_plots, which would be redundant), but every tibble is additionally grouped by species_group. The total area (area_total_ha) stays at the area across all plots, so that plots without trees of a given species group still contribute their area to the denominator. Consequently, sums of per-species values (iv_m3_yr_total, iv_m3_ha_yr, v_hub_m3_ha) across species groups match the corresponding overall values, and the same applies row by row to the appended "inc_summaric" entries.

method

The increment method used in the upstream inv_increment_repsurv_ccirc call (carried through inv_inc_fill_gaps_gnfi3).

See Also

Other increment: harmonize_inv_for_repsurv(), increment_base_table(), increment_base_table_main_stand(), increment_ytables_base_table(), inv_inc_big_overview(), inv_inc_big_overview_2nd_only(), inv_inc_fill_gaps_gnfi3(), inv_inc_summaric(), inv_inc_tree_2_plot(), inv_inc_tree_consolidate(), inv_inc_tree_extend(), inv_inc_tree_extend_combined(), inv_increment_gnfi3(), inv_increment_repeated_survey(), inv_increment_repsurv_ccirc(), inv_increment_ytables(), is_fe_increment_repsurv(), match_2_inventories(), match_2_inventories_by_center_coord(), match_2_inventories_by_plot_id(), match_plot_statistics(), match_trees_on_inventory_repsurv_ccirc(), match_trees_on_plot_repsurv_ccirc(), output_increment_base_table(), output_increment_base_table_pdf(), output_increment_overall(), output_increment_overall_pdf(), output_increment_overview_gnfi3(), output_increment_overview_gnfi3_pdf(), output_increment_overview_ytables_pdf(), reclassify_pseudo_ingrowth_ccirc(), tree_inc_repsurv()

Examples

  # Identify two subsequent inventories
  inv_a <- data_ex3_previous_sample_fe_inventory
  inv_b <- data_ex3_sample_fe_inventory

  inv_a_trees <- data_ex3_previous_sample_trees_essentials
  inv_b_trees <- data_ex3_sample_trees_essentials

  # Matching and gap filling for this pair are shipped ready-made, see
  # ?data_ex3_increment_interim for how they were built
  inc_repinv    <- data_ex3_increment_matched
  inc_repinv_fl <- data_ex3_increment_fills

  # Compute the summaric increment per plot (required for big_overview).
  # Note: summaric reads matched_trees and fills_forward directly — it
  # does NOT go through the consolidate / extend per-tree pipeline,
  # so its balance always sees the full measured population.
  inc_sum <- inv_inc_summaric(
    inc_repinv$tree_increments, inc_repinv_fl$fills_forward,
    inv_a_trees, inv_b_trees
  )

  # Finally generate the matched-plots overview, use both styles
  inv_inc_big_overview_matches_only(
    inc_repinv_fl, inv_a_trees, inv_b_trees, inv_b,
    style = "generic", inc_summaric = inc_sum
  )
  inv_inc_big_overview_matches_only(
    inc_repinv_fl, inv_a_trees, inv_b_trees, inv_b,
    style = "baysf", inc_summaric = inc_sum
  )


Backward-Estimate Increments for Implausible Re-Measured Trees

Description

Called from within inv_inc_fill_gaps_gnfi3. Handles trees that were present in both inventories but flagged as implausible during tree matching (due to excessive volume shrinkage or species mismatch). These trees received a zero increment from the repeated measurement and need a model-based backward estimate. The second inventory's values are taken as ground truth and the increment is estimated backwards for the whole inventory period. The single tree increments are upscaled to an area of 1 ha.

Usage

inv_inc_fill_backward_implausible(tree_inc_rep, inv_2nd_trees)

Arguments

tree_inc_rep

See entry at inv_inc_fill_gaps_gnfi3

inv_2nd_trees

See entry at inv_inc_fill_gaps_gnfi3

Value

The data frame tree_inc_rep$tree_increments filtered for implausible re-measured trees. It contains the two additional columns iv_hub_m3_ha_per_gnfi3, and iv_hub_m3_ha_yr_gnfi3 which represent the periodic and the mean annual backward estimates of their volume increment.


Backward-Estimate Increments for Trees That Were Measured in Both Inventories (Optional)

Description

Called from within inv_inc_fill_gaps_gnfi3. Covered are all trees that were present and matching in both inventories as long as they have no removal flag for the second inventory. In principle, there are no increment gaps to fill for these trees. However, it might be useful to compare estimates and real increments under certain circumstances. Note that the tree level increments are upscaled to an area of 1 ha. Hereby, we use the real representation numbers of each tree at the first and the second survey, i.e. we do not check whether the growth estimate crossed a representation threshold. Negative increments are possible and not wrong.

Usage

inv_inc_fill_backward_reptrees(tree_inc_rep, inv_2nd_trees, include_reptrees)

Arguments

tree_inc_rep

See entry at inv_inc_fill_gaps_gnfi3

inv_2nd_trees

See entry at inv_inc_fill_gaps_gnfi3

include_reptrees

If TRUE, backward increment estimates are also made for trees that are present in both inventories and therefore have "real" increments. If FALSE, the columns for backward estimates will be set to NA. This might save computation time when dealing with extensive amounts of data.

Value

A data frame with the same structure as the output of the other fill-gap functions. However only if the parameter include_reptrees is set on TRUE, the backwards estimates will actually be calculated (which can take considerable time). Otherwise, the columns reserved for the estimates will be filled with NA values.


Backward-Estimate Increments for Trees that were Present in the Second of Two Subsequent Inventories

Description

Called from within inv_inc_fill_gaps_gnfi3. Takes into account only trees that have coordinates, but were only present in the second inventory. A backward estimate of the volume increment is done for the whole inventory period. The idea behind this approach: When crossing the diameter threshold of their circle between both inventories, these trees became eligible for survey, but they were actually growing for the whole inventory period. The single tree increments are upscaled to an area of 1 ha.

Usage

inv_inc_fill_gaps_backward(tree_inc_rep, inv_2nd_trees)

Arguments

tree_inc_rep

See entry at inv_inc_fill_gaps_gnfi3

inv_2nd_trees

See entry at inv_inc_fill_gaps_gnfi3

Value

The data frame tree_inc_rep$tree_increments filtered for trees that are only existing in the second inventory. It contains the two additional columns iv_hub_m3_ha_per_gnfi3, and iv_hub_m3_ha_yr_gnfi3 which represent the periodic and the mean annualbackward estimates of their volume increment.


Backward-Estimate Increments for Trees That Cannot Be Matched Across Inventories

Description

Called from within inv_inc_fill_gaps_gnfi3. Takes into account only trees from the second inventory that cannot be matched across inventories due to the implemented survey system. Typically, such trees are below a certain dbh threshold and therefore not surveyed in a way that would make them uniquely identifyable. These trees obtain a backward estimate of their volume increment. The single tree increments are upscaled to an area of 1 ha.

Usage

inv_inc_fill_gaps_backward_nomatch(tree_inc_rep, inv_2nd_trees)

Arguments

tree_inc_rep

See entry at inv_inc_fill_gaps_gnfi3

inv_2nd_trees

See entry at inv_inc_fill_gaps_gnfi3

Value

A data frame with the same structure as tree_inc_rep$tree_increments, however containg only trees that are not present in this data frame but present in the second inventory. These are trees that cannot be matched in subsequent inventories due to the survey system implemented. Therefore, increments from repeated inventories are not available for these trees. Consequently, the columns iv_hub_m3_ha_per_rep and iv_hub_m3_ha_yr_rep contain NA only. However, The columns iv_hub_m3_ha_per_gnfi3 and iv_hub_m3_ha_yr_gnfi3 contain backwards estimates of their volume increment.


Forward-Estimate Increments for Trees that were Present in the First of Two Subsequent Inventories

Description

Called from within inv_inc_fill_gaps_gnfi3. Takes into account only trees that have coordinates, but were only present in the first inventory, or present in the second inventory but with a removal flag. A forward estimate of the volume increment is done for half the inventory period, as such trees are assumed to have died or have been harvested at the middle of the period. The mean annual increment relates to the full inventory period as it has to represent the trees' contribution to the mean annual increment on the stand level. The single tree increments are upscaled to an area of 1 ha.

Usage

inv_inc_fill_gaps_forward(tree_inc_rep, inv_1st_trees)

Arguments

tree_inc_rep

See entry at inv_inc_fill_gaps_gnfi3

inv_1st_trees

See entry at inv_inc_fill_gaps_gnfi3

Value

The data frame tree_inc_rep$tree_increments filtered for trees that are only existing in the first inventory. It contains the two additional columns iv_hub_m3_ha_per_gnfi3, and iv_hub_m3_ha_yr_gnfi3 which represent the periodic and the mean annual forward estimates of their volume increment.


Close Tree Increment Gaps with Estimates from National Forest Inventory Functions

Description

When calculating tree level increments from two subsequent inventories, there are typically trees that were present in one of the inventories only. For different types of such trees, we apply here the single tree growth functions from the third German National Forest Inventory (Riedel et al. 2017) as implemented in the Package ForestElementsR, namely the functions d_age_gnfi3 and h_age_gnfi3.

Usage

inv_inc_fill_gaps_gnfi3(
  tree_inc_rep,
  inv_1st_trees,
  inv_2nd_trees,
  include_reptrees = TRUE
)

Arguments

tree_inc_rep

Output of inv_increment_repsurv_ccirc

inv_1st_trees

Extended tree data frame for the first inventory, exactly as it was used as an input to inv_increment_repsurv_ccirc in order to generate tree_inc_rep.

inv_2nd_trees

Extended tree data frame for the second inventory, exactly as it was used as an input to inv_increment_repsurv_ccirc in order to generate tree_inc_rep.

include_reptrees

If TRUE (default), backward increment estimates are also made for trees that are present in both inventories and therefore have "real" increments. If FALSE the columns for backward estimates will be set to NA. This might save computation time when dealing with extensive amounts of data.

Details

The increment estimates performed here are only applied to inventory plots that match in both inventories. This is guaranteed by requiring tree_inc_rep as input object. This is the output of inv_increment_repsurv_ccirc which ensures plot matching.

Value

A list comprising five data frames that have exactly the same structure, i.e. the same columns as tree_inc_rep$tree_increments, however with two additional columns,iv_hub_m3_per_gnfi3, and iv_hub_m3_yr_gnfi3). The data frame fills_forward relates to trees that were present in the first, but missing in the second inventory. Their increment is projected forward up to the mid of the period between both inventories. The second data frame fills_backward comprises trees that were present in the second, but not present in the first inventory. Their increment is estimated backwards for the whole period. The third data frame fills_backward_nomatch comprises trees present in the second inventory, which were, however, not recorded in a way that makes them identifyable in the first inventory (typically, such trees are under a certain dbh threshold). For such trees backward increment estimates are made for the whole period. The fourth data frame fills_backward_implausible comprises trees that were present in both inventories but flagged as implausible during tree matching (due to excessive volume shrinkage or species mismatch). These trees received a zero increment from the repeated measurement; their increment is estimated backwards from the second inventory's values for the whole period. The fifth data frame fills_backward_reptrees relates to plausible trees that were present in both inventories. While directly calculated increments are available for these trees, backward estimates are calculated if (include_reptrees) is TRUE. This might only be required under special circumstances, therefore, the default setting is FALSE for saving time. In the latter case, the columns reserved for the increment estimates are set to NA. In addition the list contains the elements inv_period (carried through from inv_increment_repsurv_ccirc), plot_matches (the plot match overview, also from inv_increment_repsurv_ccirc; downstream consumers such as inv_inc_big_overview_2nd_only use the in_b_only entry there to identify plots that only appear in the second inventory), and method (the increment method used in the upstream inv_increment_repsurv_ccirc call – one of "rep_classic", "rep_mean", "rep_end", "rep_trans").

References

Riedel T, Hennig P, Kroiher F, Polley H, Schmitz F, F. S (2017). Die dritte Bundeswaldinventur (BWI 2012). Inventur- und Auswertungsmethoden. Thuenen Institut fuer Waldoekosysteme.

See Also

Other increment: harmonize_inv_for_repsurv(), increment_base_table(), increment_base_table_main_stand(), increment_ytables_base_table(), inv_inc_big_overview(), inv_inc_big_overview_2nd_only(), inv_inc_big_overview_matches_only(), inv_inc_summaric(), inv_inc_tree_2_plot(), inv_inc_tree_consolidate(), inv_inc_tree_extend(), inv_inc_tree_extend_combined(), inv_increment_gnfi3(), inv_increment_repeated_survey(), inv_increment_repsurv_ccirc(), inv_increment_ytables(), is_fe_increment_repsurv(), match_2_inventories(), match_2_inventories_by_center_coord(), match_2_inventories_by_plot_id(), match_plot_statistics(), match_trees_on_inventory_repsurv_ccirc(), match_trees_on_plot_repsurv_ccirc(), output_increment_base_table(), output_increment_base_table_pdf(), output_increment_overall(), output_increment_overall_pdf(), output_increment_overview_gnfi3(), output_increment_overview_gnfi3_pdf(), output_increment_overview_ytables_pdf(), reclassify_pseudo_ingrowth_ccirc(), tree_inc_repsurv()

Examples


  # Identify two subsequent inventories
  inv_a <- data_ex3_previous_sample_fe_inventory
  inv_b <- data_ex3_sample_fe_inventory

  inv_a_trees <- data_ex3_previous_sample_trees_essentials
  inv_b_trees <- data_ex3_sample_trees_essentials

  # The matching this builds on is shipped ready-made for the pair, see
  # ?data_ex3_increment_interim
  inc_repinv <- data_ex3_increment_matched

  # Finally, fill the gaps. include_reptrees = FALSE estimates only where
  # there is a gap; the default TRUE also estimates for trees measured
  # twice, which is what fill_option = "all_estimates" later feeds on.
  inv_inc_fill_gaps_gnfi3(
    inc_repinv, inv_a_trees, inv_b_trees, include_reptrees = TRUE
  )


Compute the Summaric Increment per Plot, Overall and by Species Group

Description

Computes a pure balance increment per plot that does not require any tree matching assumptions. The formula is: inc_summaric = (V_end - V_start + V_removed) / period, where V_end is the total standing volume at the second inventory (excluding removed trees), V_start is the total standing volume at the first inventory, and V_removed is the forward-estimated volume of trees that were removed between inventories. The forward estimation relies on gnfi3-based estimates from the "standard" fill option, which is why the input must come from inv_inc_tree_consolidate with fill_option = "standard", extended by inv_inc_tree_extend.

Usage

inv_inc_summaric(matched_trees, fills_forward, inv_1st_trees, inv_2nd_trees)

Arguments

matched_trees

Data frame, the $tree_increments element of inv_increment_repsurv_ccirc's output. Carries all rows needed by the summaric balance — including the unmatchable inner- circle cohort (is_unmatchable_1st = TRUE / NA on the counterpart side of tree_exists_*).

fills_forward

Data frame, the $fills_forward element of inv_inc_fill_gaps_gnfi3's output. Provides the half-period gnfi3 forward increment estimate (iv_hub_m3_ha_per_gnfi3) for the v_aus term. summaric joins the relevant value back to matched_trees by (plot_id_1st, tree_id_1st).

inv_1st_trees

Tree data frame as pulled and extended from the first fe_inventory object. Used for the species-group lookup of trees that exist only in the first inventory (removed trees).

inv_2nd_trees

Tree data frame for the second inventory. Used for the species-group lookup of trees that exist in the second inventory (the dominant case — both-exist trees, ingrowth, and unmatchable inv-2).

Details

The classical German forestry term for this quantity is "ertragsgeschichtlicher Zuwachs" (literally: yield-history increment). There is no established English equivalent; we use the term "summaric increment" here to express that this increment is derived purely from summary-level volume balances between two inventories, without relying on individual tree identity across surveys.

Methodological role. The ertragsgeschichtliche increment is the Goldstandard for the Betriebsebenen-Zuwachs — the best estimate of the enterprise-wide annual increment that two inventories can yield. Unlike the four single-tree methods (rep_classic, rep_mean, rep_end, rep_trans) it is a pure mass balance over the measured tree population; it does not depend on assumptions about which inventory's representation number to use for trees that change circles, and it does not need a per-tree pairing across inventories. For that reason it stands architecturally apart from the per-tree pipeline (inv_inc_tree_consolidate and inv_inc_tree_extend): summaric pulls its inputs (matched_trees, fills_forward, and the inv-trees lookups for species groups) directly, so its balance always sees the full measured population including the unmatchable inner-circle cohort — independent of any fill_option choice on the per-tree side.

Computational structure on each plot:

Pseudo-ingrowth-reclassified trees have their reclassification locally undone inside summaric so that their inv-1 reconstruction (gnfi3 backward) does not enter the balance. They contribute only via their measured inv-2 volume — exactly the methodological treatment we want for the unmatchable inner-circle cohort.

Value

A list with two tibbles:

overall

One row per plot, columns plot_id, v_hub_m3_ha_1st, v_hub_m3_ha_2nd, v_hub_m3_ha_aus, inc_summaric_m3_ha_yr.

by_species_group

One row per (plot, species_group) combination, same volume / increment columns as overall plus species_group. Combinations where a species group is absent on a plot are not represented; consumers that need a complete grid (e.g. for area-weighted aggregation across all plots) must fill in zeros.

See Also

Other increment: harmonize_inv_for_repsurv(), increment_base_table(), increment_base_table_main_stand(), increment_ytables_base_table(), inv_inc_big_overview(), inv_inc_big_overview_2nd_only(), inv_inc_big_overview_matches_only(), inv_inc_fill_gaps_gnfi3(), inv_inc_tree_2_plot(), inv_inc_tree_consolidate(), inv_inc_tree_extend(), inv_inc_tree_extend_combined(), inv_increment_gnfi3(), inv_increment_repeated_survey(), inv_increment_repsurv_ccirc(), inv_increment_ytables(), is_fe_increment_repsurv(), match_2_inventories(), match_2_inventories_by_center_coord(), match_2_inventories_by_plot_id(), match_plot_statistics(), match_trees_on_inventory_repsurv_ccirc(), match_trees_on_plot_repsurv_ccirc(), output_increment_base_table(), output_increment_base_table_pdf(), output_increment_overall(), output_increment_overall_pdf(), output_increment_overview_gnfi3(), output_increment_overview_gnfi3_pdf(), output_increment_overview_ytables_pdf(), reclassify_pseudo_ingrowth_ccirc(), tree_inc_repsurv()

Examples

  # Identify two subsequent inventories
  inv_a <- data_ex3_previous_sample_fe_inventory
  inv_b <- data_ex3_sample_fe_inventory

  # Pull and prepare tree data
  inv_a_trees <- data_ex3_previous_sample_trees_essentials
  inv_b_trees <- data_ex3_sample_trees_essentials

  # Matching and gap filling for this pair are shipped ready-made, see
  # ?data_ex3_increment_interim for how they were built
  inc_repinv    <- data_ex3_increment_matched
  inc_repinv_fl <- data_ex3_increment_fills

  # Summaric goes directly off matched_trees + fills_forward —
  # no consolidate / extend in between.
  inv_inc_summaric(
    inc_repinv$tree_increments,
    inc_repinv_fl$fills_forward,
    inv_a_trees, inv_b_trees
  )


Aggregate Single Tree Increments to ha-Values per Species Group, Age- or Diameter Class and Layer on Plot Level

Description

The ha-related values calculated here are to be understood as the contributions of each tree cohort (as defined by species group, (age- or diameter-) class, and layer) to the whole ha-wise increment of the plot. Importantly, they do not relate to virtual area shares of the cohorts. In an increment evaluation workflow, the intended use of this function is to be applied to the output of inv_inc_tree_extend

Usage

inv_inc_tree_2_plot(tree_inc_extd, by_class = c("age", "dq"))

Arguments

tree_inc_extd

Data frame, output of inv_inc_tree_extend

by_class

Two options "age" (default), and "dq", which will aggregate the increments by age-, and mean diameter classes, respectively.

Value

A data frame with increment sums grouped by plot_id, species_group, d_q_class or age_class, layer_key, removal

See Also

Other increment: harmonize_inv_for_repsurv(), increment_base_table(), increment_base_table_main_stand(), increment_ytables_base_table(), inv_inc_big_overview(), inv_inc_big_overview_2nd_only(), inv_inc_big_overview_matches_only(), inv_inc_fill_gaps_gnfi3(), inv_inc_summaric(), inv_inc_tree_consolidate(), inv_inc_tree_extend(), inv_inc_tree_extend_combined(), inv_increment_gnfi3(), inv_increment_repeated_survey(), inv_increment_repsurv_ccirc(), inv_increment_ytables(), is_fe_increment_repsurv(), match_2_inventories(), match_2_inventories_by_center_coord(), match_2_inventories_by_plot_id(), match_plot_statistics(), match_trees_on_inventory_repsurv_ccirc(), match_trees_on_plot_repsurv_ccirc(), output_increment_base_table(), output_increment_base_table_pdf(), output_increment_overall(), output_increment_overall_pdf(), output_increment_overview_gnfi3(), output_increment_overview_gnfi3_pdf(), output_increment_overview_ytables_pdf(), reclassify_pseudo_ingrowth_ccirc(), tree_inc_repsurv()

Examples

  # Identify two subsequent inventories
  inv_a <- data_ex3_previous_sample_fe_inventory
  inv_b <- data_ex3_sample_fe_inventory

  inv_a_trees <- data_ex3_previous_sample_trees_essentials
  inv_b_trees <- data_ex3_sample_trees_essentials

  # Matching and gap filling for this pair are shipped ready-made, see
  # ?data_ex3_increment_interim for how they were built
  inc_repinv    <- data_ex3_increment_matched
  inc_repinv_fl <- data_ex3_increment_fills

  # Consolidate and extend tree increments
  inc_repinv_ce <- inv_inc_tree_consolidate(inc_repinv_fl) |>
    inv_inc_tree_extend(inv_a_trees, inv_b_trees, inv_b)

  # Finally, aggregate on plot level
  inv_inc_tree_2_plot(inc_repinv_ce, "age")
  inv_inc_tree_2_plot(inc_repinv_ce, "dq")


Consolidating a Mix of Real and Estimated Tree-Level Increments for Further Processing

Description

In an increment evaluation workflow, the intended use of this function is to be applied to the output of inv_inc_fill_gaps_gnfi3. In parallel to the increment values that were directly calculated, the latter has estimated the increment with the tree growth functions from the Third German National Forest Inventory (Riedel et al. 2017) for different cohorts of trees (in different ways, see inv_inc_fill_gaps_gnfi3). Here, the user decides which increments to use for which cohort in subsequent evaluations.

Usage

inv_inc_tree_consolidate(
  tree_inc_rep_gapfill,
  fill_option = c("standard", "min_estimates", "all_estimates")
)

Arguments

tree_inc_rep_gapfill

Output object of inv_inc_fill_gaps_gnfi3

fill_option

Three options, "standard" (default), "min_estimates", and "all_estimates". See Details.

Details

The fill_option "standard" takes the inventory increment for all trees that can be potentially identified across inventories and are present at least in the second survey (i.e. re-measured or ingrown), as long as they do not have a removal flag at the second survey. For such trees that are, however, present in the first survey but are absent or have a removal flag at the second survey, an NFI based forward increment estimate for half the period between the surveys is used. Trees that cannot be identified across inventories and are present in the second survey, obtain a backwards increment estimate for the whole period. The option "min_estimates" uses NFI estimates only for trees that cannot be identified across surveys. Therefore, trees that only exist in the first survey obtain a zero increment. The third option "all_estimates" uses NFI based estimates for all trees.

Value

A data frame with every line representing a tree, actually all output components from inv_inc_fill_gaps_gnfi3 combined into one data frame. Importantly, there are three additional columns: iv_hub_m3_per and iv_hub_m3_yr are the periodic and annual increment values to continue calculating with (coming either from the inventory or from the estimate), and iv_filled is logical; if TRUE, the increment is estimated with the German NFI growth functions. If FALSE the increment is directly calculated from the survey data.

References

Riedel T, Hennig P, Kroiher F, Polley H, Schmitz F, F. S (2017). Die dritte Bundeswaldinventur (BWI 2012). Inventur- und Auswertungsmethoden. Thuenen Institut fuer Waldoekosysteme.

See Also

Other increment: harmonize_inv_for_repsurv(), increment_base_table(), increment_base_table_main_stand(), increment_ytables_base_table(), inv_inc_big_overview(), inv_inc_big_overview_2nd_only(), inv_inc_big_overview_matches_only(), inv_inc_fill_gaps_gnfi3(), inv_inc_summaric(), inv_inc_tree_2_plot(), inv_inc_tree_extend(), inv_inc_tree_extend_combined(), inv_increment_gnfi3(), inv_increment_repeated_survey(), inv_increment_repsurv_ccirc(), inv_increment_ytables(), is_fe_increment_repsurv(), match_2_inventories(), match_2_inventories_by_center_coord(), match_2_inventories_by_plot_id(), match_plot_statistics(), match_trees_on_inventory_repsurv_ccirc(), match_trees_on_plot_repsurv_ccirc(), output_increment_base_table(), output_increment_base_table_pdf(), output_increment_overall(), output_increment_overall_pdf(), output_increment_overview_gnfi3(), output_increment_overview_gnfi3_pdf(), output_increment_overview_ytables_pdf(), reclassify_pseudo_ingrowth_ccirc(), tree_inc_repsurv()

Examples


  # Identify two subsequent inventories
  inv_a <- data_ex3_previous_sample_fe_inventory
  inv_b <- data_ex3_sample_fe_inventory

  inv_a_trees <- data_ex3_previous_sample_trees_essentials
  inv_b_trees <- data_ex3_sample_trees_essentials

  # Matching and gap filling for this pair are shipped ready-made, see
  # ?data_ex3_increment_interim for how they were built
  inc_repinv    <- data_ex3_increment_matched
  inc_repinv_fl <- data_ex3_increment_fills

  # Finally, consolidate the tree increments, try all fill options
  inv_inc_tree_consolidate(inc_repinv_fl, fill_option = "standard")

  inv_inc_tree_consolidate(inc_repinv_fl, fill_option = "min_estimates")

  inv_inc_tree_consolidate(inc_repinv_fl, fill_option = "all_estimates")

  # The option 'all_estimates' must throw an error if the gap filling was
  # not done for the trees which have dbh values in both surveys
  inc_repinv_fl <- inv_inc_fill_gaps_gnfi3(
    inc_repinv, inv_a_trees, inv_b_trees, include_reptrees = FALSE
  )
  try(
    inv_inc_tree_consolidate(inc_repinv_fl, fill_option = "all_estimates")
  )


Extend Tree-Level Increments With Detailed Tree Information, Especially Age and Mean Diameter Classes for Further Aggregation

Description

In an increment evaluation workflow, the intended use of this function is to be applied to the output of inv_inc_tree_consolidate

Usage

inv_inc_tree_extend(
  tree_inc_cons,
  inv_1st_trees,
  inv_2nd_trees,
  inv_2nd,
  d_q_interval = 10
)

Arguments

tree_inc_cons

A data frame with consolidated tree level increments, typically the output of inv_inc_tree_consolidate

inv_1st_trees

Tree data frame as pulled and extended from the the fe_inventory object that represents the first of two subsequent surveys. Should be the same as previously used as input for inv_increment_repsurv_ccirc.

inv_2nd_trees

Tree data frame as pulled and extended from the the fe_inventory object that represents the second of two subsequent surveys. Should be the same as previously used as input for inv_increment_repsurv_ccirc.

inv_2nd

fe_inventory object that represents the second of the two inventories of interest.

d_q_interval

Numeric value, represents the width (cm) of the quadratic mean diameter (d_q) classes to be added to the output data frame. This argument is passed to the function back_table_dclass which is internally called.

Value

A data frame where each row represents a tree, with extended information about increment and other tree level variables. The two columns time_yr_prev and time_yr_2nd are uniform across all rows and describe the survey years of the inventory pair (1st and 2nd survey, respectively); their difference is the inter-survey period. time_yr is the time of the tree's actual observation in the join partner inventory and equals time_yr_prev for trees that exist only in the first survey. The result also carries an "inc_meta" attribute (survey years, period, area, point count, Berechnungs-/Ergänzungsmethode) that the increment base tables promote into their header meta block.

Coverage – read this before aggregating

The result covers only the plots measured in both inventories. Plots that exist just in the second survey are not part of the repeated-survey matching and therefore absent here. Feeding this frame straight into increment_base_table or increment_base_table_main_stand understates every per-hectare figure, because those tables divide by the full operation area (from the "inc_meta" attribute) while the second-only plots contribute no increment – their area sits in the denominator with nothing in the numerator. Pass the result through inv_inc_tree_extend_combined first, or, simpler, use inv_increment_repeated_survey, which runs the whole chain including that step.

See Also

Other increment: harmonize_inv_for_repsurv(), increment_base_table(), increment_base_table_main_stand(), increment_ytables_base_table(), inv_inc_big_overview(), inv_inc_big_overview_2nd_only(), inv_inc_big_overview_matches_only(), inv_inc_fill_gaps_gnfi3(), inv_inc_summaric(), inv_inc_tree_2_plot(), inv_inc_tree_consolidate(), inv_inc_tree_extend_combined(), inv_increment_gnfi3(), inv_increment_repeated_survey(), inv_increment_repsurv_ccirc(), inv_increment_ytables(), is_fe_increment_repsurv(), match_2_inventories(), match_2_inventories_by_center_coord(), match_2_inventories_by_plot_id(), match_plot_statistics(), match_trees_on_inventory_repsurv_ccirc(), match_trees_on_plot_repsurv_ccirc(), output_increment_base_table(), output_increment_base_table_pdf(), output_increment_overall(), output_increment_overall_pdf(), output_increment_overview_gnfi3(), output_increment_overview_gnfi3_pdf(), output_increment_overview_ytables_pdf(), reclassify_pseudo_ingrowth_ccirc(), tree_inc_repsurv()

Examples

  # Identify two subsequent inventories
  inv_a <- data_ex3_previous_sample_fe_inventory
  inv_b <- data_ex3_sample_fe_inventory

  inv_a_trees <- data_ex3_previous_sample_trees_essentials
  inv_b_trees <- data_ex3_sample_trees_essentials

  # Matching and gap filling for this pair are shipped ready-made, see
  # ?data_ex3_increment_interim for how they were built
  inc_repinv    <- data_ex3_increment_matched
  inc_repinv_fl <- data_ex3_increment_fills

  # Consolidate tree increments
  inc_repinv_cons <- inv_inc_tree_consolidate(inc_repinv_fl)

  # Extend with tree information required for further aggregation
  inv_inc_tree_extend(inc_repinv_cons, inv_a_trees, inv_b_trees, inv_b)


Fold Second-Only Plots Into the Repeated-Survey Tree-Level Increments

Description

Extends the per-tree increment frame of a repeated survey – the output of inv_inc_tree_extend, which covers only the plots measured in both inventories – with the plots that exist only in the second survey (new establishments, sample extensions). These second-only plots receive a short-window backward gnfi3 estimate via inv_inc_tree_extend_single (default dt = -5, the same convention as inv_inc_big_overview_2nd_only), and the two per-tree frames are row-bound into one.

Usage

inv_inc_tree_extend_combined(
  tree_inc_extd,
  inc_repinv_fl,
  inv_2nd_trees,
  dt = -5,
  d_q_interval = 10
)

Arguments

tree_inc_extd

Per-tree increment frame of the matched plots, the output of inv_inc_tree_extend. Its "inc_meta" attribute is carried over to the result.

inc_repinv_fl

Output of inv_inc_fill_gaps_gnfi3. Only its plot_matches$in_b_only element is used, to identify the second-only plots.

inv_2nd_trees

Tree data frame of the second survey (as pulled, height-completed and passed through trees_add_essentials); the same object supplied to inv_inc_tree_extend as its inv_2nd_trees argument.

dt

Time span (years) for the second-only backward gnfi3 estimate, passed to inv_inc_tree_extend_single. Negative for a backward projection. Default -5, matching inv_inc_big_overview_2nd_only.

d_q_interval

Numeric, width (cm) of the quadratic mean diameter (d_q) classes, passed on to inv_inc_tree_extend_single.

Details

The point of this function is the shared per-tree contract: both inv_inc_tree_extend and inv_inc_tree_extend_single emit the same columns consumed by inv_inc_tree_2_plot, so the combined frame runs through increment_base_table and increment_base_table_main_stand unchanged. The resulting base tables then cover the whole enterprise (matched plus second-only plots) instead of only the matched subset, so their per-hectare increment relates to the full operation area – consistent with the enterprise-level inv_inc_big_overview (where combined = matches_only + second_only).

Only living trees (!removal) of the second-only plots enter the estimate, mirroring inv_inc_big_overview_2nd_only: a plot without a predecessor survey has no between-inventory removals to capture, so a removal flag there marks a tree that is not part of the period's standing increment. The matched frame is left exactly as it is (it keeps its removed trees, whose increment is part of the period's production – the “Weg B” convention).

The header meta carried by tree_inc_extd already describes the whole enterprise (its area and point count come from the full second inventory passed to inv_inc_tree_extend), so it is simply re-attached to the combined frame (row-binding drops attributes).

Value

A per-tree increment data frame with the same contract as inv_inc_tree_extend, now spanning matched and second-only plots, carrying the (whole-enterprise) "inc_meta" attribute of tree_inc_extd. If there are no second-only plots (or none with living trees), tree_inc_extd is returned unchanged.

See Also

Other increment: harmonize_inv_for_repsurv(), increment_base_table(), increment_base_table_main_stand(), increment_ytables_base_table(), inv_inc_big_overview(), inv_inc_big_overview_2nd_only(), inv_inc_big_overview_matches_only(), inv_inc_fill_gaps_gnfi3(), inv_inc_summaric(), inv_inc_tree_2_plot(), inv_inc_tree_consolidate(), inv_inc_tree_extend(), inv_increment_gnfi3(), inv_increment_repeated_survey(), inv_increment_repsurv_ccirc(), inv_increment_ytables(), is_fe_increment_repsurv(), match_2_inventories(), match_2_inventories_by_center_coord(), match_2_inventories_by_plot_id(), match_plot_statistics(), match_trees_on_inventory_repsurv_ccirc(), match_trees_on_plot_repsurv_ccirc(), output_increment_base_table(), output_increment_base_table_pdf(), output_increment_overall(), output_increment_overall_pdf(), output_increment_overview_gnfi3(), output_increment_overview_gnfi3_pdf(), output_increment_overview_ytables_pdf(), reclassify_pseudo_ingrowth_ccirc(), tree_inc_repsurv()

Examples

  # Identify two subsequent inventories
  inv_a <- data_ex3_previous_sample_fe_inventory
  inv_b <- data_ex3_sample_fe_inventory

  inv_a_trees <- data_ex3_previous_sample_trees_essentials
  inv_b_trees <- data_ex3_sample_trees_essentials

  suppressWarnings(suppressMessages({
    # Matching and gap filling are shipped ready-made for this pair
    inc_rep <- data_ex3_increment_matched
    inc_fl  <- data_ex3_increment_fills
    inc_extd <- inv_inc_tree_consolidate(inc_fl) |>
      inv_inc_tree_extend(inv_a_trees, inv_b_trees, inv_b)
  }))

  # Fold in the second-only plots -> whole-enterprise per-tree frame
  inc_extd_all <- inv_inc_tree_extend_combined(
    inc_extd, inc_fl, inv_b_trees
  )

  # Base tables now cover matched + second-only plots (run unchanged)
  increment_base_table(inc_extd_all, by_class = "age")$all_total


Extend Single-Inventory gnfi3 Tree Increments With Detailed Tree Information for Further Aggregation

Description

Single-inventory counterpart to inv_inc_tree_extend. Where the latter consolidates a repeated survey (with its match-based and gnfi3-filled increments) into the per-tree contract consumed by inv_inc_tree_2_plot, this function produces the very same contract for an inventory that was not repeated. Every tree increment is estimated with the Third German National Forest Inventory growth functions (Riedel et al. 2017) via tree_inc_gnfi_2012, so the resulting iv_filled column is uniformly TRUE.

Usage

inv_inc_tree_extend_single(
  inv_trees,
  dt = 5,
  d_q_interval = 10,
  inv = NULL,
  .caller = "inv_inc_tree_extend_single"
)

Arguments

inv_trees

Tree data frame as pulled from an fe_inventory object after height completion (height_complete_inventory) and trees_add_essentials. This is the same kind of object that inv_inc_tree_extend expects as its inv_2nd_trees argument. Trees flagged for removal (removal == TRUE) are dropped: a single-inventory estimate concerns the currently living stand, and this keeps the source consistent with the yield-table path.

dt

Time span for the gnfi3 estimate (years), passed to tree_inc_gnfi_2012. Positive values project forward in time, negative values backward. Default 5 (forward), matching the forward-looking planning perspective of a single-inventory increment estimate. Must be non-zero.

d_q_interval

Numeric, width (cm) of the quadratic mean diameter (d_q) classes added to the output. Passed to back_table_dclass.

inv

Optional fe_inventory object (the inventory the trees were pulled from). If supplied, a minimal header meta (year, area_ha, n_plots) is attached as the "inc_meta" attribute so the increment base tables can express per-ha increments over the full operation area and fill the header. Default NULL: no meta, per-ha then over the stocked collective area.

.caller

Name the age check reports as the failing function. Defaults to this function's own name; inv_increment_gnfi3 passes its own, so that a user who called that one is not pointed at an internal step they cannot see.

Details

The point of this function is the shared seam: once the single-inventory source carries the same columns as the repeated-survey source, the downstream aggregation (inv_inc_tree_2_plot and everything built on top of it) is written and maintained only once, regardless of where the increment came from. The estimation method (gnfi3) is reflected in the per-tree _gnfi3 columns that ride along; the per-ha increment that the contract uses (iv_hub_m3_ha_yr) is the per-tree value scaled by n_rep_ha, clamped at zero (negative differences are improbable but possible near age 0).

The estimation direction lives in the sign of dt (see tree_inc_gnfi_2012). The default dt = 5 looks five years forward: for a single inventory the planning perspective is inherently forward-looking, so the increment of the coming years is the quantity of interest. The backward convention dt = -5 used by inv_inc_big_overview_2nd_only addresses a different situation – there the gnfi3 estimate stands in for a repeated survey, whose view is naturally backward (in the assumption that the recent past increment is a good proxy for the coming years). Either way a short window keeps the bias from the unknown future or past mortality and removal history small.

Value

A data frame where each row represents a tree, carrying the per-tree increment contract consumed by inv_inc_tree_2_plot: plot_id, species_group, age_class, d_q_class, layer_key, removal, standing_area_m2, n_rep_ha, area_rep_ha, the periodic and annual per-ha increments iv_hub_m3_ha_per / iv_hub_m3_ha_yr, and iv_filled (always TRUE here). The per-tree _gnfi3 estimation columns from tree_inc_gnfi_2012 are retained.

References

Riedel T, Hennig P, Kroiher F, Polley H, Schmitz F, F. S (2017). Die dritte Bundeswaldinventur (BWI 2012). Inventur- und Auswertungsmethoden. Thuenen Institut fuer Waldoekosysteme.


Estimate the Volume Increment of a Single Inventory With the BWI 3 Growth Functions

Description

Covers the whole chain from a prepared tree list to a ready-to-aggregate increment result, using the single-tree growth functions of the third German National Forest Inventory (Riedel et al. 2017). It is the single-inventory counterpart of inv_increment_repeated_survey: both return the same kind of object, so everything downstream – the increment base tables, the overview, and their PDF reports – is served in exactly the same way.

Usage

inv_increment_gnfi3(
  inv,
  inv_trees,
  dt = 5,
  d_q_interval = 10,
  keep_steps = FALSE
)

Arguments

inv

An fe_inventory object – the inventory the tree list was pulled from. Supplies the authoritative plot list (including plots without trees) and the header figures of the reports.

inv_trees

Tree data frame as pulled from inv after height completion (height_complete_inventory, fill_heights_back) and trees_add_essentials.

dt

Time span in years the estimate spans. Positive values look forward, negative values backward. Default is five years; the further such an estimate reaches, the less it can account for removals, mortality and ingrowth.

d_q_interval

Width of the quadratic mean diameter classes in cm, passed to back_table_dclass. Default is 10.

keep_steps

Logical. If TRUE, the intermediate results are returned in the steps element. They are useful for inspection but can become large for real inventories, so the default is FALSE, which leaves steps as NULL.

Details

The increment is estimated per tree and for the whole population, not only for the collective that happens to be reported afterwards. Any collective can therefore be aggregated from the result: the main stand, all layers, or a selection of your own via the tree_filter argument of the base-table functions.

Because the estimate ages each tree by dt years, the age of every tree is required. If ages are missing, the function stops rather than silently evaluating the part of the population that happens to carry one.

Value

An object of class fe_increment_gnfi3, which inherits from fe_increment. A list with the elements

trees

the per-tree increments, covering all layers,

overview

the aggregation to inventory level, overall and by species group,

meta

the figures the reports print in their header,

steps

the intermediate results, or NULL (see keep_steps).

References

Riedel T, Hennig P, Kroiher F, Polley H, Schmitz F, F. S (2017). Die dritte Bundeswaldinventur (BWI 2012). Inventur- und Auswertungsmethoden. Thuenen Institut fuer Waldoekosysteme.

See Also

inv_increment_repeated_survey for the repeated-survey counterpart, increment_base_table and increment_base_table_main_stand for the class tables, output_increment_overview_gnfi3 for the species-group overview.

Other increment: harmonize_inv_for_repsurv(), increment_base_table(), increment_base_table_main_stand(), increment_ytables_base_table(), inv_inc_big_overview(), inv_inc_big_overview_2nd_only(), inv_inc_big_overview_matches_only(), inv_inc_fill_gaps_gnfi3(), inv_inc_summaric(), inv_inc_tree_2_plot(), inv_inc_tree_consolidate(), inv_inc_tree_extend(), inv_inc_tree_extend_combined(), inv_increment_repeated_survey(), inv_increment_repsurv_ccirc(), inv_increment_ytables(), is_fe_increment_repsurv(), match_2_inventories(), match_2_inventories_by_center_coord(), match_2_inventories_by_plot_id(), match_plot_statistics(), match_trees_on_inventory_repsurv_ccirc(), match_trees_on_plot_repsurv_ccirc(), output_increment_base_table(), output_increment_base_table_pdf(), output_increment_overall(), output_increment_overall_pdf(), output_increment_overview_gnfi3(), output_increment_overview_gnfi3_pdf(), output_increment_overview_ytables_pdf(), reclassify_pseudo_ingrowth_ccirc(), tree_inc_repsurv()

Examples

  inc <- inv_increment_gnfi3(
    inv       = data_ex3_sample_fe_inventory,
    inv_trees = data_ex3_sample_trees_essentials
  )

  inc

  # Increment of the whole inventory, m3 per hectare and year
  inc$overview$overall$iv_total$iv_m3_ha_yr

  # Broken down by species group and age class
  increment_base_table(inc, by_class = "age")$all_total


Estimate the Volume Increment With the 3rd German National Forest Inventory Tree Growth Functions by Species and Age Class for a Whole Forest Inventory

Description

Uses the single tree growth functions developed for the third German National Forest Inventory (Riedel et al. 2017) as implemented in the package ForestElementsR, namely the functions d_age_gnfi3, and d_age_gnfi3

Usage

inv_increment_gnfi_2012(inv_dat, dt = 5, plot_area_weight = TRUE)

Arguments

inv_dat

Tree data frame as pulled from an fe_inventory object after height completion (height_complete_inventory), and applying trees_add_essentials.

dt

Time span to be applied for the increment estimation. Default is five years.

plot_area_weight

Logical, if TRUE (default), the single plots are weighted with the area they represent. If FALSE all plots are equally weighted

Value

A data frame with ha-wise annual volume increments and virtual areas per species group and age class, for the main stand only and per virtual monospecific hectare

References

Riedel T, Hennig P, Kroiher F, Polley H, Schmitz F, F. S (2017). Die dritte Bundeswaldinventur (BWI 2012). Inventur- und Auswertungsmethoden. Thuenen Institut fuer Waldoekosysteme.


Increment From a Repeated Inventory – the Whole Chain in One Call

Description

Calculates the volume increment of a pair of subsequent inventories and returns everything the output functions need. This is the standard entry point for the repeated-survey increment (“Verfahren 1”): it runs the six-step chain inv_increment_repsurv_ccirc -> inv_inc_fill_gaps_gnfi3 -> inv_inc_tree_consolidate -> inv_inc_tree_extend -> inv_inc_tree_extend_combined -> inv_inc_big_overview in the right order, with the tree lists handed on where they are needed, so that callers do not have to reproduce it.

Usage

inv_increment_repeated_survey(
  inv_1st,
  inv_2nd,
  inv_1st_trees,
  inv_2nd_trees,
  method = c("rep_classic", "rep_mean", "rep_end", "rep_trans"),
  fill_option = c("standard", "min_estimates", "all_estimates"),
  match_type = c("plot_id", "center_coord"),
  plot_id_style = c("baysf", "generic"),
  tree_id_style = c("baysf", "generic"),
  inner_circle_non_matchable = FALSE,
  shrinkage_rate_per_decade = 0.1,
  species_check = c("species_group", "species", "warn_only"),
  clamp_plausible_shrinkage = TRUE,
  coord_tolerance = 10,
  include_reptrees = TRUE,
  include_second_only = TRUE,
  d_q_interval = 10,
  dt_second_only = -5,
  style = c("baysf", "generic"),
  progress_bar = TRUE,
  keep_steps = FALSE
)

Arguments

inv_1st, inv_2nd

The two fe_inventory objects, first and second survey. See Which inventories are admissible.

inv_1st_trees, inv_2nd_trees

The matching tree data frames, as pulled from the two inventories and prepared with the canonical chain pull_trees -> height_complete_inventory -> fill_heights_back -> pull_trees -> trees_add_essentials.

method

The repeated-survey increment method, one of "rep_classic" (default), "rep_mean", "rep_end", "rep_trans". Passed to inv_increment_repsurv_ccirc.

fill_option

How the gnfi3 gap-filling estimates are used, one of "standard" (default), "min_estimates", "all_estimates". Passed to inv_inc_tree_consolidate, where the three options are described. Note that the second-only plots always carry gnfi3 estimates, whatever this argument says – they have no measured increment that could be preferred over an estimate.

match_type, plot_id_style, tree_id_style, coord_tolerance

Plot- and tree-matching arguments, passed to inv_increment_repsurv_ccirc.

inner_circle_non_matchable, shrinkage_rate_per_decade, species_check, clamp_plausible_shrinkage

Further arguments of inv_increment_repsurv_ccirc, passed through unchanged.

include_reptrees

Passed to inv_inc_fill_gaps_gnfi3. Default TRUE, which is required for fill_option = "all_estimates".

include_second_only

Logical, whether plots that exist only in the second survey are folded in. Default TRUE; see Whole-enterprise coverage.

d_q_interval

Numeric, width (cm) of the quadratic mean diameter classes. Passed to inv_inc_tree_extend.

dt_second_only

Time span (years, negative = backward) of the gnfi3 estimate for the second-only plots. Default -5. It reaches both places that estimate those plots – the per-tree frame (via inv_inc_tree_extend_combined) and the enterprise-level overview (inv_inc_big_overview's dt_2nd_only) – so that the base tables and the enterprise level keep agreeing whatever value is chosen.

style

Species grouping style of the enterprise-level overview, "baysf" (default) or "generic". Passed to inv_inc_big_overview.

progress_bar

Logical, whether the function displays a console progress bar itself. Default TRUE. Set to FALSE when you supply your own progressr handler – in particular in a Shiny app, see Progress reporting. The progress bars of the inner steps are always suppressed, independently of this argument.

keep_steps

Logical. If TRUE, the intermediate results of the chain are returned in the steps element. They are useful for inspection, but they hold several per-tree frames and grow with the inventory – for a real inventory they dominate the size of the returned object. The default is FALSE, which leaves steps as NULL.

Details

The individual step functions stay exported and are the expert-level interface: use them when a single stage has to be inspected, varied or replaced. For everything else this function is the intended route, and it is the one whose result is guaranteed to be internally consistent.

Value

An object of class fe_increment_repsurv (which inherits from fe_increment), a list with

trees

The per-tree increment data frame covering the whole enterprise, carrying the "inc_meta" attribute. This is the input for increment_base_table and increment_base_table_main_stand.

overview

The enterprise-level aggregate, output of inv_inc_big_overview, input for output_increment_overall.

summaric

The summaric (ertragsgeschichtlicher) increment, output of inv_inc_summaric – the gold standard at enterprise level.

meta

The header meta (survey years, period, area, point count, calculation method, fill option).

steps

The intermediate results of the chain (tree_level, filled, consolidated, extended_matched) for inspection, or NULL – see keep_steps.

Which inventories are admissible

This is a sample inventory method and applies only to sample inventories in concentric circles (Stichprobeninventur, taxonomy axis sample x concentric). Both fe_inventory objects must consist entirely of fe_ccircle_spatial plots (its _notrees child included) – the tree matching relies on the plot geometry and the tree positions those objects carry. Stand-wise inventories (standwise x relascope, plain fe_stand plots) carry no tree positions and therefore have no repeated-survey increment; they are rejected with an error by inv_increment_repsurv_ccirc_check_input, which runs first. The two surveys must further be a genuine pair: the same enterprise, the first one earlier than the second, at least one year apart.

Whole-enterprise coverage

The per-tree result covers the whole enterprise, not just the plots measured twice. Plots that exist only in the second survey (new establishments, sample extensions) cannot have a repeated-survey increment by construction, so they receive a backward gnfi3 estimate via inv_inc_tree_extend_combined. This matters for more than completeness: the increment base tables express their per-hectare increment over the full operation area, so leaving these plots out would put their area into the denominator while their increment is missing from the numerator, and every per-hectare figure would come out too low. With them folded in, the base tables reproduce the enterprise level (inv_inc_big_overview's combined rows) exactly. Set include_second_only = FALSE only to reproduce the matched-plots-only view, and be aware of the bias just described.

Progress reporting

The chain reports its seven phases through the progressr framework. With the default progress_bar = TRUE the function displays a console bar itself, so an interactive user needs no ceremony. With progress_bar = FALSE it only signals progress and the caller decides what to do with it – notably a Shiny app, which wraps the call in progressr::withProgressShiny() and gets its own progress bar without FeNEU knowing anything about Shiny. Always pass progress_bar = FALSE when supplying a handler yourself, otherwise two handlers compete. The phase labels are translated (options(fe_lang = "de")).

The progress bars of the inner steps are switched off deliberately (inv_increment_repsurv_ccirc is called with progress_bar = FALSE): the tree matching would otherwise draw its own per-plot bar over the phase bar of this function. Progress is reported at this level only.

See Also

increment_base_table, increment_base_table_main_stand, output_increment_overall, output_increment_base_table_pdf

Other increment: harmonize_inv_for_repsurv(), increment_base_table(), increment_base_table_main_stand(), increment_ytables_base_table(), inv_inc_big_overview(), inv_inc_big_overview_2nd_only(), inv_inc_big_overview_matches_only(), inv_inc_fill_gaps_gnfi3(), inv_inc_summaric(), inv_inc_tree_2_plot(), inv_inc_tree_consolidate(), inv_inc_tree_extend(), inv_inc_tree_extend_combined(), inv_increment_gnfi3(), inv_increment_repsurv_ccirc(), inv_increment_ytables(), is_fe_increment_repsurv(), match_2_inventories(), match_2_inventories_by_center_coord(), match_2_inventories_by_plot_id(), match_plot_statistics(), match_trees_on_inventory_repsurv_ccirc(), match_trees_on_plot_repsurv_ccirc(), output_increment_base_table(), output_increment_base_table_pdf(), output_increment_overall(), output_increment_overall_pdf(), output_increment_overview_gnfi3(), output_increment_overview_gnfi3_pdf(), output_increment_overview_ytables_pdf(), reclassify_pseudo_ingrowth_ccirc(), tree_inc_repsurv()

Examples

  inv_a <- data_ex3_previous_sample_fe_inventory
  inv_b <- data_ex3_sample_fe_inventory

  # The prepared tree lists ship with the package; how they were built with
  # the canonical chain is shown in ?data_ex3_trees_essentials
  inv_a_trees <- data_ex3_previous_sample_trees_essentials
  inv_b_trees <- data_ex3_sample_trees_essentials

  # The whole chain in one call
  suppressWarnings(suppressMessages({
    inc <- inv_increment_repeated_survey(
      inv_a, inv_b, inv_a_trees, inv_b_trees,
      method = "rep_classic", fill_option = "standard",
      progress_bar = FALSE
    )
  }))

  # Enterprise level, and the base tables built on the same object
  inc$overview$combined$overall$iv_total
  increment_base_table(inc, by_class = "age")$all_total


Calculate Tree-Wise Increments From Two Subsequent Inventories Based on Concentric Circle Plots With Spatial Information

Description

Main function to be used when calculating tree-level increments based on repeated inventories with concentric circle sample plots (fe_ccircle_spatial).

Usage

inv_increment_repsurv_ccirc(
  inv_1st,
  inv_2nd,
  inv_1st_trees,
  inv_2nd_trees,
  match_type = c("plot_id", "center_coord"),
  plot_id_style = c("baysf", "generic"),
  tree_id_style = c("baysf", "generic"),
  method = c("rep_classic", "rep_mean", "rep_end", "rep_trans"),
  inner_circle_non_matchable = FALSE,
  shrinkage_rate_per_decade = 0.1,
  species_check = c("species_group", "species", "warn_only"),
  clamp_plausible_shrinkage = TRUE,
  coord_tolerance = 10,
  progress_bar = TRUE
)

Arguments

inv_1st

fe_inventory object representing the earlier of the two inventories. All plots of this inventory must have the class fe_ccircle_spatial.

inv_2nd

fe_inventory object representing the later of the two inventories. All plots of this inventory must have the class fe_ccircle_spatial.

inv_1st_trees

A data frame resulting from applying the functions pull_trees, height_complete_inventory, and trees_add_essentials to inv_1st. While this could be done internally inside this function, this has typically happened earlier already in an inventory evaluation workflow. As this is a considerably time-consuming process, we deem the redundancy acceptable.

inv_2nd_trees

A data frame resulting from applying the functions pull_trees, height_complete_inventory, and trees_add_essentials to inv_2nd. While this could be done internally inside this function, this has typically happened earlier already in an inventory evaluation workflow. As this is a considerably time-consuming process, we deem the redundancy acceptable.

match_type

Character string indicating the method for matching inventory plots from the two subsequent inventories. The option "center_coord" matches points whose center coordinates have a distance of no more than coord_tolerance, while the option "plot_id" (default) matches plots with the same id.

plot_id_style

Character string indicating the plot_id style to be used. Only relevant when match_type == "plot_id". The available options are "baysf" (default) and "generic". For a match, the latter ("generic") requires the full plot_ids of two plots to be equal in both inventories. The former ("baysf") only requires the last group of digits in the plot_id for a match due to the specific BaySF data format.

tree_id_style

Character string that indicates how trees are uniquely identified on inventory plot level. This is required for matching trees on the same plot in both inventories. The options are "baysf" (default) and "generic". In the BaySF case, trees are matched by their polar coordinates, while in the generic case, the tree_ids must mark the same trees in both inventories.

method

Character string, choices are "rep_classic" (default), "rep_mean", "rep_end", and "rep_trans". See Details.

inner_circle_non_matchable

Logical, default FALSE. Controls the handling of pseudo-ingrowth trees — trees whose dbh crossed the inner circle's threshold between the two surveys and would otherwise be counted as fresh ingrowth although they did exist at the first survey on the inner circle. For tree_id_style == "baysf" inner-circle trees of the first inventory are inherently unmatchable, and pseudo-ingrowth identification (via Inv-2 position) and gnfi3 backward reconstruction always run. For tree_id_style == "generic" set this argument to TRUE when the survey design does not yield reliable tree identifiers on the inner circle (e.g. because very small trees cannot practically be tagged in the field). In that case, Inv-1 inner-circle trees are dropped from the match pool and pseudo-ingrowth identification runs analogously to the BaySF case. See reclassify_pseudo_ingrowth_ccirc for the reconstruction details.

shrinkage_rate_per_decade

Numeric, the maximum plausible volume shrinkage rate per decade for re-measured trees. Trees exceeding this threshold are flagged as implausible. Uses an exponential decay model internally, scaled to the actual survey interval. Default is 0.10 (i.e. 10 percent per decade).

species_check

Character string controlling how species consistency is checked for re-measured trees. Options are "species_group" (default, flags trees whose species group differs between surveys), "species" (flags trees whose species id differs), and "warn_only" (only issues a message, does not flag).

clamp_plausible_shrinkage

Logical. If TRUE (default), re-measured trees with plausible volume shrinkage (i.e. below the implausibility threshold) receive a zero increment instead of a negative one. If FALSE, plausible shrinkage is passed through to the increment for rep_classic, rep_mean, and rep_end. Has no effect on rep_trans, which always clamps negative volume differences to zero. Trees flagged as implausible always receive a zero increment regardless of this setting.

coord_tolerance

Maximum distance allowed for a match of two inventory plots in the distance unit of the coordinate reference system of inv_a and inv_b; in virtually all relevant cases it is m. Default is 10, i.e. inventory plots whose centers have a distance of up to 10 meters will be accepted as matches.

progress_bar

Boolean, if TRUE (default), a progress bar is shown during time critical steps of the execution.

Details

Even though the volume increments are calculated on tree level here, they are upscaled to 1 ha. This is important, because otherwise the increment represented by trees that change their representation number per ha between both inventories cannot be calculated correctly. Trees present in the first survey only always get zero increment; such values can be replaced by model-based estimates in a subsequent step. The function allows to choose between four methods of increment calculation (parameter method):

Value

A list with six elements: i) tree_increments is a data frame that identifies all trees that were appropriate for increment calculation with their plot and tree id in both inventories, and contains their annual and periodic volume increment (in m³/ha under bark after harvest). Note that in case of decreasing representation numbers between both surveys, increments can be also become negative which is statistically correct. ii) plot_matches informs about the outcome of the required plot matching across both inventories. It is the output of match_2_inventories which is called internally. iii) match_plot_stats which gives an overview of the plot matching results in terms of plot numbers and representation areas (i.e. the output of an internal call to match_plot_statistics). iv) match_tree_stats provides similar overview statistics on tree level. v) inv_period is the output of inv_period, computed once here so downstream functions can access the survey years and the inter-survey period without having to carry the fe_inventory objects further. vi) method is the increment method that was used in this call (one of "rep_classic", "rep_mean", "rep_end", "rep_trans"); carried through so downstream consumers can label outputs accordingly.

Position in the workflow

This is the first of six steps that lead from a pair of inventories to the increment tables and their PDFs. Unless a single stage has to be inspected or varied, call inv_increment_repeated_survey instead: it runs the whole chain in one call, hands the tree lists on where they are needed, and – importantly – includes the plots that exist only in the second survey, which a hand-built chain easily forgets (see the coverage warning in inv_inc_tree_extend).

See Also

Other increment: harmonize_inv_for_repsurv(), increment_base_table(), increment_base_table_main_stand(), increment_ytables_base_table(), inv_inc_big_overview(), inv_inc_big_overview_2nd_only(), inv_inc_big_overview_matches_only(), inv_inc_fill_gaps_gnfi3(), inv_inc_summaric(), inv_inc_tree_2_plot(), inv_inc_tree_consolidate(), inv_inc_tree_extend(), inv_inc_tree_extend_combined(), inv_increment_gnfi3(), inv_increment_repeated_survey(), inv_increment_ytables(), is_fe_increment_repsurv(), match_2_inventories(), match_2_inventories_by_center_coord(), match_2_inventories_by_plot_id(), match_plot_statistics(), match_trees_on_inventory_repsurv_ccirc(), match_trees_on_plot_repsurv_ccirc(), output_increment_base_table(), output_increment_base_table_pdf(), output_increment_overall(), output_increment_overall_pdf(), output_increment_overview_gnfi3(), output_increment_overview_gnfi3_pdf(), output_increment_overview_ytables_pdf(), reclassify_pseudo_ingrowth_ccirc(), tree_inc_repsurv()

Other repeated inventory: harmonize_inv_for_repsurv(), match_2_inventories(), match_2_inventories_by_center_coord(), match_2_inventories_by_plot_id(), match_plot_statistics(), match_trees_on_inventory_repsurv_ccirc(), match_trees_on_plot_repsurv_ccirc(), reclassify_pseudo_ingrowth_ccirc()

Examples

  inv_a <- data_ex3_previous_sample_fe_inventory
  inv_b <- data_ex3_sample_fe_inventory

  inv_a_trees <- data_ex3_previous_sample_trees_essentials
  inv_b_trees <- data_ex3_sample_trees_essentials

  # The two match types. "center_coord" pairs plots by their centres within
  # a tolerance, "plot_id" by their identifiers.
  inv_increment_repsurv_ccirc(
    inv_a, inv_b, inv_a_trees, inv_b_trees,
    match_type = "center_coord", coord_tolerance = 10,
    method = "rep_classic"
  )

  # The four methods differ only in how the increment of a single tree is
  # formed; "rep_classic" above and "rep_trans" here are the two that matter
  # in practice, "rep_mean" and "rep_end" are set the same way. See the
  # increment vignette for the formulae.
  inv_increment_repsurv_ccirc(
    inv_a, inv_b, inv_a_trees, inv_b_trees,
    match_type = "plot_id", plot_id_style = "baysf",
    method = "rep_trans"
  )


Check Input Provided for inv_increment_repsurv_ccirc

Description

Two sample plot based inventories that are considered repeated inventories of the same forest area are checked for important preconditions for matching them plotwise in a subsequent step (appropriate classes, consistency with regard to inventory times). If the check is successful, this does not guarantee succesful matching later, but if it is not, matching makes no sense at all. The function belongs in the context of calculating increment from repated sample inventories.

Usage

inv_increment_repsurv_ccirc_check_input(inv_1st, inv_2nd)

Arguments

inv_1st

fe_inventory object representing the earlier of the two inventories. All plots of this inventory must have the class fe_ccircle_spatial, otherwise the check will terminate early.

inv_2nd

fe_inventory object representing the later of the two inventories. All plots of this inventory must have the class fe_ccircle_spatial, otherwise the check will terminate early.

Details

The function is typically called from within inv_increment_repsurv_ccirc. Note that the check only covers the two fe_inventory objects handed to inv_increment_repsurv_ccirc. It does not check the two corresponding data frames that are also expected as an input to inv_increment_repsurv_ccirc for reasons of computation efficiency. However, as long as the user makes sure that these data frames are generated from the fe_inventory objects, checking the latter is sufficient.

Value

A two-element vector containing the year of the first and the second inventory if all checks are successful, i.e. both inventories fulfill all preconditions for meaningfully matching them. Otherwise, the function terminates with an error.


Estimate the Volume Increment of a Single Inventory With Yield Tables

Description

Covers the whole chain from a prepared tree list to a ready-to-aggregate increment result. It is the yield-table counterpart of inv_increment_repeated_survey and inv_increment_gnfi3: all three return an object of class fe_increment, carry their report header in meta, and are consumed the same way.

Usage

inv_increment_ytables(
  inv,
  inv_trees,
  ytable_selection,
  plot_area_weight = TRUE
)

Arguments

inv

An fe_inventory object – the inventory the tree list was pulled from. Supplies the report header and the reference area for the operation-wide per-hectare increment.

inv_trees

Tree data frame as pulled from inv after height completion (height_complete_inventory, fill_heights_back) and trees_add_essentials.

ytable_selection

A data frame that assigns names of existing fe_yield_table objects to species codes. Must have a column species_id which contains the species codes (in a valid species coding provided by the package ForestElementsR) and a column ytable_name with the name of the corresponding fe_yield_table object. See yield_tables_for_species for predefined table selections, and ytables_bavrn_state_var_1_feneu for the selection FeNEU ships. If species_id is not unique, the function terminates with an error.

plot_area_weight

Logical, if TRUE (default), the single plots are weighted with the area they represent. If FALSE all plots are equally weighted.

Details

The symmetry stops where the method does. A yield-table increment is not estimated per tree but for a cohort: one species in the main stand of one inventory plot, on the ideal (virtual monospecific) area it occupies there. The estimate needs the cohort's age and its mean height, which give the site index; age and site index give the per-hectare increment of the yield table, which is then corrected by the stocking level (the cohort's basal area over the basal area the table expects). Consequently this bundle holds no per-tree increments, the method is confined to the main stand, and the class tables cannot be filtered to arbitrary collectives the way the per-tree strands can.

A cohort has one age and one quadratic mean diameter, so the class an evaluation is grouped by – age class or diameter class – is a label on the result, not part of the estimate. Both labels are carried, and increment_ytables_base_table groups by whichever is asked for without estimating anything again.

Value

An object of class fe_increment_ytables, which inherits from fe_increment. A list with the elements

cohorts

one row per inventory plot and species: age, quadratic mean diameter and height, ideal area, site index, stocking level and the annual increment. This is the estimate itself,

overview

the species-group overview of the whole inventory,

meta

the figures the reports print in their header,

ytables_used

the yield tables actually used, per species group,

collective

the collective descriptor, always the main stand.

See Also

increment_ytables_base_table for the class tables, output_increment_overview_ytables_pdf for the overview report, inv_increment_gnfi3 for the per-tree single-inventory counterpart.

Other increment: harmonize_inv_for_repsurv(), increment_base_table(), increment_base_table_main_stand(), increment_ytables_base_table(), inv_inc_big_overview(), inv_inc_big_overview_2nd_only(), inv_inc_big_overview_matches_only(), inv_inc_fill_gaps_gnfi3(), inv_inc_summaric(), inv_inc_tree_2_plot(), inv_inc_tree_consolidate(), inv_inc_tree_extend(), inv_inc_tree_extend_combined(), inv_increment_gnfi3(), inv_increment_repeated_survey(), inv_increment_repsurv_ccirc(), is_fe_increment_repsurv(), match_2_inventories(), match_2_inventories_by_center_coord(), match_2_inventories_by_plot_id(), match_plot_statistics(), match_trees_on_inventory_repsurv_ccirc(), match_trees_on_plot_repsurv_ccirc(), output_increment_base_table(), output_increment_base_table_pdf(), output_increment_overall(), output_increment_overall_pdf(), output_increment_overview_gnfi3(), output_increment_overview_gnfi3_pdf(), output_increment_overview_ytables_pdf(), reclassify_pseudo_ingrowth_ccirc(), tree_inc_repsurv()

Examples

  inc <- inv_increment_ytables(
    inv       = data_ex3_sample_fe_inventory,
    inv_trees = data_ex3_sample_trees_essentials,
    ytable_selection = ytables_bavrn_state_var_1_feneu
  )

  inc

  inc$overview


Survey Years and Period Between Two Inventories

Description

Convenience helper that extracts the survey years of two fe_inventory objects and returns them together with the resulting inter-survey period, after the same validation that inv_increment_repsurv_ccirc applies. Used by functions that combine two inventories so that downstream consumers (e.g. inv_inc_summaric) can access the period without having to carry the fe_inventory objects further.

Usage

inv_period(inv_1st, inv_2nd)

Arguments

inv_1st, inv_2nd

Two fe_inventory objects in chronological order.

Value

A list with elements time_yr_1st, time_yr_2nd, and period_yr (the difference).

Examples

  inv_period(
    data_ex3_previous_sample_fe_inventory,
    data_ex3_sample_fe_inventory
  )


Cross-check plot IDs between tree list and inventory-point list

Description

Compares the set of plot IDs (plot_id) present in the tree list against those in the inventory-point list. If the two sets differ, the function emits a diagnostic message() and writes two tab-delimited diagnostic files into output_dir:

Writing the diagnostic files alongside the check is intentional: it gives the user ready-to-inspect artefacts without requiring the orchestrating function to manage intermediate data frames.

Usage

inv_point_checks(tree_list, Iventurpunkte, output_dir)

Arguments

tree_list

Data frame containing the tree list; must have a plot_id column.

Iventurpunkte

Data frame containing the inventory-point list; must have a plot_id column.

output_dir

Path of the output folder (character). Diagnostic files are written here when the two ID sets do not match; created if it does not exist.

Details

They go to the output folder, not next to the input data: the output folder is the one the user picked to be written to, so write permission there is assured (and their business), whereas the input folder may be read-only.

Value

Invisibly, a named list with the mismatch counts n_tree_not_in_inv (plots with trees but no inventory point) and n_inv_not_in_tree (inventory points with no trees); both 0 when the two ID sets match. The orchestrator uses n_tree_not_in_inv to raise a report warning, because trees on those plots have no plot record and are dropped further down the build.


Inventory-Wide Meta Information for the Table Headers

Description

Derive the enterprise-level figures that the meta block of the static table PDFs (output_base_table_pdf, output_structure_table_pdf) displays: the inventory year, the total (represented) area, and the number of inventory points. The result is returned in exactly the list(year, area_ha, n_plots) shape those functions expect for their meta argument (and their inventory argument uses this function internally).

Usage

inventory_meta(x)

Arguments

x

A fe_inventory object.

Details

The figures are read off the whole fe_inventory object, which is the authoritative plot list - so treeless plots (and their area) are counted too, unlike a derivation from an already-filtered tree table. This mirrors how the increment tables derive their header meta from the second inventory.

Value

A named list with three elements: year (the survey year; the most recent one if the plots carry more than one, with a warning), area_ha (sum of the per-plot represented areas), and n_plots (number of inventory points).

Examples

  inventory_meta(data_ex3_sample_fe_inventory)


Test for the Class fe_increment_gnfi3

Description

Test for the Class fe_increment_gnfi3

Usage

is_fe_increment_gnfi3(x)

Arguments

x

An object

Value

TRUE if x is an fe_increment_gnfi3 object, FALSE otherwise

Examples

  inc <- inv_increment_gnfi3(
    data_ex3_sample_fe_inventory, data_ex3_sample_trees_essentials
  )
  is_fe_increment_gnfi3(inc)


Is an Object an fe_increment_repsurv?

Description

Is an Object an fe_increment_repsurv?

Usage

is_fe_increment_repsurv(x)

Arguments

x

Object to test.

Value

Logical.

See Also

Other increment: harmonize_inv_for_repsurv(), increment_base_table(), increment_base_table_main_stand(), increment_ytables_base_table(), inv_inc_big_overview(), inv_inc_big_overview_2nd_only(), inv_inc_big_overview_matches_only(), inv_inc_fill_gaps_gnfi3(), inv_inc_summaric(), inv_inc_tree_2_plot(), inv_inc_tree_consolidate(), inv_inc_tree_extend(), inv_inc_tree_extend_combined(), inv_increment_gnfi3(), inv_increment_repeated_survey(), inv_increment_repsurv_ccirc(), inv_increment_ytables(), match_2_inventories(), match_2_inventories_by_center_coord(), match_2_inventories_by_plot_id(), match_plot_statistics(), match_trees_on_inventory_repsurv_ccirc(), match_trees_on_plot_repsurv_ccirc(), output_increment_base_table(), output_increment_base_table_pdf(), output_increment_overall(), output_increment_overall_pdf(), output_increment_overview_gnfi3(), output_increment_overview_gnfi3_pdf(), output_increment_overview_ytables_pdf(), reclassify_pseudo_ingrowth_ccirc(), tree_inc_repsurv()

Examples

  is_fe_increment_repsurv(1L)


Test for the Class fe_increment_ytables

Description

Test for the Class fe_increment_ytables

Usage

is_fe_increment_ytables(x)

Arguments

x

An object

Value

TRUE if x is an fe_increment_ytables object, FALSE otherwise

Examples

  inc <- inv_increment_ytables(
    data_ex3_sample_fe_inventory, data_ex3_sample_trees_essentials,
    ytables_bavrn_state_var_1_feneu
  )
  is_fe_increment_ytables(inc)


Check if an Object is an fe_inventory

Description

Check if an Object is an fe_inventory

Usage

is_fe_inventory(x)

Arguments

x

an object

Value

TRUE if the object inherits from the fe_stand class

Examples

is_fe_inventory(data_ex4_sample_fe_inventory)


Match two fe_inventory Objects on Plot Level

Description

Wraps the functions match_2_inventories_by_center_coord, and match_2_inventories_by_plot_id and decides which one to call.

Usage

match_2_inventories(
  inv_a,
  inv_b,
  match_type = c("plot_id", "center_coord"),
  plot_id_style = c("baysf", "generic"),
  coord_tolerance = 10
)

Arguments

inv_a

An object of class fe_inventory

inv_b

An object of class fe_inventory

match_type

Character string indicating the method for matching inventory plots from the two subsequent inventories. The option "center_coord" matches points whose center coordinates have a distance of no more than coord_tolerance, while the option "plot_id" (default) matches plots with the same id.

plot_id_style

Character string indicating the plot_id style to be used. Only relevant when match_type == "plot_id". The available options are "baysf" (default) and "generic". For a match, the latter ("generic") requires the full plot_ids of two plots to be equal in both inventories. The former ("baysf") only requires the last group of digits in the plot_id for a match due to the specific BaySF data format.

coord_tolerance

Maximum distance allowed for a match of two inventory plots in the distance unit of the coordinate reference system of inv_a and inv_b; in virtually all relevant cases it is m. Default is 10, i.e. inventory plots whose centers have a distance of up to 10 meters will be accepted as matches.

Value

A list with five elements: i) matches – the matching inventory plots, ii) in_a_only – plots that exist in inv_a only, iii) in_b_only – plots that exist in inv_b only, iv) multiple_matches – a logical vector identifying multiple matches (can only occur with match_type = "center_coord" and is undesired), and v) circle_def_mismatch – plot pairs that matched by id or coordinates but were excluded because their circle definitions (dbh_lower and/or c_area) differ between the two inventories. Such pairs are unsuitable for tree-level increment calculations from repeated surveys. The exact types of the objects (tibbles or sf) in this list depend on the match_type the function has been called with, but they always contain a column with the relevant plot ids.

See Also

Other increment: harmonize_inv_for_repsurv(), increment_base_table(), increment_base_table_main_stand(), increment_ytables_base_table(), inv_inc_big_overview(), inv_inc_big_overview_2nd_only(), inv_inc_big_overview_matches_only(), inv_inc_fill_gaps_gnfi3(), inv_inc_summaric(), inv_inc_tree_2_plot(), inv_inc_tree_consolidate(), inv_inc_tree_extend(), inv_inc_tree_extend_combined(), inv_increment_gnfi3(), inv_increment_repeated_survey(), inv_increment_repsurv_ccirc(), inv_increment_ytables(), is_fe_increment_repsurv(), match_2_inventories_by_center_coord(), match_2_inventories_by_plot_id(), match_plot_statistics(), match_trees_on_inventory_repsurv_ccirc(), match_trees_on_plot_repsurv_ccirc(), output_increment_base_table(), output_increment_base_table_pdf(), output_increment_overall(), output_increment_overall_pdf(), output_increment_overview_gnfi3(), output_increment_overview_gnfi3_pdf(), output_increment_overview_ytables_pdf(), reclassify_pseudo_ingrowth_ccirc(), tree_inc_repsurv()

Other repeated inventory: harmonize_inv_for_repsurv(), inv_increment_repsurv_ccirc(), match_2_inventories_by_center_coord(), match_2_inventories_by_plot_id(), match_plot_statistics(), match_trees_on_inventory_repsurv_ccirc(), match_trees_on_plot_repsurv_ccirc(), reclassify_pseudo_ingrowth_ccirc()

Other inventory matches: harmonize_inv_for_repsurv(), match_2_inventories_by_center_coord(), match_2_inventories_by_plot_id(), match_plot_statistics(), match_trees_on_inventory_repsurv_ccirc(), match_trees_on_plot_repsurv_ccirc()

Examples

  inv_a <- data_ex3_previous_sample_fe_inventory
  inv_b <- data_ex3_sample_fe_inventory

  # both options for match_type work for this example
  match_2_inventories(inv_a, inv_b, match_type = "plot_id", "baysf")
  match_2_inventories(inv_a, inv_b, match_type = "center_coord", "baysf")


Match Two fe_inventory Objects by the Center Coordinates of the Inventory Plots

Description

From two fe_inventory objects identify the matching and non- matching inventory plots based on their center coordinates. A warning is issued if the matching coordinates indicate spatial one-to-many or many-to-many relationships.

Usage

match_2_inventories_by_center_coord(inv_a, inv_b, tolerance = 0)

Arguments

inv_a

An object of class fe_inventory

inv_b

An object of class fe_inventory

tolerance

Maximum distance allowed for a match of two inventory plots in the distance unit of the coordinate reference system of inv_a and inv_b; in virtually all relevant cases it is m. Default is 0, i.e. exact matches are required.

Value

A list containing three sf objects, matches, in_a_only, and in_b_only, and one logical vector multiple_matches. The three sf objects indicate the inventory plots that are present in both, inv_a and inv_b, only in inv_a but not in inv_b, and only in inv_b but not in inv_a, respectively. The sf object matches has the columns plot_id.inv_a, plot_id.inv_b, and geometry (i.e. the point coordinates). Thereby, The column plot_id_inv_a contains the id of a plot it has in inv_a, and analogously with plot_id_inv_b. Note that spatially matching points do not necessarily need to have the same plot_id in both inventories. The sf object in_a_only has only two columns, plot_id, and geometry. The same applies to the sf object in_b_only. the plot_id entries for the other inventories are NA. The vector multiple_matches relates to the matches object, and indicates entries with the same center coordinates. This indicates one-to-many or many-to-many relations between the two input inventories which is usually a problem. Therefore, multiple_matches should only contain FALSE entries.

See Also

Other increment: harmonize_inv_for_repsurv(), increment_base_table(), increment_base_table_main_stand(), increment_ytables_base_table(), inv_inc_big_overview(), inv_inc_big_overview_2nd_only(), inv_inc_big_overview_matches_only(), inv_inc_fill_gaps_gnfi3(), inv_inc_summaric(), inv_inc_tree_2_plot(), inv_inc_tree_consolidate(), inv_inc_tree_extend(), inv_inc_tree_extend_combined(), inv_increment_gnfi3(), inv_increment_repeated_survey(), inv_increment_repsurv_ccirc(), inv_increment_ytables(), is_fe_increment_repsurv(), match_2_inventories(), match_2_inventories_by_plot_id(), match_plot_statistics(), match_trees_on_inventory_repsurv_ccirc(), match_trees_on_plot_repsurv_ccirc(), output_increment_base_table(), output_increment_base_table_pdf(), output_increment_overall(), output_increment_overall_pdf(), output_increment_overview_gnfi3(), output_increment_overview_gnfi3_pdf(), output_increment_overview_ytables_pdf(), reclassify_pseudo_ingrowth_ccirc(), tree_inc_repsurv()

Other repeated inventory: harmonize_inv_for_repsurv(), inv_increment_repsurv_ccirc(), match_2_inventories(), match_2_inventories_by_plot_id(), match_plot_statistics(), match_trees_on_inventory_repsurv_ccirc(), match_trees_on_plot_repsurv_ccirc(), reclassify_pseudo_ingrowth_ccirc()

Other inventory matches: harmonize_inv_for_repsurv(), match_2_inventories(), match_2_inventories_by_plot_id(), match_plot_statistics(), match_trees_on_inventory_repsurv_ccirc(), match_trees_on_plot_repsurv_ccirc()

Examples

  # Construct a dummy example with partly non-matching plots from one
  # fe_inventory object
  inv_a <- data_ex3_sample_fe_inventory[3:10, ]
  inv_b <- data_ex3_sample_fe_inventory[1:7,  ]

  # As both dummy inventories were generated from the same set, we do not
  # require any tolerance > 0
  match_2_inventories_by_center_coord(inv_a, inv_b, tolerance = 0)


  # Now a real example from two subsequent inventories
  inv_a <- data_ex3_previous_sample_fe_inventory
  inv_b <- data_ex3_sample_fe_inventory

  # Requires a tolerance of 10.0 m in order to obtain the correct match
  # (as indicated by the plot ids)
  match_2_inventories_by_center_coord(inv_a, inv_b, tolerance = 10.0)

  # If tolerance is set too high (here unrealistic 3000 m for demo purposes),
  # we obtain duplicate matches and a warning message
  match_2_inventories_by_center_coord(inv_a, inv_b, tolerance = 3000)


Match Two fe_inventory Objects by the IDs of the Inventory Plots

Description

From two fe_inventory objects identify the matching and non- matching inventory plots based on their center coordinates.

Usage

match_2_inventories_by_plot_id(inv_a, inv_b, style = c("generic", "baysf"))

Arguments

inv_a

An object of class fe_inventory

inv_b

An object of class fe_inventory

style

Character, two options "generic" and "baysf". The former requires that the column plot_id in both inventories, inv_a, and inv_b is the same for the same inventory unit. The latter assumes a BaySF (Bavarian State Forest) style plot_id which is an underscore ("_") separated string, where only the third substring (actually the original BaySF field 'koord") has to match for the the same inventory unit in subsequent inventories.

Value

A list that comprises three data frames (tibbles): The first one, matches, has two columns, plot_id_inv_a, and plot_id_inv_b which indicate the ids of the matching plot_ids in both inventories. The two columns are required because there may be situations (BaySF style) where the ids of matching points are not entirely the same. The second data frame, in_a_only, contains the ids of those plots that exist in inv_a, but not in inv_b, while the third one, in_b_only, contains the ids of the plots that are present in inv_b, but not in inv_a.

See Also

Other increment: harmonize_inv_for_repsurv(), increment_base_table(), increment_base_table_main_stand(), increment_ytables_base_table(), inv_inc_big_overview(), inv_inc_big_overview_2nd_only(), inv_inc_big_overview_matches_only(), inv_inc_fill_gaps_gnfi3(), inv_inc_summaric(), inv_inc_tree_2_plot(), inv_inc_tree_consolidate(), inv_inc_tree_extend(), inv_inc_tree_extend_combined(), inv_increment_gnfi3(), inv_increment_repeated_survey(), inv_increment_repsurv_ccirc(), inv_increment_ytables(), is_fe_increment_repsurv(), match_2_inventories(), match_2_inventories_by_center_coord(), match_plot_statistics(), match_trees_on_inventory_repsurv_ccirc(), match_trees_on_plot_repsurv_ccirc(), output_increment_base_table(), output_increment_base_table_pdf(), output_increment_overall(), output_increment_overall_pdf(), output_increment_overview_gnfi3(), output_increment_overview_gnfi3_pdf(), output_increment_overview_ytables_pdf(), reclassify_pseudo_ingrowth_ccirc(), tree_inc_repsurv()

Other repeated inventory: harmonize_inv_for_repsurv(), inv_increment_repsurv_ccirc(), match_2_inventories(), match_2_inventories_by_center_coord(), match_plot_statistics(), match_trees_on_inventory_repsurv_ccirc(), match_trees_on_plot_repsurv_ccirc(), reclassify_pseudo_ingrowth_ccirc()

Other inventory matches: harmonize_inv_for_repsurv(), match_2_inventories(), match_2_inventories_by_center_coord(), match_plot_statistics(), match_trees_on_inventory_repsurv_ccirc(), match_trees_on_plot_repsurv_ccirc()

Examples

  # Construct a dummy example with partly non-matching plots from one
  # fe_inventory object
  inv_a <- data_ex3_sample_fe_inventory[3:10, ]
  inv_b <- data_ex3_sample_fe_inventory[1:7,  ]

  # These are BaySF style inventory data, which means that even matching plot
  # ids from subsequent inventories are equal only with regard to their last
  # group of digits. However, as this example was constructed from only one
  # inventory, both style options, "baysf" and "generic" are equally ok.
  match_2_inventories_by_plot_id(inv_a, inv_b, style = "baysf")
  match_2_inventories_by_plot_id(inv_a, inv_b, style = "generic")

  # Now a real example with two subsequent inventories
  inv_a <- data_ex3_previous_sample_fe_inventory
  inv_b <- data_ex3_sample_fe_inventory

  # These are BaySF style inventory data, from real subsequent inventories.
  # Therefore, we must choose that style for matching
  match_2_inventories_by_plot_id(inv_a, inv_b, style = "baysf")


  # The generic inventory style requires that corresponding plots have the
  # same plot_id in both inventories. We can achieve that with a slight
  # manipulations of the BaySF style data used above (i.e. reducing the
  # original plot_ids to the last group of digits):
  inv_a <- inv_a |>
    dplyr::mutate(
      plot_id = purrr::map_chr(
        plot_id, .f = function(.x) strsplit(.x, "_")[[1]][3]
      )
    )

  inv_b <- inv_b |>
    dplyr::mutate(
      plot_id = purrr::map_chr(
        plot_id, .f = function(.x) strsplit(.x, "_")[[1]][3]
      )
    )

  # Now we achieve the same result as above with generic-style matching
  match_2_inventories_by_plot_id(inv_a, inv_b, style = "generic")



Generate Plot Match Overview Statistics from the Output of match_2_inventories

Description

Informs about the numbers of plots that match and do not match in both inventories, and the corresponding representation areas in ha.

Usage

match_plot_statistics(plot_matches, inv_a, inv_b)

Arguments

plot_matches

list, output of match_2_inventories

inv_a

An object of class fe_inventory nust be the first inventory relating to plot_matches

inv_b

An object of class fe_inventory nust be the second inventory relating to plot_matches

Value

A list containing two named vectors, plot_numbers, and rep_areas_ha. These contain the statistics relating to plot numbers and represented areas, respectively. Both include a count/area for plots excluded due to incompatible circle definitions (n_circle_def_mismatch, ha_circle_def_mismatch_1st, ha_circle_def_mismatch_2nd).

See Also

Other increment: harmonize_inv_for_repsurv(), increment_base_table(), increment_base_table_main_stand(), increment_ytables_base_table(), inv_inc_big_overview(), inv_inc_big_overview_2nd_only(), inv_inc_big_overview_matches_only(), inv_inc_fill_gaps_gnfi3(), inv_inc_summaric(), inv_inc_tree_2_plot(), inv_inc_tree_consolidate(), inv_inc_tree_extend(), inv_inc_tree_extend_combined(), inv_increment_gnfi3(), inv_increment_repeated_survey(), inv_increment_repsurv_ccirc(), inv_increment_ytables(), is_fe_increment_repsurv(), match_2_inventories(), match_2_inventories_by_center_coord(), match_2_inventories_by_plot_id(), match_trees_on_inventory_repsurv_ccirc(), match_trees_on_plot_repsurv_ccirc(), output_increment_base_table(), output_increment_base_table_pdf(), output_increment_overall(), output_increment_overall_pdf(), output_increment_overview_gnfi3(), output_increment_overview_gnfi3_pdf(), output_increment_overview_ytables_pdf(), reclassify_pseudo_ingrowth_ccirc(), tree_inc_repsurv()

Other repeated inventory: harmonize_inv_for_repsurv(), inv_increment_repsurv_ccirc(), match_2_inventories(), match_2_inventories_by_center_coord(), match_2_inventories_by_plot_id(), match_trees_on_inventory_repsurv_ccirc(), match_trees_on_plot_repsurv_ccirc(), reclassify_pseudo_ingrowth_ccirc()

Other inventory matches: harmonize_inv_for_repsurv(), match_2_inventories(), match_2_inventories_by_center_coord(), match_2_inventories_by_plot_id(), match_trees_on_inventory_repsurv_ccirc(), match_trees_on_plot_repsurv_ccirc()

Examples


  inv_a <- data_ex3_previous_sample_fe_inventory
  inv_b <- data_ex3_sample_fe_inventory

  # both options for match_type work for this example
  match_pid <- match_2_inventories(
    inv_a, inv_b, match_type = "plot_id", "baysf"
  )
  match_crd <- match_2_inventories(
    inv_a, inv_b, match_type = "center_coord", "baysf"
  )

  # stats should be the same in both cases
  match_plot_statistics(match_pid, inv_a, inv_b)
  match_plot_statistics(match_crd, inv_a, inv_b)


Provide an Overview of the Tree Matching Results on Inventory Level

Description

Typically called from within inv_increment_repsurv_ccirc. The returned vector summarises the matching outcome from the perspective of both inventories and breaks the matched-trees population into the status categories that the rest of the pipeline distinguishes — so users can see at a glance how many trees were unambiguously re-measured, how many were verified ingrowth / disappearances, how many fall into the unmatchable inner-circle cohort, and how many were reclassified as pseudo-ingrowth by reclassify_pseudo_ingrowth_ccirc.

Usage

match_tree_statistics(tree_matches, inv_1st_trees, inv_2nd_trees)

Arguments

tree_matches

Data frame, output of match_trees_on_inventory_repsurv_ccirc, optionally with the pseudo_ingrowth_corrected column added by reclassify_pseudo_ingrowth_ccirc.

inv_1st_trees

A data frame resulting from applying the functions pull_trees, height_complete_inventory, and trees_add_essentials to the first of the two fe_inventory objects tree_matches relates to.

inv_2nd_trees

A data frame resulting from applying the functions pull_trees, height_complete_inventory, and trees_add_essentials to the second of the two fe_inventory objects tree_matches relates to.

Value

A named numeric vector with the following entries:

n_total_1st

Total number of trees in inv_1st_trees.

n_in_match_1st

Trees of the 1st survey that appear in tree_matches (i.e. their plot is part of the matched plot set).

n_in_both_1st

Trees of the 1st survey that were unambiguously re-measured: rows with tree_exists_1st and tree_exists_2nd both TRUE that carry an identified inv-1 record (tree_id_1st not NA).

n_total_2nd

Total number of trees in inv_2nd_trees.

n_in_match_2nd

Trees of the 2nd survey that appear in tree_matches. Counted from the inv-2 side and therefore not the same population as n_in_match_1st: 1st-only rows are absent here and 2nd-only rows are absent there, so the two numbers routinely differ.

n_in_both_2nd

The inv-2 side of the re-measured trees. This is not a mirror of n_in_both_1st and the two are expected to differ as soon as pseudo-ingrowth occurs: reclassify_pseudo_ingrowth_ccirc sets tree_exists_1st = TRUE on 2nd-only rows to record that the tree did exist at inv 1, but it leaves tree_id_1st at NA, because no individual inv-1 record was identified (that is precisely why the tree was unmatchable). Such rows therefore count towards n_in_both_2nd but cannot count towards n_in_both_1st, and n_in_both_2nd - n_in_both_1st = n_pseudo_ingrowth holds by construction. A difference of exactly that size is correct behaviour, not a matching defect.

n_unmatchable_1st

Inv-1 trees that carry a measured value but could not be matched to inv 2 because their matching key was unreliable (typically inner-circle trees recorded without polar coordinates). They show up in tree_matches as 1st-only rows with tree_exists_2nd = NA and is_unmatchable_1st = TRUE.

n_unmatchable_2nd

Inv-2 counterpart: 2nd-only rows with tree_exists_1st = NA and is_unmatchable_2nd = TRUE. Trees reclassified by reclassify_pseudo_ingrowth_ccirc also carry the is_unmatchable_2nd flag and are included in this count.

n_verified_ingrowth

2nd-only rows that the inv 2 match pool saw and verified to have no inv 1 partner (genuine new trees above the smallest sampling threshold).

n_verified_removal

1st-only rows with verified absence at inv 2 (tree_exists_2nd %in% FALSE, i.e. matchable inv 1 record but no inv 2 partner found).

n_pseudo_ingrowth

Number of 2nd-only inv 2 records that reclassify_pseudo_ingrowth_ccirc reclassified as pseudo-ingrowth (inner-circle inv 1 origin reconstructed via gnfi3 backward). 0 when the reclassification step is absent or did not fire.


Match Trees on Subsequent Inventories on Inventory Level

Description

Typically called from within inv_increment_repsurv_ccirc. The consistency of the input to this function is not checked here. In essence, the function wraps serial calls of match_trees_on_plot_repsurv_ccirc.

Usage

match_trees_on_inventory_repsurv_ccirc(
  inv_point_matches,
  inv_1st,
  inv_2nd,
  inv_1st_trees,
  inv_2nd_trees,
  tree_id_style = c("baysf", "generic"),
  inner_circle_non_matchable = FALSE,
  shrinkage_rate_per_decade = 0.1,
  species_check = c("species_group", "species", "warn_only"),
  progress_bar = TRUE
)

Arguments

inv_point_matches

Output of match_2_inventories (typical) or match_2_inventories_by_center_coord, or match_2_inventories_by_plot_id

inv_1st

fe_inventory object representing the earlier of the two inventories. All plots of this inventory must have the class fe_ccircle_spatial.

inv_2nd

fe_inventory object representing the later of the two inventories. All plots of this inventory must have the class fe_ccircle_spatial.

inv_1st_trees

A data frame resulting from applying the functions pull_trees, height_complete_inventory, and trees_add_essentials to inv_1st. While this could be done internally inside this function, this has typically happened earlier already in an inventory evaluation workflow. As this is a considerably time-consuming process, we deem the redundancy acceptable.

inv_2nd_trees

A data frame resulting from applying the functions pull_trees, height_complete_inventory, and trees_add_essentials to inv_2nd. While this could be done internally inside this function, this has typically happened earlier already in an inventory evaluation workflow. As this is a considerably time-consuming process, we deem the redundancy acceptable.

tree_id_style

Character string that indicates how trees are uniquely identified on inventory plot level. This is required for matching trees on the same plot in both inventories. The options are "baysf" (default) and "generic". In the BaySF case, trees are matched by their polar coordinates, while in the generic case, the tree_ids must mark the same trees in both inventories.

inner_circle_non_matchable

Logical, default FALSE. Passed through to match_trees_on_plot_repsurv_ccirc. See its documentation for the full meaning.

shrinkage_rate_per_decade

Numeric, the maximum plausible volume shrinkage rate per decade. Default is 0.10. See inv_increment_repsurv_ccirc for details.

species_check

Character string controlling species consistency checks. Options: "species_group" (default), "species", "warn_only". See inv_increment_repsurv_ccirc for details.

progress_bar

Boolean, if TRUE (default), a progress bar is shown during time critical steps of the execution.

Value

A data frame identifying all matching trees with their tree and plot ids in both inventories, the calendar years of both inventories, and columns with flags that indicate in which of both inventories a tree exists (can be only one of them or both). Additionally contains the columns volume_change_rate_per_decade (the observed volume change rate scaled to a decade, based on an exponential model; positive values indicate growth, negative values indicate shrinkage), volume_change_implausible (logical, TRUE if shrinkage exceeds the threshold), and species_mismatch (logical, TRUE if species identity changed between surveys according to the species_check setting).

See Also

Other increment: harmonize_inv_for_repsurv(), increment_base_table(), increment_base_table_main_stand(), increment_ytables_base_table(), inv_inc_big_overview(), inv_inc_big_overview_2nd_only(), inv_inc_big_overview_matches_only(), inv_inc_fill_gaps_gnfi3(), inv_inc_summaric(), inv_inc_tree_2_plot(), inv_inc_tree_consolidate(), inv_inc_tree_extend(), inv_inc_tree_extend_combined(), inv_increment_gnfi3(), inv_increment_repeated_survey(), inv_increment_repsurv_ccirc(), inv_increment_ytables(), is_fe_increment_repsurv(), match_2_inventories(), match_2_inventories_by_center_coord(), match_2_inventories_by_plot_id(), match_plot_statistics(), match_trees_on_plot_repsurv_ccirc(), output_increment_base_table(), output_increment_base_table_pdf(), output_increment_overall(), output_increment_overall_pdf(), output_increment_overview_gnfi3(), output_increment_overview_gnfi3_pdf(), output_increment_overview_ytables_pdf(), reclassify_pseudo_ingrowth_ccirc(), tree_inc_repsurv()

Other repeated inventory: harmonize_inv_for_repsurv(), inv_increment_repsurv_ccirc(), match_2_inventories(), match_2_inventories_by_center_coord(), match_2_inventories_by_plot_id(), match_plot_statistics(), match_trees_on_plot_repsurv_ccirc(), reclassify_pseudo_ingrowth_ccirc()

Other inventory matches: harmonize_inv_for_repsurv(), match_2_inventories(), match_2_inventories_by_center_coord(), match_2_inventories_by_plot_id(), match_plot_statistics(), match_trees_on_plot_repsurv_ccirc()

Examples

  # Prepare everything required
  inv_a <- data_ex3_previous_sample_fe_inventory
  inv_b <- data_ex3_sample_fe_inventory

  # Match inventory points
  inv_pt_mtch <- match_2_inventories(inv_a, inv_b, "plot_id", "baysf")

  inv_a_trees <- data_ex3_previous_sample_trees_essentials
  inv_b_trees <- data_ex3_sample_trees_essentials

  # Finally, make the match
  match_trees_on_inventory_repsurv_ccirc(
    inv_pt_mtch, inv_a, inv_b, inv_a_trees, inv_b_trees,
    tree_id_style = "baysf"
  )


Match Trees on Subsequent Inventories of One Plot

Description

Identifying trees that do or do not occur in two subsequent observations of one inventory plot of class fe_ccircle_spatial. Takes into account only trees with an entry in the tree_positions slot of the fe_ccircle_spatial object. Trees that have a removal flag in the first observation are excluded, because they are not relevant for increment calculations.

Usage

match_trees_on_plot_repsurv_ccirc(
  plot_in_inv_1st,
  plot_in_inv_2nd,
  tree_id_style = c("baysf", "generic"),
  inner_circle_non_matchable = FALSE
)

Arguments

plot_in_inv_1st

An inventory plot represented as an object of class fe_ccircle_spatial or its child class fe_ccircle_spatial_notrees.

plot_in_inv_2nd

An inventory plot representing a later survey of plot plot_in_inv_1st. Must be an object of class fe_ccircle_spatial or its child class fe_ccircle_spatial_notrees.

tree_id_style

Character string that indicates how trees are uniquely identified on inventory plot level. This is required for matching trees on the same plot in both inventories. The options are "baysf" (default) and "generic". In the BaySF case, trees are matched by their polar coordinates, while in the generic case, the tree_ids must mark the same trees in both inventories.

inner_circle_non_matchable

Logical, default FALSE. Only relevant for tree_id_style == "generic": set to TRUE when the survey design renders inner-circle tree identifiers unreliable — e.g. when very small trees cannot practically be individually tagged in the field. In that case, all trees of the first inventory that belong to the inner circle by dbh (dbh_cm < min(circle_definition$dbh_lower[dbh_lower > 0])) are removed from the match pool, so the matching behaves analogously to the BaySF case on the inner circle. Inner-circle trees of the second inventory are left untouched; they will simply not find a partner. Has no effect for tree_id_style == "baysf" (where inner-circle trees of the first inventory are inherently unmatchable already).

Details

Typically called from within match_trees_on_inventory_repsurv_ccirc which in turn is called by inv_increment_repsurv_ccirc. The function does not check whether the two input inventory plots (plot_in_inv_1st, plot_in_inv_2nd) are really matching, i.e. represent two subsequent surveys of the same plot. This must be made sure before calling it.

Value

A data frame with seven columns, tree_id_1st, tree_id_2nd, tree_exists_1st, tree_exists_2nd, time_yr_1st, and time_yr_2nd. The first two contain the ids of the plot and the matching trees in the first inventory. If a tree is not present in one inventory, its id value is NA. Similarly, the third and the fourth column have the value TRUE or FALSE if a tree exists in an inventory or not. The column tree_removal_2nd indicates whether a tree has been registed as removed (TRUE) or not (FALSE) in the second inventory. The tree_id and the tree_exists columns are somewhat redundant, but their different formats may be useful in subsequent evaluations. The sixth and the seventh column contain the years of both inventories. These two columns do never have NA values.

Trees sharing one position

With tree_id_style == "baysf" trees are matched on their exact polar coordinates. If two trees of the same plot and survey carry the same distance and azimuth, that position identifies neither of them, and an exact-coordinate join would pair every inv-1 tree at the spot with every inv-2 tree at the spot — a Cartesian product that lets a tree enter the increment more than once.

The rule is therefore: a position shared by more than one tree of the same plot and survey is treated as no position at all. The affected trees are handled exactly like trees recorded without coordinates — they are excluded from the match and flagged is_unmatchable_1st resp. is_unmatchable_2nd. Their measured volumes still reach the standing-volume aggregates, they simply contribute no individual increment, and they never become pseudo-ingrowth candidates (their tree_exists_* stays NA). Each occurrence raises a warning naming the plot and the trees.

Duplicated coordinates are a defect of the source data, not a modelling choice, and they are rare (single-digit counts per real inventory). This rule keeps the increment computation well-defined and conservative rather than resolving the ambiguity by guessing which tree is which.

See Also

Other increment: harmonize_inv_for_repsurv(), increment_base_table(), increment_base_table_main_stand(), increment_ytables_base_table(), inv_inc_big_overview(), inv_inc_big_overview_2nd_only(), inv_inc_big_overview_matches_only(), inv_inc_fill_gaps_gnfi3(), inv_inc_summaric(), inv_inc_tree_2_plot(), inv_inc_tree_consolidate(), inv_inc_tree_extend(), inv_inc_tree_extend_combined(), inv_increment_gnfi3(), inv_increment_repeated_survey(), inv_increment_repsurv_ccirc(), inv_increment_ytables(), is_fe_increment_repsurv(), match_2_inventories(), match_2_inventories_by_center_coord(), match_2_inventories_by_plot_id(), match_plot_statistics(), match_trees_on_inventory_repsurv_ccirc(), output_increment_base_table(), output_increment_base_table_pdf(), output_increment_overall(), output_increment_overall_pdf(), output_increment_overview_gnfi3(), output_increment_overview_gnfi3_pdf(), output_increment_overview_ytables_pdf(), reclassify_pseudo_ingrowth_ccirc(), tree_inc_repsurv()

Other repeated inventory: harmonize_inv_for_repsurv(), inv_increment_repsurv_ccirc(), match_2_inventories(), match_2_inventories_by_center_coord(), match_2_inventories_by_plot_id(), match_plot_statistics(), match_trees_on_inventory_repsurv_ccirc(), reclassify_pseudo_ingrowth_ccirc()

Other inventory matches: harmonize_inv_for_repsurv(), match_2_inventories(), match_2_inventories_by_center_coord(), match_2_inventories_by_plot_id(), match_plot_statistics(), match_trees_on_inventory_repsurv_ccirc()

Examples

  # Standard case: Match two single plots, both with the same set of trees

  ## Select two matching plots from two subsequent inventories
  plot_1st <- data_ex3_previous_sample_fe_inventory |>
    dplyr::filter(plot_id == "900100002_1_99900002") |>
    purrr::pluck("plot", 1)

  plot_2nd <- data_ex3_sample_fe_inventory |>
    dplyr::filter(plot_id == "900000002_1_99900002") |>
    purrr::pluck("plot", 1)

  ## Here's the actual matching
  match_trees_on_plot_repsurv_ccirc(
    plot_1st, plot_2nd, tree_id_style = "baysf"
  )


  # Standard case: Match two single plots, some trees however missing in
  #                the first or the second inventory

  ## Construct the data from the example above by clipping out trees from
  ## plot_1st
  plot_2nd   <- plot_1st

  miss_index <- c(1, 2, 4, 5)
  plot_1st$trees <- plot_1st$trees |>
    dplyr::arrange(tree_id) |>
    dplyr::slice(- miss_index)
  plot_1st$tree_positions <- plot_1st$tree_positions |>
    dplyr::arrange(tree_id) |>
    dplyr::slice(- miss_index)

  miss_index <- c(3, 7, 8)
  plot_2nd$trees <- plot_2nd$trees |>
    dplyr::arrange(tree_id) |>
    dplyr::slice(- miss_index)
  plot_2nd$tree_positions <- plot_2nd$tree_positions |>
    dplyr::arrange(tree_id) |>
    dplyr::slice(- miss_index)
  ## Matching works with both styles in this example
  match_trees_on_plot_repsurv_ccirc(
    plot_1st, plot_2nd, tree_id_style = "baysf"
  )
  match_trees_on_plot_repsurv_ccirc(
    plot_1st, plot_2nd, tree_id_style = "generic"
  )


  # Special case: First survey has no trees (all ingrowth)

  ## Construct an artifical example
  plot_1st <- ForestElementsR::spruce_pine_ccircle_spatial_notrees
  plot_2nd <- ForestElementsR::spruce_pine_ccircle_spatial

  ## Matching works with both styles in this example
  match_trees_on_plot_repsurv_ccirc(
    plot_1st, plot_2nd, tree_id_style = "baysf"
  )
  match_trees_on_plot_repsurv_ccirc(
    plot_1st, plot_2nd, tree_id_style = "generic"
  )


  # Special case: Second survey has no trees (all felled)

  ## Construct an artifical example
  plot_1st <- ForestElementsR::spruce_pine_ccircle_spatial
  plot_2nd <- ForestElementsR::spruce_pine_ccircle_spatial_notrees

  ## Matching works with both styles in this example
  match_trees_on_plot_repsurv_ccirc(
    plot_1st, plot_2nd, tree_id_style = "baysf"
  )
  match_trees_on_plot_repsurv_ccirc(
    plot_1st, plot_2nd, tree_id_style = "generic"
  )



Check for missing values in important columns of the tree list

Description

Check for missing values in important columns of the tree list

Usage

missing_checks(tree_list)

Arguments

tree_list

variable containing the the tree list

Value

The input tree_list unchanged when all checks pass. Stops with an informative error message if any checked column contains NA values, listing the affected plot_ids.


Constructor for the fe_inventory Class

Description

Should be used by expert users only who know exactly what they are doing. Other users, please take the function fe_inventory for creating an object of that class.

Usage

new_fe_inventory(x = tibble::tibble(), ..., class = character())

Arguments

x

an appropriate tibble object

...

additional arguments required for enabling subclasses of fe_inventory

class

a character string required for anabling subclasses of fe_inventory

Value

An object of class fe_stand


Format Base Tables for Output (Basistabellen)

Description

Format Base Tables for Output (Basistabellen)

Usage

output_base_table(base_table)

Arguments

base_table

the output from either base_table_d_q_class, base_table_age_class, base_table_d_q_class_main_stand, or base_table_age_class_main_stand

Value

A data frame containing aggregated information by species group, classified by age or dq class (rows)

Attached attributes

The returned object carries a class_type attribute ("age" or "dq") recording its class axis, and propagates the tree_selection attribute set by the *_table_*() functions. output_base_table_pdf / output_structure_table_pdf read both (via the internal helper .table_pdf_meta) instead of taking a type or a cohort/layer argument.

See Also

Other inventory tables: base_table_age_class(), base_table_age_class_main_stand(), base_table_d_q_class(), base_table_d_q_class_main_stand(), output_increment_overall(), output_structure_table(), structure_table_age_class(), structure_table_age_class_main_stand(), structure_table_d_q_class(), structure_table_d_q_class_main_stand()

Examples

# The prepared tree list ships with the package; see
# ?data_ex3_trees_essentials for the chain that builds it.
trees_complete <- data_ex3_sample_trees_essentials

base_table  <- trees_complete |>
   base_table_age_class_main_stand()

base_table |> output_base_table()


Render an Output Base Table in PDF Format

Description

Transform an inventory output base table as generated by output_base_table into a pdf file that can be exported or displayed.

Usage

output_base_table_pdf(
  x,
  tab_title,
  output_dir = NA,
  meta = NULL,
  inventory = NULL,
  language = c("ger")
)

Arguments

x

Input object, must be an output base table as generated with output_base_table

tab_title

Character, used for the table title and the file name.

output_dir

Path to the directory where the information sheet will be stored in. Default is NA; in this case, the file will be written into the temporary directory of the current R session. This directory will, however, only available as long as the session is going on.

meta

Optional named list with inventory meta-information to display above the table. Recognised names: year (inventory year, integer), area_ha (total area in ha, numeric), n_plots (number of inventory points, integer). Any or all elements may be omitted or NULL. When meta is NULL (default) no meta block is rendered - unless inventory is supplied (see below).

inventory

Optional fe_inventory object. A convenience shortcut for the meta block: when meta is NULL and inventory is given, the meta list is derived automatically via inventory_meta. An explicit meta always takes precedence.

language

Language of the rendered output. Currently only "ger" (German) is implemented and accepted; passing any other value raises an error. Future languages will be added as separate template files (one template per language, keeping each template linguistically consistent).

Details

The user must make sure that the input object x has been generated with output_base_table, because the function does not check that. For other objects the function will either produce an error or at least strange results.

The file name is assembled as output_base_table_ger_<tab_title>_<type>_<cohort>.pdf. The <cohort> tag identifies the tree cohort the table represents and is taken from the tag the base_table_*() functions attach to their result ("mainstand" for the *_main_stand() functions, "alllayers" for the general functions called with their default tree_filter, or a sanitised form of a custom tree_filter expression). This keeps the four standard variants (main stand / all layers \times age / diameter classes) in separate, self-describing files instead of overwriting one another.

The class axis (<type>, age or dq) is likewise read off the object (the class_type attribute stamped by output_base_table), and the same cohort tag also selects the disclaimer note below the table (main-stand note, all-layers note, or - for a custom tree_filter - a plain "Benutzerdefinierte Auswahl" subtitle without a note). Neither is a function argument any longer, so they can no longer be set inconsistently with the actual table content.

Value

The path to the rendered pdf file

See Also

The stages that produce this function's input: output_base_table, fed by one of the four base tables base_table_age_class, base_table_age_class_main_stand, base_table_d_q_class, and base_table_d_q_class_main_stand. The structure-table counterpart of this function is output_structure_table_pdf.

Other pdf_output: check_pdf_dependencies(), output_increment_base_table_pdf(), output_increment_overall_pdf(), output_increment_overview_gnfi3_pdf(), output_increment_overview_ytables_pdf(), output_structure_table_pdf(), pdf_dependencies, plot_info_sheet_pdf()

Examples


# Build the table (the species cast warnings are a natural side effect of
# the required species grouping)
base_tab <- data_ex3_sample_trees_essentials |>
  base_table_age_class_main_stand() |>
  output_base_table()

# Render it; output_dir defaults to tempdir(), which is what we want here
pdf_path <- output_base_table_pdf(base_tab, "example_ex3")
basename(pdf_path)


Format Increment Base Tables for Output

Description

Increment counterpart of output_base_table. It restructures the four-element increment base table into the same display layout (variables to rows, age or diameter classes to columns, plus the appended “Summe” cross-species block) used for the static base tables.

Usage

output_increment_base_table(increment_base_table)

Arguments

increment_base_table

the output from either increment_base_table or increment_base_table_main_stand

Details

Because the increment base tables share the exact four-element layout (list(detail, total, all_species, all_total)) and the same species_group / class-column convention as the static ones, this function reuses the generic restructuring of output_base_table. It is exposed as its own increment-family entry point so the increment output API stays discoverable and can diverge later (e.g. combining a value with its confidence interval) without touching the static side.

Value

A data frame with one row per species group and variable, the class levels as columns plus a total column, and the cross-species “Summe” block appended at the bottom (tagged with an NA species_group). The input's collective descriptor and its meta element are carried through as "collective" and "meta" attributes on the returned data frame, so the PDF step can label the collective (Hauptbestand / Alle Schichten / custom) and fill the header meta block without re-deriving them from the columns.

See Also

Other increment: harmonize_inv_for_repsurv(), increment_base_table(), increment_base_table_main_stand(), increment_ytables_base_table(), inv_inc_big_overview(), inv_inc_big_overview_2nd_only(), inv_inc_big_overview_matches_only(), inv_inc_fill_gaps_gnfi3(), inv_inc_summaric(), inv_inc_tree_2_plot(), inv_inc_tree_consolidate(), inv_inc_tree_extend(), inv_inc_tree_extend_combined(), inv_increment_gnfi3(), inv_increment_repeated_survey(), inv_increment_repsurv_ccirc(), inv_increment_ytables(), is_fe_increment_repsurv(), match_2_inventories(), match_2_inventories_by_center_coord(), match_2_inventories_by_plot_id(), match_plot_statistics(), match_trees_on_inventory_repsurv_ccirc(), match_trees_on_plot_repsurv_ccirc(), output_increment_base_table_pdf(), output_increment_overall(), output_increment_overall_pdf(), output_increment_overview_gnfi3(), output_increment_overview_gnfi3_pdf(), output_increment_overview_ytables_pdf(), reclassify_pseudo_ingrowth_ccirc(), tree_inc_repsurv()

Examples

  inv_b <- data_ex3_sample_fe_inventory
  inv_b_trees <- data_ex3_sample_trees_essentials

  inc <- inv_increment_gnfi3(inv_b, inv_b_trees)

  # Plain and main-stand increment base tables, restructured for output
  increment_base_table(inc, by_class = "age") |>
    output_increment_base_table()

  increment_base_table_main_stand(inc, by_class = "age") |>
    output_increment_base_table()


Render an Increment Base Table in PDF Format

Description

Increment counterpart of output_base_table_pdf. Turns the restructured increment base table from output_increment_base_table into a formatted PDF, using the unified header (Forstbetrieb name, collective line, meta line) modelled on the increment overview PDFs.

Usage

output_increment_base_table_pdf(
  x,
  tab_title,
  type = c("age", "dq"),
  output_dir = NA,
  meta = NULL,
  collective = NULL,
  ytables_used = NULL,
  language = c("ger")
)

Arguments

x

Input object, the output of output_increment_base_table. Its "collective" attribute is used unless collective is given.

tab_title

Character; the Forstbetrieb (or collective) name shown prominently in the header and used for the file name.

type

Character, "age" (default) or "dq", must match how the table was built. Used for the subtitle, the class-column header and the file name.

output_dir

Path to the directory the PDF is written to. Default NA: the R session's temporary directory (gone when the session ends).

meta

Optional named list with inventory meta-information for the header meta block. Recognised names: year (current inventory year), area_ha (total area in ha), n_plots (number of inventory points). For repeated-inventory increments the block additionally shows, if present, inv_year_prev (previous inventory year), period_yr (period length in years), method (Berechnungsmethode) and fill_option (Ergänzungsmethode) – the same block as the “Zuwachs auf Betriebsebene” overview PDF. Any name may be omitted. NULL (default) uses the "meta" attribute that the increment pipeline carries on x (assembled in inv_inc_tree_extend for a repeated inventory); pass a list to override it, or when the source carries none.

collective

Optional collective descriptor list (kind/label/definition) overriding the one carried on x. NULL (default) uses attr(x, "collective"); if that is also absent, an “Alle Schichten” collective is assumed.

ytables_used

Optional data frame of the yield tables used (columns species_group, name_orig), printed as a “Verwendete Ertragstafeln” list below the table (one row per table). NULL (default) uses attr(x, "ytables_used"), which the yield-table class tables carry; for the repeated-survey and gnfi3 tables it is absent and nothing is printed.

language

Language of the rendered output. Currently only "ger" is implemented and accepted; other values raise an error. Future languages are added as separate template files.

Details

The header is built in four parts: the table title, the prominent Forstbetrieb name (tab_title) right below it, and a flushleft meta block modelled on the “Zuwachs auf Betriebsebene” overview PDF – a collective line (“Hauptbestand” / “Alle Schichten” / “Benutzerdefiniertes Kollektiv: ...”) taken from the table's collective descriptor, followed by the inventory meta (year, area, point count and, for repeated inventories, the previous inventory year, period, Berechnungsmethode and Ergänzungsmethode). A footnote states whether the table is restricted to the main stand (a partial collective that allows virtual per-species hectare areas) or not.

The user must make sure that x was produced by output_increment_base_table; the function does not check that.

Value

The path to the rendered PDF file.

See Also

Other increment: harmonize_inv_for_repsurv(), increment_base_table(), increment_base_table_main_stand(), increment_ytables_base_table(), inv_inc_big_overview(), inv_inc_big_overview_2nd_only(), inv_inc_big_overview_matches_only(), inv_inc_fill_gaps_gnfi3(), inv_inc_summaric(), inv_inc_tree_2_plot(), inv_inc_tree_consolidate(), inv_inc_tree_extend(), inv_inc_tree_extend_combined(), inv_increment_gnfi3(), inv_increment_repeated_survey(), inv_increment_repsurv_ccirc(), inv_increment_ytables(), is_fe_increment_repsurv(), match_2_inventories(), match_2_inventories_by_center_coord(), match_2_inventories_by_plot_id(), match_plot_statistics(), match_trees_on_inventory_repsurv_ccirc(), match_trees_on_plot_repsurv_ccirc(), output_increment_base_table(), output_increment_overall(), output_increment_overall_pdf(), output_increment_overview_gnfi3(), output_increment_overview_gnfi3_pdf(), output_increment_overview_ytables_pdf(), reclassify_pseudo_ingrowth_ccirc(), tree_inc_repsurv()

Other pdf_output: check_pdf_dependencies(), output_base_table_pdf(), output_increment_overall_pdf(), output_increment_overview_gnfi3_pdf(), output_increment_overview_ytables_pdf(), output_structure_table_pdf(), pdf_dependencies, plot_info_sheet_pdf()

Examples


# A gnfi3 increment of the ex3 inventory; the ready-made tree list is
# shipped with the package, so the height chain does not have to be run
inc <- inv_increment_gnfi3(
  data_ex3_sample_fe_inventory, data_ex3_sample_trees_essentials
)

bt <- increment_base_table_main_stand(inc, by_class = "age") |>
  output_increment_base_table()

# output_dir defaults to tempdir()
pdf_path <- output_increment_base_table_pdf(
  bt,
  tab_title = "Forstbetrieb Beispiel",
  meta      = list(year = 2024, area_ha = 1234, n_plots = 42)
)
basename(pdf_path)


Restructure an Increment Big-Overview Into a Render-Ready Object

Description

Companion to inv_inc_big_overview: takes its rich multi-list output and produces a render-ready intermediate object that downstream functions (output_increment_overall_pdf, Shiny tables, csv exports) can consume without redoing the restructuring.

Usage

output_increment_overall(
  bo,
  fill_option = c("standard", "min_estimates", "all_estimates"),
  user_subtitle = NULL
)

Arguments

bo

Either an fe_increment_repsurv bundle, the output of inv_increment_repeated_survey (the usual case – its overview element is taken from it, and fill_option defaults to the one the bundle was built with), or a bare inv_inc_big_overview result.

fill_option

Which matched fill_option to display in the "Single-tree based" block of table_matched and the matching column block of table_combined. Default "standard" – the practical recommendation. The "Summaric / Yield-history" block always uses the inc_summaric row from the matched overview.

user_subtitle

Optional character giving an extra subtitle for the output (e.g. "Forstbetrieb Neustadt"). Default NULL.

Details

The intermediate object collects three parallel tables – one for matched plots, one for second-only plots, one for the combined enterprise view – with identical column shape. This lets the renderer stack them vertically with column-aligned numbers. CI95 columns are present in all three tables but only filled for the matches_only table; the gnfi3-based second_only and combined contributions stay empty by contract (NA) because their per-plot scatter is a model artefact and an empirical CI would mislead.

Language is deliberately a render-time concern, not a restructuring-time one: the species_group column is passed through as the original fe_species_* S3 vector, and the rendering layer (output_increment_overall_pdf or any alternative consumer) sets options(fe_spec_lang = ...) plus format() to choose the display language. This keeps the intermediate object reusable for multi-language exports from the same data.

Value

A list with the elements:

meta

A list with title (named character vector indexed by language code), user_subtitle, method (the increment method, pulled from bo$method), fill_option, inv_year_prev, inv_year_curr, period_yr, and plot_match_stats (a list with n_total_2nd, n_matched, n_2nd_only, area_total_2nd_ha, area_matched_ha, area_2nd_only_ha).

table_matched

One row per species_group plus a summary row (is_total_row = TRUE), with the eight numeric columns described below.

table_2nd_only

Same column shape as table_matched. The "Single-tree based" block holds the gnfi3-backward estimate; the "Summaric" block is all NA (there is no yield-history balance for plots with only one observation).

table_combined

Same column shape; columns hold the per-row sum of table_matched and table_2nd_only. All CI95 columns are NA.

The eight numeric columns in each table: iv_m3_yr_total_st, ci95_iv_m3_yr_total_st, iv_m3_ha_yr_st, ci95_iv_m3_ha_yr_st for the single-tree block; suffix _sum (for "summaric") on the same four for the yield-history block.

See Also

Other inventory tables: base_table_age_class(), base_table_age_class_main_stand(), base_table_d_q_class(), base_table_d_q_class_main_stand(), output_base_table(), output_structure_table(), structure_table_age_class(), structure_table_age_class_main_stand(), structure_table_d_q_class(), structure_table_d_q_class_main_stand()

Other increment: harmonize_inv_for_repsurv(), increment_base_table(), increment_base_table_main_stand(), increment_ytables_base_table(), inv_inc_big_overview(), inv_inc_big_overview_2nd_only(), inv_inc_big_overview_matches_only(), inv_inc_fill_gaps_gnfi3(), inv_inc_summaric(), inv_inc_tree_2_plot(), inv_inc_tree_consolidate(), inv_inc_tree_extend(), inv_inc_tree_extend_combined(), inv_increment_gnfi3(), inv_increment_repeated_survey(), inv_increment_repsurv_ccirc(), inv_increment_ytables(), is_fe_increment_repsurv(), match_2_inventories(), match_2_inventories_by_center_coord(), match_2_inventories_by_plot_id(), match_plot_statistics(), match_trees_on_inventory_repsurv_ccirc(), match_trees_on_plot_repsurv_ccirc(), output_increment_base_table(), output_increment_base_table_pdf(), output_increment_overall_pdf(), output_increment_overview_gnfi3(), output_increment_overview_gnfi3_pdf(), output_increment_overview_ytables_pdf(), reclassify_pseudo_ingrowth_ccirc(), tree_inc_repsurv()

Examples


# Matching and gap filling of the ex3 pair are shipped ready-made, so the
# overall figures can be built without running the whole chain first.
inv_b       <- data_ex3_sample_fe_inventory
inv_a_trees <- data_ex3_previous_sample_trees_essentials
inv_b_trees <- data_ex3_sample_trees_essentials
inc_rep     <- data_ex3_increment_matched
inc_fl      <- data_ex3_increment_fills

inc_sum <- inv_inc_summaric(
  inc_rep$tree_increments, inc_fl$fills_forward, inv_a_trees, inv_b_trees
)
bo <- inv_inc_big_overview(
  inc_fl, inv_a_trees, inv_b_trees, inv_b,
  style = "generic", inc_summaric = inc_sum
)

out <- output_increment_overall(
  bo,
  fill_option   = "standard",
  user_subtitle = "Forstbetrieb Neustadt"
)
str(out, max.level = 2)


Render an Increment Overview Table in PDF Format

Description

Thin wrapper around rmarkdown::render() that turns the restructured intermediate from output_increment_overall into a nicely formatted PDF. The intermediate's meta block drives the title, survey-year line, plot-match summary, and the fill_option subtitle; the three tibbles (table_matched, table_2nd_only, table_combined) are rendered stacked below with shared column shape and decimal-point-bound numbers.

Usage

output_increment_overall_pdf(x, output_dir = NA, language = c("ger"))

Arguments

x

Input object, must be the output of output_increment_overall.

output_dir

Path to the directory where the PDF will be written. Default NA; in this case the file goes into the R session's temporary directory and is gone when the session ends.

language

Language of the rendered output. Currently only "ger" (German) is implemented and accepted; passing any other value raises an error. An English variant is planned and will be added as a separate template (output_increment_overall_template_eng.Rmd), keeping each template linguistically consistent rather than scattering if-switches across one template.

Details

The user must make sure that the input object x has been generated with output_increment_overall; the function does not check that. Other objects will either produce an error or strange results.

Value

The path to the rendered PDF file.

See Also

Other pdf_output: check_pdf_dependencies(), output_base_table_pdf(), output_increment_base_table_pdf(), output_increment_overview_gnfi3_pdf(), output_increment_overview_ytables_pdf(), output_structure_table_pdf(), pdf_dependencies, plot_info_sheet_pdf()

Other increment: harmonize_inv_for_repsurv(), increment_base_table(), increment_base_table_main_stand(), increment_ytables_base_table(), inv_inc_big_overview(), inv_inc_big_overview_2nd_only(), inv_inc_big_overview_matches_only(), inv_inc_fill_gaps_gnfi3(), inv_inc_summaric(), inv_inc_tree_2_plot(), inv_inc_tree_consolidate(), inv_inc_tree_extend(), inv_inc_tree_extend_combined(), inv_increment_gnfi3(), inv_increment_repeated_survey(), inv_increment_repsurv_ccirc(), inv_increment_ytables(), is_fe_increment_repsurv(), match_2_inventories(), match_2_inventories_by_center_coord(), match_2_inventories_by_plot_id(), match_plot_statistics(), match_trees_on_inventory_repsurv_ccirc(), match_trees_on_plot_repsurv_ccirc(), output_increment_base_table(), output_increment_base_table_pdf(), output_increment_overall(), output_increment_overview_gnfi3(), output_increment_overview_gnfi3_pdf(), output_increment_overview_ytables_pdf(), reclassify_pseudo_ingrowth_ccirc(), tree_inc_repsurv()

Examples


# See output_increment_overall() for what the intermediate is built from;
# matching and gap filling of the ex3 pair are shipped ready-made.
inv_b       <- data_ex3_sample_fe_inventory
inv_a_trees <- data_ex3_previous_sample_trees_essentials
inv_b_trees <- data_ex3_sample_trees_essentials
inc_rep     <- data_ex3_increment_matched
inc_fl      <- data_ex3_increment_fills

inc_sum <- inv_inc_summaric(
  inc_rep$tree_increments, inc_fl$fills_forward, inv_a_trees, inv_b_trees
)
bo <- inv_inc_big_overview(
  inc_fl, inv_a_trees, inv_b_trees, inv_b,
  style = "generic", inc_summaric = inc_sum
)
out <- output_increment_overall(
  bo,
  fill_option   = "standard",
  user_subtitle = "Forstbetrieb Neustadt"
)

# output_dir defaults to tempdir()
pdf_path <- output_increment_overall_pdf(out)
basename(pdf_path)


Restructure a gnfi3 Single-Inventory Increment Overview for Output

Description

Builds the species-level increment overview for the increment estimated from a single inventory with the tree growth functions of the Third German National Forest Inventory (gnfi3). The layout corresponds to table B of output_increment_overall: one row per species group plus a total row, each carrying the annual volume increment as an absolute total (zv_m3_yr) and per hectare (zv_m3_ha_yr). Confidence intervals are not reported here – consistent with the package-wide convention that the gnfi3 estimate carries no empirical confidence interval (unlike the repeated survey).

Usage

output_increment_overview_gnfi3(increment_base_table)

Arguments

increment_base_table

A gnfi3 increment base table, the output of increment_base_table (or increment_base_table_main_stand) built from a single-inventory source (inv_increment_gnfi3). Its total and all_total elements drive the overview.

Details

Like the increment base tables, this is the language-neutral intermediate; species_group stays an fe_species_* vector so the render step decides the language. The table's collective descriptor is carried through as a "collective" attribute.

Value

A tibble with one row per species group plus a total row, the columns species_group, is_total_row, zv_m3_yr and zv_m3_ha_yr, and a "collective" attribute carried over from the input.

See Also

Other increment: harmonize_inv_for_repsurv(), increment_base_table(), increment_base_table_main_stand(), increment_ytables_base_table(), inv_inc_big_overview(), inv_inc_big_overview_2nd_only(), inv_inc_big_overview_matches_only(), inv_inc_fill_gaps_gnfi3(), inv_inc_summaric(), inv_inc_tree_2_plot(), inv_inc_tree_consolidate(), inv_inc_tree_extend(), inv_inc_tree_extend_combined(), inv_increment_gnfi3(), inv_increment_repeated_survey(), inv_increment_repsurv_ccirc(), inv_increment_ytables(), is_fe_increment_repsurv(), match_2_inventories(), match_2_inventories_by_center_coord(), match_2_inventories_by_plot_id(), match_plot_statistics(), match_trees_on_inventory_repsurv_ccirc(), match_trees_on_plot_repsurv_ccirc(), output_increment_base_table(), output_increment_base_table_pdf(), output_increment_overall(), output_increment_overall_pdf(), output_increment_overview_gnfi3_pdf(), output_increment_overview_ytables_pdf(), reclassify_pseudo_ingrowth_ccirc(), tree_inc_repsurv()

Examples

  inv_b <- data_ex3_sample_fe_inventory
  inv_b_trees <- data_ex3_sample_trees_essentials

  inc <- inv_increment_gnfi3(inv_b, inv_b_trees)
  increment_base_table(inc, by_class = "age") |>
    output_increment_overview_gnfi3()


Render a gnfi3 Single-Inventory Increment Overview in PDF Format

Description

Renders the overview from output_increment_overview_gnfi3 as a PDF, using the unified header (Forstbetrieb name, collective line, meta line) of the increment table PDFs. The German heading names the method in full (“Zuwachsfunktionen der 3. Bundeswaldinventur”); a footnote states that all volume figures are harvested volume under bark (Erntefestmeter ohne Rinde).

Usage

output_increment_overview_gnfi3_pdf(
  x,
  tab_title,
  output_dir = NA,
  meta = NULL,
  collective = NULL,
  language = c("ger")
)

Arguments

x

The output of output_increment_overview_gnfi3. Its "collective" attribute is used unless collective is given.

tab_title

Character; the Forstbetrieb name shown prominently in the header and used for the file name.

output_dir

Path to the directory the PDF is written to. Default NA: the R session's temporary directory.

meta

Optional named list with header meta-information (year, area_ha, n_plots); see output_increment_base_table_pdf.

collective

Optional collective descriptor overriding the one carried on x.

language

Language of the rendered output. Currently only "ger".

Value

The path to the rendered PDF file.

See Also

Other increment: harmonize_inv_for_repsurv(), increment_base_table(), increment_base_table_main_stand(), increment_ytables_base_table(), inv_inc_big_overview(), inv_inc_big_overview_2nd_only(), inv_inc_big_overview_matches_only(), inv_inc_fill_gaps_gnfi3(), inv_inc_summaric(), inv_inc_tree_2_plot(), inv_inc_tree_consolidate(), inv_inc_tree_extend(), inv_inc_tree_extend_combined(), inv_increment_gnfi3(), inv_increment_repeated_survey(), inv_increment_repsurv_ccirc(), inv_increment_ytables(), is_fe_increment_repsurv(), match_2_inventories(), match_2_inventories_by_center_coord(), match_2_inventories_by_plot_id(), match_plot_statistics(), match_trees_on_inventory_repsurv_ccirc(), match_trees_on_plot_repsurv_ccirc(), output_increment_base_table(), output_increment_base_table_pdf(), output_increment_overall(), output_increment_overall_pdf(), output_increment_overview_gnfi3(), output_increment_overview_ytables_pdf(), reclassify_pseudo_ingrowth_ccirc(), tree_inc_repsurv()

Other pdf_output: check_pdf_dependencies(), output_base_table_pdf(), output_increment_base_table_pdf(), output_increment_overall_pdf(), output_increment_overview_ytables_pdf(), output_structure_table_pdf(), pdf_dependencies, plot_info_sheet_pdf()

Examples


# A gnfi3 increment of the ex3 inventory; the ready-made tree list is
# shipped with the package, so the height chain does not have to be run
ov <- inv_increment_gnfi3(
  data_ex3_sample_fe_inventory, data_ex3_sample_trees_essentials
) |>
  increment_base_table(by_class = "age") |>
  output_increment_overview_gnfi3()

# output_dir defaults to tempdir()
pdf_path <- output_increment_overview_gnfi3_pdf(
  ov, tab_title = "Forstbetrieb Beispiel"
)
basename(pdf_path)


Render a Yield-Table Increment Overview in PDF Format

Description

Renders the overview of an inv_increment_ytables result as a PDF with the unified header (Forstbetrieb name, collective line, meta line). Two tables are shown: the species-group overview (virtual area, mean site index, increment per ha and total) and a listing of the yield tables used per species group. A footnote states that all volumes are harvested volume under bark (Erntefestmeter ohne Rinde) and that the table is restricted to the main stand.

Usage

output_increment_overview_ytables_pdf(
  x,
  tab_title,
  output_dir = NA,
  meta = NULL,
  language = c("ger")
)

Arguments

x

The result of inv_increment_ytables, or any list carrying overview, ytables_used and collective. A bundle also supplies the header figures, so meta can be omitted.

tab_title

Character; the Forstbetrieb name shown prominently in the header and used for the file name.

output_dir

Path to the directory the PDF is written to. Default NA: the R session's temporary directory.

meta

Optional named list with header meta-information (year, area_ha, n_plots).

language

Language of the rendered output. Currently only "ger". The German table uses only the German yield-table names (name_orig).

Value

The path to the rendered PDF file.

See Also

Other increment: harmonize_inv_for_repsurv(), increment_base_table(), increment_base_table_main_stand(), increment_ytables_base_table(), inv_inc_big_overview(), inv_inc_big_overview_2nd_only(), inv_inc_big_overview_matches_only(), inv_inc_fill_gaps_gnfi3(), inv_inc_summaric(), inv_inc_tree_2_plot(), inv_inc_tree_consolidate(), inv_inc_tree_extend(), inv_inc_tree_extend_combined(), inv_increment_gnfi3(), inv_increment_repeated_survey(), inv_increment_repsurv_ccirc(), inv_increment_ytables(), is_fe_increment_repsurv(), match_2_inventories(), match_2_inventories_by_center_coord(), match_2_inventories_by_plot_id(), match_plot_statistics(), match_trees_on_inventory_repsurv_ccirc(), match_trees_on_plot_repsurv_ccirc(), output_increment_base_table(), output_increment_base_table_pdf(), output_increment_overall(), output_increment_overall_pdf(), output_increment_overview_gnfi3(), output_increment_overview_gnfi3_pdf(), reclassify_pseudo_ingrowth_ccirc(), tree_inc_repsurv()

Other pdf_output: check_pdf_dependencies(), output_base_table_pdf(), output_increment_base_table_pdf(), output_increment_overall_pdf(), output_increment_overview_gnfi3_pdf(), output_structure_table_pdf(), pdf_dependencies, plot_info_sheet_pdf()

Examples


# FeNEU's own yield-table collection covers all current bavrn_state
# species codes; the ForestElementsR collection does not.
inc <- inv_increment_ytables(
  data_ex3_sample_fe_inventory,
  data_ex3_sample_trees_essentials,
  ytables_bavrn_state_var_1_feneu
)

# output_dir defaults to tempdir()
pdf_path <- output_increment_overview_ytables_pdf(
  inc, tab_title = "Forstbetrieb Beispiel"
)
basename(pdf_path)


Format Structure Tables for Output (Strukturtabellen)

Description

A data frame with group-wise aggregated inventory information separated per species is returned.

Usage

output_structure_table(structure_table)

Arguments

structure_table

structure table generated from structure_table_d_q_class_main_stand, structure_table_age_class_main_stand, structure_table_d_q_class, or structure_table_age_class. This is a list with detail, total, all_species, all_total, species_total, species_dbh_total, grand_total, and grand_dbh_total data frames; a bare detail data frame is also accepted (in which case no cross-species "Summe" block or "Summe" rows are added, and the total column uses rowSums).

Value

A data frame containing aggregated information by species group, separated by age or dq class (rows) and classified by single tree diameter class (columns). When all_species is supplied, a trailing cross-species "Summe" group (with an NA species group) is appended. When species_total is supplied, each species' block gets its own trailing "Summe" row (grand total across all classes and dbh classes for that species); when species_dbh_total is also supplied, that same row's dbh_class columns are filled with the species' per-dbh_class sums/ weighted means across all classes (mirroring BaySF's own report), rather than being left blank. When grand_total/grand_dbh_total are supplied, the cross-species "Summe" block gets the equivalent trailing "Summe" row - the true grand total across every species, class, and dbh class combined.

Attached attributes

The returned object carries a class_type attribute ("age" or "dq") recording its class axis, and propagates the tree_selection attribute set by the *_table_*() functions. output_base_table_pdf / output_structure_table_pdf read both (via the internal helper .table_pdf_meta) instead of taking a type or a cohort/layer argument.

See Also

Other inventory tables: base_table_age_class(), base_table_age_class_main_stand(), base_table_d_q_class(), base_table_d_q_class_main_stand(), output_base_table(), output_increment_overall(), structure_table_age_class(), structure_table_age_class_main_stand(), structure_table_d_q_class(), structure_table_d_q_class_main_stand()

Examples

# The prepared tree list ships with the package; see
# ?data_ex3_trees_essentials for the chain that builds it. Three inventory
# points are enough to show the shape of the result, and they keep the
# example quick; the function takes a whole tree list alike.
trees_complete <- data_ex3_sample_trees_essentials |>
  dplyr::filter(plot_id %in% unique(plot_id)[1:3])

structure_table <- trees_complete |>
   structure_table_age_class_main_stand()

structure_table |> output_structure_table()


Render an Output Structure Table in PDF Format

Description

Transform an inventory output structure table as generated by output_structure_table into a pdf file that can be exported or displayed.

Usage

output_structure_table_pdf(
  x,
  tab_title,
  output_dir = NA,
  meta = NULL,
  inventory = NULL,
  language = c("ger")
)

Arguments

x

Input object, must be an output structure table as generated with output_structure_table

tab_title

Character, used for the table title and the file name.

output_dir

Path to the directory where the information sheet will be stored in. Default is NA; in this case, the file will be written into the temporary directory of the current R session. This directory will, however, only available as long as the session is going on.

meta

Optional named list with inventory meta-information to display above the table. Recognised names: year (inventory year, integer), area_ha (total area in ha, numeric), n_plots (number of inventory points, integer). Any or all elements may be omitted or NULL. When meta is NULL (default) no meta block is rendered - unless inventory is supplied (see below).

inventory

Optional fe_inventory object. A convenience shortcut for the meta block: when meta is NULL and inventory is given, the meta list is derived automatically via inventory_meta. An explicit meta always takes precedence. Supplying inventory additionally guards against nonsensical output: structure tables are only meaningful for sample (concentric-circle) inventories, so a standwise / stand-level inventory (any plot that is not an fe_ccircle_spatial) is rejected with a clear error.

language

Language of the rendered output. Currently only "ger" (German) is implemented and accepted; passing any other value raises an error. Future languages will be added as separate template files (one template per language, keeping each template linguistically consistent).

Details

The user must make sure that the input object x has been generated with output_structure_table, because the function does not check that. For other objects the function will either produce an error or at least strange results.

The file name is assembled as output_structure_table_ger_<tab_title>_<type>_<cohort>.pdf. The <cohort> tag identifies the tree cohort the table represents and is taken from the tag the structure_table_*() functions attach to their result ("mainstand" for the *_main_stand() functions, "alllayers" for the general functions called with their default tree_filter, or a sanitised form of a custom tree_filter expression). This keeps the four standard variants (main stand / all layers \times age / diameter classes) in separate, self-describing files instead of overwriting one another.

The class axis (<type>, age or dq) is likewise read off the object (the class_type attribute stamped by output_structure_table), and the same cohort tag also selects the disclaimer note (main-stand note, all-layers note, or - for a custom tree_filter - a plain "Benutzerdefinierte Auswahl" subtitle without a note). Neither is a function argument any longer, so they can no longer be set inconsistently with the actual table content.

Value

The path to the rendered pdf file

See Also

The stages that produce this function's input: output_structure_table, fed by one of the four structure tables structure_table_age_class, structure_table_age_class_main_stand, structure_table_d_q_class, and structure_table_d_q_class_main_stand. The base-table counterpart of this function is output_base_table_pdf.

Other pdf_output: check_pdf_dependencies(), output_base_table_pdf(), output_increment_base_table_pdf(), output_increment_overall_pdf(), output_increment_overview_gnfi3_pdf(), output_increment_overview_ytables_pdf(), pdf_dependencies, plot_info_sheet_pdf()

Examples


# Build the table (the species cast warnings are a natural side effect of
# the required species grouping)
structure_tab <- data_ex3_sample_trees_essentials |>
  structure_table_age_class_main_stand() |>
  output_structure_table()

# Render it; output_dir defaults to tempdir(), which is what we want here
pdf_path <- output_structure_table_pdf(structure_tab, "example_ex3")
basename(pdf_path)


Setup for PDF Output Functions

Description

The ⁠*_pdf()⁠ functions in FeNEU render their tables through rmarkdown + kableExtra on top of pandoc and a LaTeX distribution. Pandoc and LaTeX are not R packages; they are external tools that must be installed once per machine.

R packages

The R-side dependencies are listed as Suggests in the FeNEU ⁠DESCRIPTION⁠. They are not pulled in by install.packages("FeNEU"); users who want PDF output must install them explicitly:

install.packages(c("rmarkdown", "kableExtra", "tinytex"))

pandoc

LaTeX

Diagnostic

To verify the environment before rendering a first PDF:

rmarkdown::pandoc_available()    # pandoc on PATH?
rmarkdown::pandoc_version()      # which version?
tinytex::is_tinytex()            # tinytex installed?
Sys.which("pdflatex")            # latex on PATH?

See Also

Other pdf_output: check_pdf_dependencies(), output_base_table_pdf(), output_increment_base_table_pdf(), output_increment_overall_pdf(), output_increment_overview_gnfi3_pdf(), output_increment_overview_ytables_pdf(), output_structure_table_pdf(), plot_info_sheet_pdf()

Examples

# See whether everything is in place to render a FeNEU PDF
rmarkdown::pandoc_available()
requireNamespace("kableExtra", quietly = TRUE)

Aggregate Inventory Data on Plot Level for Yield Table Application

Description

The aggregation includes only the main stand (layer key 1 and non-removal trees).

Usage

plot_agg_for_yt(x)

Arguments

x

Tree data frame as pulled from an fe_inventory object after height completion (height_complete_inventory), and applying trees_add_essentials.

Details

One cohort is one species on one inventory plot: a yield-table increment is estimated for the main stand of a plot, split into the ideal (virtual monospecific) area of each species. Such a cohort has one age and one quadratic mean diameter by construction, so the class a report groups by is a label attached to the cohort, never part of its definition. Both labels are therefore carried here, and the estimate is the same whichever of them a table is later grouped by.

Value

An aggregated data frame with the plot level information required for applying yield tables, one row per plot and species, carrying both age_class and d_q_class.


Aggregate 3rd German NFI Tree Increment Estimates on Inventory Plot Level

Description

Single tree increments area aggregated to ha values per species group and layer on plot level (but NOT ha values on species group level)

Usage

plot_inc_gnfi_2012(x)

Arguments

x

A data frame generated with tree_inc_gnfi_2012

Value

A data frame representing a plot level aggregation of the single tree level input x


Render an Information Sheet for an Inventory Plot as a PDF File

Description

Render an Information Sheet for an Inventory Plot as a PDF File

Usage

plot_info_sheet_pdf(
  x,
  title = NA,
  output_dir = NA,
  dbh_scale = 4,
  language = c("ger")
)

Arguments

x

An object of class fe_ccircle_spatial

title

id or name for the title of the plot and file. Default is NA, which means that the entry stand_id of the input object x will be used. The actual file name will be "plot_info_ger_" followed by title and the appendix ".pdf".

output_dir

Path to the directory where the information sheet will be stored in. Default is NA; in this case, the file will be written into the temporary directory of the current R session. This directory will, however, only available as long as the session is going on.

dbh_scale

Factor for oversizing the trees' dbh in the plot

language

Language of the rendered output. Currently only "ger" (German) is implemented and accepted; passing any other value raises an error. Future languages will be added as separate template files (one template per language, keeping each template linguistically consistent).

Value

The path to the rendered output file

See Also

Other pdf_output: check_pdf_dependencies(), output_base_table_pdf(), output_increment_base_table_pdf(), output_increment_overall_pdf(), output_increment_overview_gnfi3_pdf(), output_increment_overview_ytables_pdf(), output_structure_table_pdf(), pdf_dependencies

Examples


# One info sheet for the first inventory point of ex3.
# output_dir defaults to tempdir().
file_path <- data_ex3_sample_fe_inventory$plot[[1]] |>
  plot_info_sheet_pdf()
basename(file_path)

# Several sheets in one go (not run here -- one render per plot)
# data_ex3_sample_fe_inventory$plot[1:10] |> lapply(plot_info_sheet_pdf)


Print an fe_increment_gnfi3 Object

Description

Print an fe_increment_gnfi3 Object

Usage

## S3 method for class 'fe_increment_gnfi3'
print(x, ...)

Arguments

x

An fe_increment_gnfi3 object

...

Other parameters (not used)

Value

x, invisibly

Examples

  inv_increment_gnfi3(
    data_ex3_sample_fe_inventory, data_ex3_sample_trees_essentials
  )


Print an fe_increment_repsurv Object

Description

Print an fe_increment_repsurv Object

Usage

## S3 method for class 'fe_increment_repsurv'
print(x, ...)

Arguments

x

An inv_increment_repeated_survey result.

...

Not used.

Value

x, invisibly.


Print an fe_increment_ytables Object

Description

Print an fe_increment_ytables Object

Usage

## S3 method for class 'fe_increment_ytables'
print(x, ...)

Arguments

x

An fe_increment_ytables object

...

Other parameters (not used)

Value

x, invisibly

Examples

  inv_increment_ytables(
    data_ex3_sample_fe_inventory, data_ex3_sample_trees_essentials,
    ytables_bavrn_state_var_1_feneu
  )


Sample Inventory Trees With Estimated Heights (Bavarian)

Description

Sample Inventory Trees With Estimated Heights (Bavarian)

Details

These data is mainly provided for internal testing. It is a tibble that has been created by applying height_complete_inventory to the pulled tree data frame processed_pulled_sub10, with the Bavarian standard height curve system (see h_standard_bv).

See Also

Other example data: data_ex1_sample_raw, data_ex2_sample_raw, data_ex3_increment_interim, data_ex3_previous_sample_fe_inventory, data_ex3_sample_fe_inventory, data_ex3_trees_essentials, data_ex4_previous_sample_fe_inventory, data_ex4_sample_fe_inventory, data_ex5_previous_sample_fe_inventory, data_ex5_sample_fe_inventory, data_ex6_standwise_fe_inventory, data_ex7_standwise_fe_inventory, data_examples_overview, inc_sub10_rep_classic, inc_sub10_rep_end, inc_sub10_rep_mean, inc_sub10_rep_trans, processed_heights_nfi_sub10, processed_pulled_sub10


Sample Inventory Trees With Estimated Heights (NFI)

Description

Sample Inventory Trees With Estimated Heights (NFI)

Details

These data is mainly provided for internal testing. It is a tibble that has been created by applying height_complete_inventory to the pulled tree data frame processed_pulled_sub10, with the German National Forest Inventory (NFI) standard height curve system ((see h_standard_gnfi3).

See Also

Other example data: data_ex1_sample_raw, data_ex2_sample_raw, data_ex3_increment_interim, data_ex3_previous_sample_fe_inventory, data_ex3_sample_fe_inventory, data_ex3_trees_essentials, data_ex4_previous_sample_fe_inventory, data_ex4_sample_fe_inventory, data_ex5_previous_sample_fe_inventory, data_ex5_sample_fe_inventory, data_ex6_standwise_fe_inventory, data_ex7_standwise_fe_inventory, data_examples_overview, inc_sub10_rep_classic, inc_sub10_rep_end, inc_sub10_rep_mean, inc_sub10_rep_trans, processed_heights_bav_sub10, processed_pulled_sub10


Example Inventory as Pulled Trees (10 inventory points)

Description

Example Inventory as Pulled Trees (10 inventory points)

Details

Mainly provided for internal testing. It is a tibble that has been created by applying pull_trees to the ten-point fe_inventory object data_ex3_sample_fe_inventory.

See Also

Other example data: data_ex1_sample_raw, data_ex2_sample_raw, data_ex3_increment_interim, data_ex3_previous_sample_fe_inventory, data_ex3_sample_fe_inventory, data_ex3_trees_essentials, data_ex4_previous_sample_fe_inventory, data_ex4_sample_fe_inventory, data_ex5_previous_sample_fe_inventory, data_ex5_sample_fe_inventory, data_ex6_standwise_fe_inventory, data_ex7_standwise_fe_inventory, data_examples_overview, inc_sub10_rep_classic, inc_sub10_rep_end, inc_sub10_rep_mean, inc_sub10_rep_trans, processed_heights_bav_sub10, processed_heights_nfi_sub10


Pull Center Point Coordinates From an fe_inventory Object

Description

Pull Center Point Coordinates From an fe_inventory Object

Usage

pull_centers(x)

Arguments

x

An object of class fe_inventory

Value

An object of class sf with the column plot_id as taken from the input object x, and a geometry column that represents each plot's center point. In case the plot column of x does not contain objects that allow to extract meaningful center coordinates the resulting geometry will be empty.

Examples

  data_ex3_sample_fe_inventory |> pull_centers()



Pull Circle Definitions From an fe_inventory Object

Description

Extracts per-plot slope and minimum circle area from the circle definition of an fe_inventory object. Useful for reconstructing small-tree expansion factors or for diagnostic purposes.

Usage

pull_circle_definitions(forest_inventory, .progress = TRUE)

Arguments

forest_inventory

Object of class fe_inventory.

.progress

Logical, if TRUE a progress bar is shown.

Value

Tibble with one row per plot, containing at least plot_id, slope and min_c_area.

Examples

pull_circle_definitions(data_ex3_sample_fe_inventory)

Generate Layer-Wise Stand Sum and Mean Values per Plot of an fe_inventory Object and Hand them Back as a Tibble

Description

Basically, this function calls the function stand_sums_static. According to the behaviour of that function, If the height values provided with an inventory plot are not complete, all output values that require height for calculation (i.e. meam and dominant heights, tree volumes) will be NA.

Usage

pull_sums(forest_inventory, hd_dom_method = "Weise", .progress = TRUE)

Arguments

forest_inventory

An fe_inventory object

hd_dom_method

Method for calculating the dominant diameter and dominant height. The default choice is "Weise". See the documentation of stand_sums_static for more options and details.

.progress

Logical, if TRUE (default) a progress bar will be shown during execution. Check the documentation of map for more options.

Value

A tibble containing the calculated sum and mean values

Examples

  # Very small example
  fe_inv <- data_ex3_sample_fe_inventory[1:3, ]

  # Example with incomplete heights
  fe_inv |> pull_sums(.progress = FALSE)

  # Complete all heights with estimates ...
  suppressWarnings(
  # Warnings come from intentional species code casts - no problem here
    all_trees_with_heights <- fe_inv |>
      pull_trees() |>
      height_complete_inventory()
  )

  # ... and run pull_sums() again
  fe_inv |>
    fill_heights_back(all_trees_with_heights, .progress = FALSE) |>
    pull_sums(.progress = FALSE)


Pull All Trees From an fe_inventory Object Into a Tibble

Description

While it has many advantages to keep inventory data in an object of class fe_inventory, having one large data frame comprising all trees is more convenient for many standard evaluation purposes, This function pulls such a data frame (tibble) from an fe_inventory object.

Usage

pull_trees(forest_inventory, small_trees = FALSE, .progress = TRUE)

Arguments

forest_inventory

Object of class fe_inventory

small_trees

[Experimental] logical, default is FALSE. Only users who absolutely know what they are doing, should use the setting TRUE. If TRUE also small trees (i.e. trees with heights < 1.3 m) will be pulled. This is still highly experimental, recommended for insiders only.

.progress

Logical, if TRUE (default) a progress bar will be shown during execution. Check the documentation of map for more options.

Value

A tibble with one row per tree, holding the trees of all inventory plots of forest_inventory in a single flat table. It is not an object of a FeNEU class; the plot each tree belongs to is carried in the column plot_id instead. The leading columns are plot_id, area_rep_ha (the area in ha the plot represents), layer_key, and species_id (an fe_species vector of whatever coding the inventory uses); they are followed by the tree attributes of the plots' trees slots, among them tree_id, time_yr, age_yr, dbh_cm, height_m, removal, ingrowth, and h_m_tree (whether the height was measured or estimated).

Two columns are added by this function and are not tree attributes as such. n_rep_ha is the number of trees per hectare the tree represents; it comes from the plot but is multiplied here by the tree's tree_count, so that a record standing for more than one tree is correctly weighted (tree_count itself is dropped afterwards). dbh_trshld is the lower DBH limit of the concentric circle the tree was sampled in; it is NA for plots that are not fe_ccircle_spatial, i.e. for stand-wise inventories.

With small_trees = TRUE the small trees of all plots are appended as further rows, with crown_base_height_m, crown_radius_m, and dbh_trshld set to NA.

Examples

  data_ex3_sample_fe_inventory |> pull_trees()



Read Preprocessed Inventory Data Into an fe_inventory (expert dispatcher)

Description

Expert-level function – standard users do not need it. The normal import path is two calls: the matching raw_to_pre converter for your raw format, followed by the matching pre_to_fe_inventory reader, which alone turns the preprocessed on-disk files into a finished fe_inventory object (see import_sample_concentric_pre_to_fe_inventory and import_standwise_relascope_pre_to_fe_inventory).

Usage

read_and_convert_data(
  input_path,
  inventory_type = c("sample_concentric", "standwise_relascope"),
  style = NULL,
  coord_sys = NULL,
  check_envelope = TRUE
)

Arguments

input_path

Path of the folder holding the preprocessed input files (character). The required filenames depend on inventory_type; see the routed pre_to_fe_inventory functions above.

inventory_type

Character. Which inventory chain to read. One of "sample_concentric" or "standwise_relascope".

style

Character or NULL. Format family of the preprocessed data within the chosen chain. If NULL (default), the chain's only current style is used: "baysf" (Bavarian State Forest style) for "sample_concentric", "silvarith" (Silvarith-style) for "standwise_relascope". The argument is explicit (not auto-detected): the right style follows from which raw format was imported.

coord_sys

Character string specifying the coordinate reference system of the input plot coordinates (used only by "sample_concentric"; ignored for stand-wise data). Supported values:

"lonlat"

WGS84 geographic, EPSG:4326 (degrees)

"etrs89"

ETRS89 geographic, EPSG:4258 (degrees)

"utm32", "utm33"

ETRS89 / UTM 32N, 33N (EPSG:25832, 25833)

"gk2""gk5"

DHDN / Gauss-Krueger zones 2-5 (EPSG:31466-31469)

If NULL, a format-specific default is used ("gk4" for the BaySF style).

The geographic systems ("lonlat", "etrs89") are accepted, but their coordinates are reprojected to the matching UTM zone during import (a message names the zone). This is not cosmetic: tree positions are built metrically from distance and azimuth around the plot centre, which is impossible in degrees. The plot coordinates of the returned object are therefore in UTM, not in the geographic system supplied.

Note that coord_sys must be stated explicitly whenever the eastings are stored without the Gauss-Krueger zone prefix (the usual BaySF form): adding the prefix follows from your declaration, but would be a mere guess if the system had only been defaulted – so the import stops and asks. See import_sample_concentric_pre_to_fe_inventory.

check_envelope

Logical, default TRUE; see import_sample_concentric_pre_to_fe_inventory.

Details

This function is a convenience dispatcher for expert / programmatic use – e.g. when the inventory chain has to be chosen at run time from an argument. It routes to the matching pre_to_fe_inventory step of the two import chains and derives the correct object_type from the inventory type, so callers cannot mismatch them:

"sample_concentric"

concentric-circle sample inventory -> fe_ccircle_spatial plots, via import_sample_concentric_pre_to_fe_inventory.

"standwise_relascope"

stand-wise relascope (“Winkelzählprobe” / angle-count) inventory -> fe_stand plots, via import_standwise_relascope_pre_to_fe_inventory.

The input must already be in the preprocessed on-disk form of the respective chain (a folder of BaySF-style files for "sample_concentric", a WZP_Daten.txt for "standwise_relascope"). Raw vendor formats are brought into that form first by the matching raw_to_pre converter – see import_sample_concentric_format1_raw_to_pre, import_sample_concentric_format2_raw_to_pre and import_standwise_relascope_format1_raw_to_pre.

Value

An fe_inventory object (fe_ccircle_spatial plots for "sample_concentric", fe_stand plots for "standwise_relascope").

See Also

import_sample_concentric_pre_to_fe_inventory, import_standwise_relascope_pre_to_fe_inventory

Examples

# Concentric-circle sample inventory in BaySF-style preprocessed form
inv_path <- system.file("extdata", "data_ex3_sample_pre",
                        package = "FeNEU")
read_and_convert_data(inv_path, inventory_type = "sample_concentric",
                      coord_sys = "gk4")


Read Dead wood Data in BaySF Style

Description

[Experimental]

Usage

read_deadwood_data_baysf(input_path)

Arguments

input_path

Path of the input data folder (character)

Details

Imports raw inventory data from tab-delimited text files. Currently, these data must follow the standard of the Bavarian State Forest(BaySF)

For this version this function is kept independent from the standard importing in functions. It in the future it may be an optional part of import_data_BaySF

Currently, the following text files must be present in the folder input_path:

fdinvtot.txt

BaySF-style deadwood inventory file

Value

A list that contains the imported data files (so far only one)


Reclassify Pseudo-Ingrowth Trees on Concentric-Circle Plots

Description

In repeated inventories with concentric sampling circles, trees that grow across the dbh threshold of the innermost circle (typically 12 cm) between two surveys are often mis-classified as ingrowth — even though they physically existed during the first survey, just on the inner circle, where they may not have been individually identifiable. This function corrects such pseudo-ingrowth trees so that subsequent steps of the increment calculation (tree_inc_repsurv and inv_inc_summaric) treat them as re-measured trees with a circle transition rather than as fresh ingrowth.

Usage

reclassify_pseudo_ingrowth_ccirc(
  matched_trees,
  inv_2nd,
  inv_2nd_trees,
  tree_id_style = c("baysf", "generic"),
  inner_circle_non_matchable = FALSE
)

Arguments

matched_trees

A data frame as produced by match_trees_on_inventory_repsurv_ccirc.

inv_2nd

fe_inventory object representing the later of the two inventories. Used to access tree_positions (for the polar distance R) and circle_definition (for the inner radius and the per-circle representation numbers).

inv_2nd_trees

Extended tree data frame for the second inventory (same object that was passed to match_trees_on_inventory_repsurv_ccirc). Provides species_id, age_yr, dbh_cm, height_m, and v_hub_m3 for the gnfi3 backward estimate.

tree_id_style

Character string indicating how trees are uniquely identified on inventory plot level. Must be the same value that was used when matching. Options are "baysf" (default) and "generic".

inner_circle_non_matchable

Logical, default FALSE. Only relevant for tree_id_style == "generic": must be TRUE if the survey design renders inner-circle identifiers unreliable. Ignored for tree_id_style == "baysf", where inner-circle trees of the first inventory are always treated as unmatchable.

Details

A tree is classified as pseudo-ingrowth if all of the following hold:

The innermost circle is treated as perfectly concentric. In practice it is sometimes laid out slightly off-centre (to avoid trampling small trees), but the displacement is random in direction and magnitude, so individual mis-classifications average out across many plots.

For pseudo-ingrowth trees, the first-survey volume is reconstructed via the gnfi3 growth functions (d_age_gnfi3, h_age_gnfi3, v_gri, and v_red_harvest_ubark) over the full inter-survey period (dt = -(time_yr_2nd - time_yr_1st)). The estimated volume is clamped at zero. The first-survey representation number is always set to the inner circle's value, because the very premise of pseudo-ingrowth identification is that the tree was sampled on the inner circle at the first survey (Inv-2 position inside r_inner, plus unmatchable). The gnfi3 back-estimated dbh is only used for the volume; the sampling circle is a fact of the survey design, not a model output.

The function leaves all other trees in matched_trees untouched. It always adds the column pseudo_ingrowth_corrected (boolean), with TRUE for the reclassified trees and FALSE for all others. This flag is meant to remain visible downstream so consumers can analyse the corrected subset (e.g. for a separate tree-status category in aggregation overviews).

Downstream consumer contract:

The reclassification is only meaningful when inner-circle trees of the first inventory are inherently unmatchable:

In all other situations the function simply adds the pseudo_ingrowth_corrected column as all-FALSE and leaves the data untouched.

Value

The input matched_trees with two changes:

Note that tree_id_1st deliberately stays NA on these rows. The reclassification asserts that the tree existed at inv 1, not that an individual inv-1 record was identified — there is none, which is exactly why the tree was unmatchable. A reclassified row therefore carries tree_exists_1st = TRUE together with tree_id_1st = NA, and any downstream count that keys on tree_id_1st will not see it. This is why n_in_both_1st and n_in_both_2nd of match_tree_statistics differ by exactly the number of pseudo-ingrowth trees.

The existing v_hub_m3_at_thrsh value is preserved as-is — it was already correctly computed for the ingrowth case by calc_v_hub_m3_at_thrsh, and that same threshold volume is what the circle-transition branch of tree_inc_repsurv needs after reclassification.

See Also

Other increment: harmonize_inv_for_repsurv(), increment_base_table(), increment_base_table_main_stand(), increment_ytables_base_table(), inv_inc_big_overview(), inv_inc_big_overview_2nd_only(), inv_inc_big_overview_matches_only(), inv_inc_fill_gaps_gnfi3(), inv_inc_summaric(), inv_inc_tree_2_plot(), inv_inc_tree_consolidate(), inv_inc_tree_extend(), inv_inc_tree_extend_combined(), inv_increment_gnfi3(), inv_increment_repeated_survey(), inv_increment_repsurv_ccirc(), inv_increment_ytables(), is_fe_increment_repsurv(), match_2_inventories(), match_2_inventories_by_center_coord(), match_2_inventories_by_plot_id(), match_plot_statistics(), match_trees_on_inventory_repsurv_ccirc(), match_trees_on_plot_repsurv_ccirc(), output_increment_base_table(), output_increment_base_table_pdf(), output_increment_overall(), output_increment_overall_pdf(), output_increment_overview_gnfi3(), output_increment_overview_gnfi3_pdf(), output_increment_overview_ytables_pdf(), tree_inc_repsurv()

Other repeated inventory: harmonize_inv_for_repsurv(), inv_increment_repsurv_ccirc(), match_2_inventories(), match_2_inventories_by_center_coord(), match_2_inventories_by_plot_id(), match_plot_statistics(), match_trees_on_inventory_repsurv_ccirc(), match_trees_on_plot_repsurv_ccirc()

Examples

  # Prepare two matching inventories
  inv_a <- data_ex3_previous_sample_fe_inventory
  inv_b <- data_ex3_sample_fe_inventory

  inv_a_trees <- data_ex3_previous_sample_trees_essentials
  inv_b_trees <- data_ex3_sample_trees_essentials

  inv_pt_mtch <- match_2_inventories(inv_a, inv_b, "plot_id", "baysf")
  mtch_trs <- match_trees_on_inventory_repsurv_ccirc(
    inv_pt_mtch, inv_a, inv_b, inv_a_trees, inv_b_trees,
    tree_id_style = "baysf"
  )

  # Reclassify pseudo-ingrowth — default tree_id_style "baysf"
  mtch_trs_corr <- reclassify_pseudo_ingrowth_ccirc(
    mtch_trs, inv_b, inv_b_trees, tree_id_style = "baysf"
  )
  sum(mtch_trs_corr$pseudo_ingrowth_corrected)


Wide table of inventory-point counts by plants per point

Description

[Experimental]

Usage

reg_points_by_plants_wide(reg_points_long)

Arguments

reg_points_long

Tibble from count_reg_points_by_plants_long(), containing mixture_class, species_group, plant_count_class, n_inv_points.

Details

Converts the long-format output of count_reg_points_by_plants_long() into a wide table with one row per mixture_class × species_group and one column per plant-number class.

Value

Wide-format tibble with one row per mixture_class × species_group and columns ⁠n_inv_points_<class>⁠ for each plant-number class.


Add Essential Information to Regeneration Data

Description

[Experimental]

Usage

regeneration_add_essentials(inv_trees_reg, method = method)

Arguments

inv_trees_reg

Tibble containing regeneration trees from pull_trees(..., small_trees = TRUE). Must include at least plot_id and height_m.

method

Character string selecting the species grouping (coding) applied to species_id. "BaySF" uses the Bavarian State Forest short coding (as_fe_species_bavrn_state_short); any other value uses the TUM WWK short coding (as_fe_species_tum_wwk_short). Note that wood densities are only available for the WWK method.

Details

Adds fixed L43 height classes and a main-stand mixture type to a regeneration tibble created from BaySF tree data via pull_trees(..., small_trees = TRUE). No further transformations of stem numbers are performed.

The height classes follow Bavarian forests standard Table L43:

The mixture type is joined in from plot-level information derived from the main stand (e.g. trees with layer_key 1 and 2), typically computed using pull_trees(..., small_trees = FALSE).

Value

Tibble identical to inv_trees_reg but with two additional variables:

hclass_43

L43 height class (0.2-1.3, 1.3-5.0)

mixture_type_43

Mixture type derived from the main stand


Standardize BaySF fdinvtot column names

Description

Converts raw BaySF Totholz column names to the internal FeNEU / ForestElementsR naming convention used for deadwood processing.

Usage

rename_dead_wood_fdinvtot(output_list)

Arguments

output_list

List returned by read_deadwood_data_baysf() containing fdinvtot.

Value

A tibble with standardized column names


Area-Weighted Standard Error and Confidence Interval

Description

Computes the standard error and confidence interval for an area-weighted mean and its corresponding total, based on the ratio estimator approach. This is the standard method for forest inventory data where plots have different representation areas (e.g. due to slope correction in concentric circle designs).

Usage

se_area_weighted(plot_values, area_weights, conf_level = 0.95)

Arguments

plot_values

Numeric vector of per-hectare values, one per plot (e.g. volume in m3/ha, increment in m3/ha/yr).

area_weights

Numeric vector of representation areas in hectares, same length as plot_values. Must be strictly positive.

conf_level

Confidence level for the interval, default 0.95.

Details

The area-weighted mean is computed as a ratio estimator:

\hat{R} = \frac{\sum a_i x_i}{\sum a_i}

Its variance is estimated as:

\mathrm{Var}(\hat{R}) = \frac{n}{(n-1)\,(\sum a_i)^2} \sum a_i^2 (x_i - \hat{R})^2

The total is \hat{Y} = \hat{R} \cdot \sum a_i, with \mathrm{SE}(\hat{Y}) = \mathrm{SE}(\hat{R}) \cdot \sum a_i.

Confidence intervals use the t-distribution with n - 1 degrees of freedom. No finite population correction (FPC) is applied. For typical forest inventories on systematic grids, the sampling fraction n/N is very small and the FPC is negligible. Omitting it is conservative, i.e. the standard error is slightly overestimated.

Value

A tibble (one row) with:

n_plots

Number of plots used

mean_ha

Area-weighted mean (per hectare)

se_mean

Standard error of the mean

margin_mean

Margin of error for the mean (t * SE)

ci_lo_mean

Lower confidence bound of the mean

ci_up_mean

Upper confidence bound of the mean

total

Area-weighted total (mean_ha * total area)

se_total

Standard error of the total

margin_total

Margin of error for the total (t * SE)

ci_lo_total

Lower confidence bound of the total

ci_up_total

Upper confidence bound of the total

ci_pct

Margin of error as percentage of the mean

Examples

  # Simple example with equal areas
  se_area_weighted(c(10, 12, 8, 11), area_weights = c(1, 1, 1, 1))

  # Unequal representation areas (e.g. from slope correction)
  se_area_weighted(
    c(10, 12, 8, 11),
    area_weights = c(0.95, 1.00, 0.88, 1.02)
  )


Group-Wise Area-Weighted Aggregation

Description

Convenience wrapper around se_area_weighted that takes a (possibly grouped) data frame with one row per plot per group, a value column, and an area column, and returns one row per group with all the columns of se_area_weighted.

Usage

se_area_weighted_grouped(data, value_col, area_col, conf_level = 0.95)

Arguments

data

A data frame. If grouped via group_by, the aggregation runs per group; otherwise a single row is returned.

value_col

Character. Name of the per-plot per-hectare value column (e.g. "iv_m3_ha_yr_plot").

area_col

Character. Name of the plot's representation area column, in hectares.

conf_level

Confidence level for the CI, default 0.95.

Details

Used as the shared primitive behind several aggregation pipelines in this package (back tables, big_overview, increment summaries). The data frame is expected to be pre-aggregated to one row per plot per group — the caller decides what “per plot” means (e.g. sum over trees in a species group, or a single per-plot quantity).

Value

A tibble with one row per group, the group keys preserved, and all output columns of se_area_weighted attached.

Examples

  df <- tibble::tibble(
    group = rep(c("a", "b"), each = 4),
    value = c(10, 12,  8, 11,  20, 22, 18, 21),
    area  = c( 1,  1,  1,  1,   1,  1,  1,  1)
  )
  df |>
    dplyr::group_by(group) |>
    se_area_weighted_grouped("value", "area")


Install Missing PDF Rendering Tools

Description

Installs TinyTeX if no LaTeX distribution is found on the current system. For pandoc, installation must be done manually (see diagnose_pdf_toolchain for instructions).

Usage

setup_pdf_toolchain()

Value

Invisibly, the result of diagnose_pdf_toolchain after the setup attempt.

See Also

diagnose_pdf_toolchain

Examples

## Not run: 
# Deliberately not run, and deliberately not merely skipped on the check
# farm either: this installs TinyTeX into the user's own filespace. That
# must never happen unasked, least of all during a package check.
setup_pdf_toolchain()

## End(Not run)

Aggregation of Deadwood Information on User-Defined Grouping Level

Description

Aggregates deadwood data (volume and number per hectare) to any grouping structure defined by the user. The function mirrors the structure of single_tree_aggregation() for live trees but uses ha-based deadwood metrics. Output values are sums of volume and number per hectare and the corresponding quadratic mean diameter.

Usage

single_dead_tree_aggregation(dead_trees_ext, ...)

Arguments

dead_trees_ext

Tibble containing deadwood objects with essential variables (d_mean_cm, v_ha, n_ha).

...

Grouping variables passed to dplyr::group_by().

Value

Tibble with aggregated deadwood information on the defined grouping level.


Aggregation of Regeneration Information on User-Defined Grouping Level

Description

[Experimental]

Usage

single_regeneration_aggregation(inv_trees_reg, ..., pulled_circles = NULL)

Arguments

inv_trees_reg

Tibble returned by pull_trees(..., small_trees = TRUE), containing regeneration trees with variables n_rep_ha and area_rep_ha.

...

Grouping variables passed to dplyr::group_by().

pulled_circles

Optional tibble with circle definitions (one row per circle), typically the output of pull_circle_definitions().

Details

Aggregates regeneration data (real counts, calculated stems per hectare, and sampled area) to any grouping structure defined by the user. Works with the tibble returned by pull_trees(..., small_trees = TRUE) and uses all trees with layer_key == 3.

If pulled_circles is provided (a tibble of circle definitions with plot_id, slope and c_area), the function approximates the counted stems ("erfasst") per group from n_rep_ha and the minimum circle area per plot by inverting the original expansion formula.

Value

Tibble with aggregated regeneration information on the defined grouping level.


Aggregated Information From Single Tree to Inventory Level by User Defined Grouping

Description

Workhorse function used in several functions which produce base or structure tables

Usage

single_tree_aggregation(
  inv_trees_ext,
  ...,
  .sub_plot_areas = FALSE,
  .standard_error = TRUE
)

Arguments

inv_trees_ext

A tibble representing the trees of an inventory (or any subset), typically the outbput of trees_add_essentials, possibly merged with the output of base_table_d_q_class

...

Grouping variables defining the level of aggregation, internally passed to group_by

.sub_plot_areas

Logical, if TRUE, sub-plot area shares and area-related values on sub-plot level will be provided in addition (default = FALSE)

Value

A tibble containing the aggregated information


Summarise Circle Geometry for Regeneration Expansion Factors

Description

Takes a tibble of circle definitions (one row per concentric circle) as extracted from an fe_inventory object and summarises the geometry information to the plot level. For each plot, the function returns the minimum circle area and the plot-level slope where the regeneration is accounted for

Usage

small_circle_geometry(pulled_circles)

Arguments

pulled_circles

Tibble with one row per circle, containing plot_id, slope and c_area. Usually created by pull_circle_definitions().

Details

The input pulled_circles should contain at least the variables plot_id, slope and c_area, typically obtained via pull_circle_definitions(). Geometry columns (sf) should already be dropped before passing the tibble.

Value

A tibble with one row per plot, containing:

plot_id

Unique plot identifier

slope

The plot-level slope (degrees), extracted as the first non-missing slope value per plot

min_c_area

The minimum circle area of all concentric circles for that plot


Generate a Stand Register (Revierbuch) PDF From an fe_inventory

Description

Creates a multi-page PDF in which each page summarises the forest inventory statistics of one stand. Statistics include stem number, basal area, standing volume, and quadratic mean DBH per tree species and canopy layer. Optionally, annual volume increment, site index (Bonitaet), and stocking level (Bestockungsgrad) are added.

Usage

stand_register_pdf(
  fe_inv,
  stands_sf = NULL,
  stand_id_col = NULL,
  tab_title,
  output_dir = NA,
  fe_inv_prev = NULL,
  ytable_selection = NULL,
  increment_method = c("none", "ytables", "gnfi"),
  dt = 5,
  stand_data = NULL,
  stand_id_lookup = NULL,
  layer_filter = c("OS", "all", "gesamt")
)

Arguments

fe_inv

An fe_inventory object containing the (first) inventory.

stands_sf

An sf object with stand polygons, or NULL (default). Supplying it selects the spatial mode; NULL selects the tabular, stand-wise mode, in which stand membership is read from stand_id_lookup or from the plot_id structure ("<stpnr>_<stand_id>").

stand_id_col

Character; name of the column that uniquely identifies a stand. Required when stands_sf is provided, where it must name a column of stands_sf. It is also used as the stand-id column of stand_data, in both modes; when it is NULL, stand_data is expected to carry a column named stand_id.

tab_title

Character; used in the PDF title and output filename.

output_dir

Path to the directory where the PDF will be written. Default is NA, which writes to the session's temporary directory.

fe_inv_prev

Optional previous (earlier) fe_inventory object. When provided, annual volume increment per stand is computed over the last completed period (fe_inv_prev -> fe_inv, a backward look) via inv_increment_repsurv_ccirc and added to the tables. This repeated-survey increment works only for sample inventories of concentric sample circles (fe_ccircle_spatial); for stand-wise inventories it is ignored with a warning. The "rep_trans" method is used because its per-tree increments cannot become negative even for the small per-stand samples a stand register aggregates; see inv_increment_repsurv_ccirc for the available representative-tree increment methods.

ytable_selection

Optional yield table selection data frame mapping species codes to yield table names. When provided, site index (Bonitaet) and stocking level (Bestockungsgrad) are computed per species and stand. See inv_increment_ytables for the expected format.

increment_method

Character; one of "none" (default), "ytables", or "gnfi". Determines how model-based volume increment is estimated. Ignored when fe_inv_prev is provided (which uses repeated-survey increment instead). For stand-wise inventories (stands_sf = NULL) only "none" and "ytables" are valid; "gnfi" requires spatially explicit data and raises an error there.

dt

Numeric; time span in years for the GNFI forward projection. Only used when increment_method = "gnfi". Default is 5.

stand_data

Optional data frame with stand-level metadata, printed in the header of each stand's page. It must contain the stand-id column named by stand_id_col (or, when that is NULL, a column called stand_id), plus any metadata columns. The columns bestandsform, nutzungsart, beschreibung, massnahmen, vj_ziel and bestockungsgrad are displayed with proper labels; every other column appears under its raw name. For stand-wise inventories this is typically the table returned by import_standwise_relascope_format1_metadata, whose stand key is named bestand – pass stand_id_col = "bestand" in that case.

stand_id_lookup

Optional plot-to-stand lookup for stand-wise inventories (stands_sf = NULL). One of:

  • A named character vector c(plot_id = stand_id, ...).

  • A data frame / tibble with columns plot_id and stand_id (e.g.\ read from a CSV with read.csv() / readr::read_csv()).

  • A single unnamed string – aggregates all plots into one stand of that name (the "all together" case).

When both stands_sf and stand_id_lookup are NULL, stand IDs are extracted from the embedded plot_id suffix. Plots not covered by an explicit lookup are dropped with a warning.

layer_filter

Character; one of "OS" (default, main canopy layer only), "all" (split by all canopy layers), or "gesamt" (aggregate across all layers into one row per species).

Details

Stands can be delineated in two ways, and that choice selects the mode:

Spatially, for sample inventories

Supply stands_sf, an sf object of stand polygons, together with stand_id_col. Plots are assigned to stands by intersecting their sampling circles with the polygons.

Tabularly, for stand-wise inventories

Leave stands_sf = NULL. Stand membership is then taken from a table – either stand_id_lookup, or, if that is NULL as well, from the stand id embedded in plot_id ("<stpnr>_<stand_id>"). Stand-level attributes come from stand_data, for instance the table returned by import_standwise_relascope_format1_metadata. No geometry is needed.

Assigning plots to stands: In the spatial mode, plots whose concentric sampling circles straddle a stand boundary are split: each tree's representation factor (n_rep_ha) is multiplied by the fraction of its sampling circle that falls inside the stand, so a boundary plot contributes proportionally to both adjacent stands. In the stand-wise mode there is no geometry and hence no boundary handling – every angle-count point belongs wholly to exactly one stand.

Volume calculation: Heights are completed via height_complete_inventory (NFI method) before volume is estimated with ForestElementsR::v_gri().

Increment estimation: Increment is optional and can come from three sources. Note that only two of them are values of increment_method; the repeated-survey increment is selected by supplying fe_inv_prev.

Repeated survey (fe_inv_prev)

Increment from two inventory periods. Sample inventories only.

increment_method = "ytables"

Yield-table-based increment. Also computes per-species site index and stand-level stocking level. Requires ytable_selection. Available in both modes.

increment_method = "gnfi"

Increment estimate with the single-tree growth functions of the 3rd German National Forest Inventory. Sample inventories only.

Restrictions in the stand-wise mode: increment_method = "gnfi" raises an error, and a supplied fe_inv_prev raises a warning and is ignored (the increment is then omitted). Both need spatially explicit, repeatedly measured single trees, which stand-wise angle-count inventories do not provide. Effectively, "none" and "ytables" remain.

Value

The path to the rendered PDF file (invisibly).

Deliberately not a member of the pdf_output family: the Revierbuch is a post-CRAN feature, so this function must not appear in the cross-links of the user-facing PDF functions.


Restructure Deadwood Detail Table to L46-style Output Table

Description

Takes the long-format detail table from structure_table_deadwood_dclass() and produces a wide-format structure table similar to the L_46 deadwood tables of the Bavarian State Forests. The function reshapes diameter classes into columns, computes totals for volume and number, and adds plot-level expansion variables (points and representative area). No readable formatting is applied at this stage.

Usage

structure_deadwood_output_table(deadwood_structure_table, dead_trees_plus)

Arguments

deadwood_structure_table

Long-format structure table table from structure_table_deadwood_dclass() containing deadwood metrics per state × species group × diameter class.

dead_trees_plus

The preprocessed deadwood tibble containing plot_id and area_rep_ha (after deadwood_add_essentials()).

Value

A wide-format tibble with one row per state × species group and one block of columns per diameter class, plus totals and plot-level expansion variables.


Render a Deadwood Structure Output Table in PDF Format

Description

Transform a deadwood structure output table as generated by structure_deadwood_output_table into a pdf file that can be exported or displayed.

Usage

structure_deadwood_output_table_pdf(
  x,
  tab_title,
  output_dir = NA,
  meta = NULL,
  language = c("ger")
)

Arguments

x

Input object, must be a deadwood structure output table as generated with structure_deadwood_output_table.

tab_title

Character, used for the table title and the file name.

output_dir

Path to the directory where the pdf file will be stored. Default is NA; in this case, the file will be written into the temporary directory of the current R session.

meta

Optional named list with inventory meta-information to display above the table. Recognised names: year (inventory year, integer), area_ha (total area in ha, numeric), n_plots (number of inventory points, integer). Any or all elements may be omitted or NULL. When meta is NULL (default) no meta block is rendered.

language

Language of the rendered output. Currently only "ger" (German) is implemented and accepted; passing any other value raises an error. Future languages will be added as separate template files (one template per language, keeping each template linguistically consistent).

Deliberately not a member of the pdf_output family: deadwood evaluation is a post-CRAN feature, so this function must not appear in the cross-links of the user-facing PDF functions.

Details

The user must make sure that the input object x has been generated with structure_deadwood_output_table, because the function does not check that. For other objects the function will either produce an error or at least strange results.

Value

The path to the rendered pdf file.


Restructure Regeneration Table with Mixture Classes (Long Format)

Description

[Experimental]

Usage

structure_regeneration_output_table(
  inv_dat_trees_ext_reg,
  inv_dat_trees_ext,
  pulled_circles = NULL
)

Arguments

inv_dat_trees_ext_reg

Tibble from pull_trees(..., small_trees = TRUE) containing small trees with height classes and n_rep_ha.

inv_dat_trees_ext

Tibble from pull_trees() with the full stand, used to derive mixture classes based on basal area.

pulled_circles

Optional tibble of circle definitions, typically the output of pull_circle_definitions(). If provided, real counts are corrected in the aggregation.

Details

Computes species mixing classes from the main stand (layer_key == 1) based on basal area proportions (g_per), then attaches the mixture class to the regeneration (layer_key == 3), and finally aggregates regeneration using single_regeneration_aggregation().

All regeneration metrics are then aggregated to the level mixture_class × species_group × hclass_43. In addition, the function computes:

If pulled_circles is provided (a tibble with circle geometry), the regeneration aggregation will correct the counted stems ("erfasst") using the inverted expansion formula.

Value

Tibble in long format with one row per mixture_class × species_group × hclass_43 containing n_measrured, n_calc_ha, area_ha, percHoe and n_inv_points.


Render a Regeneration Structure Output Table in PDF Format

Description

[Experimental]

Usage

structure_regeneration_output_table_pdf(
  x,
  tab_title,
  output_dir = NA,
  meta = NULL,
  language = c("ger")
)

Arguments

x

Input object, must be a regeneration structure output table as generated with structure_regeneration_output_wide.

tab_title

Character, used for the table title and the file name.

output_dir

Path to the directory where the pdf file will be stored. Default is NA; in this case, the file will be written into the temporary directory of the current R session.

meta

Optional named list with inventory meta-information to display above the table. Recognised names: year (inventory year, integer), area_ha (total area in ha, numeric), n_plots (number of inventory points, integer). Any or all elements may be omitted or NULL. When meta is NULL (default) no meta block is rendered.

language

Language of the rendered output. Currently only "ger" (German) is implemented and accepted; passing any other value raises an error. Future languages will be added as separate template files (one template per language, keeping each template linguistically consistent).

Deliberately not a member of the pdf_output family: regeneration evaluation is a post-CRAN feature, so this function must not appear in the cross-links of the user-facing PDF functions.

Details

Transform a regeneration structure output table as generated by structure_regeneration_output_wide into a pdf file that can be exported or displayed.

The user must make sure that the input object x has been generated with structure_regeneration_output_wide, because the function does not check that. For other objects the function will either produce an error or at least strange results.

Value

The path to the rendered pdf file.


Restructure Regeneration Aggregation to L43-style Wide Table

Description

[Experimental]

Usage

structure_regeneration_output_wide(regen_long, reg_points_long = NULL)

Arguments

regen_long

Tibble from structure_regeneration_output_table(), containing at least mixture_class, species_group, hclass_43, n_measrured, n_calc_ha, area_ha, and percHoe.

reg_points_long

Optional tibble from count_reg_points_by_plants_long(), containing mixture_class, species_group, plant_count_class, n_inv_points.

Details

Takes the aggregated long-format regeneration table produced by structure_regeneration_output_table() and reshapes it into a wide-format table similar to the Bavarian L43 tables.

The function:

  1. Builds the top block "total" (across all mixture classes)

  2. Binds mixture-level blocks below

  3. Pivots height classes into separate columns using the pattern "{.value}_{hclass_43}"

  4. Computes horizontal sums across height classes for n_measrured, n_calc_ha, area_ha, and percHoe

  5. Derives block-wise stammzahl_je_ha and Dominanz from the horizontal sums

  6. Optionally joins a wide Probkreise block derived from count_reg_points_by_plants_long()

Value

Wide-format tibble with one row per mixture_class × species_group, including all height-class columns, horizontal sum columns, block-wise stammzahl_je_ha, Dominanz, and (if provided) the ⁠n_inv_points_*⁠ columns.


Species Group Information Table by Age Class and Single Tree Diameter Class

Description

Inventory tree data are grouped by species group, age class, and single tree diameter class. A data frame with group-wise aggregated inventory information is returned.

Usage

structure_table_age_class(inv_trees_plus, tree_filter = !.data$removal)

Arguments

inv_trees_plus

Data frame which covers trees from an inventory (each row is a tree), typically obtained from an fe_inventory object with pull_trees and pre-treated with trees_add_essentials (see example).

tree_filter

Expression describing which trees to use in the function, internally passed to filter. Default is !removal, i.e. trees that died or were removed are not included.

Value

A list of six data frames. detail holds the aggregated information by species group, age class, and single tree diameter class. total aggregates across single tree diameter classes, providing correct weighted d_q_cm/h_q_m for the total column of each species row. all_species holds the cross-species aggregation by age class and single tree diameter class (body of the "Summe" block). all_total aggregates all_species across single tree diameter classes, providing correct weighted d_q_cm/h_q_m for the total column of the Summe block. species_total aggregates across age classes and single tree diameter classes (one level up from total), i.e. the species-wise grand total used for the trailing "Summe" row output_structure_table appends within each species' block. species_dbh_total aggregates across age classes only (keeping the single tree diameter class breakdown), providing the per-dbh_class values shown in that same "Summe" row.

Attached attribute

The returned list carries a tree_selection attribute recording which tree cohort it represents: "mainstand" for the *_main_stand() functions, "alllayers" for the general functions called with their default tree_filter, or the raw tree_filter expression for a custom filter. output_base_table / output_structure_table carry this attribute through to their own output, where the *_pdf() renderers read it for a self-describing file name and the cohort disclaimer.

See Also

Other inventory tables: base_table_age_class(), base_table_age_class_main_stand(), base_table_d_q_class(), base_table_d_q_class_main_stand(), output_base_table(), output_increment_overall(), output_structure_table(), structure_table_age_class_main_stand(), structure_table_d_q_class(), structure_table_d_q_class_main_stand()

Examples

 # The prepared tree list ships with the package; see
 # ?data_ex3_trees_essentials for the chain that builds it. Three inventory
 # points are enough to show the shape of the result, and they keep the
 # example quick; the function takes a whole tree list alike.
 data_ex3_sample_trees_essentials |>
   dplyr::filter(plot_id %in% unique(plot_id)[1:3]) |>
   structure_table_age_class()


Species Group Information Table by Age Class and Single Tree Diameter Class for the Main Stand Cohort

Description

Inventory tree data are grouped by species group, age class, and single tree diameter class. A data frame with group-wise aggregated inventory information is returned.

Usage

structure_table_age_class_main_stand(inv_trees_plus)

Arguments

inv_trees_plus

Data frame which covers trees from an inventory (each row is a tree), typically obtained from an fe_inventory object with pull_trees and pre-treated with trees_add_essentials (see example).

Value

A list of six data frames. detail holds the aggregated information by species group, age class, and single tree diameter class, restricted to the main stand, including area estimates. total aggregates across single tree diameter classes, providing correct weighted d_q_cm/h_q_m for the total column of each species row. all_species holds the cross-species aggregation by age class and single tree diameter class (body of the "Summe" block). all_total aggregates all_species across single tree diameter classes, providing correct weighted d_q_cm/h_q_m for the total column of the Summe block. species_total aggregates across age classes and single tree diameter classes (one level up from total), i.e. the species-wise grand total used for the trailing "Summe" row output_structure_table appends within each species' block. species_dbh_total aggregates across age classes only (keeping the single tree diameter class breakdown), providing the per-dbh_class values shown in that same "Summe" row.

Attached attribute

The returned list carries a tree_selection attribute recording which tree cohort it represents: "mainstand" for the *_main_stand() functions, "alllayers" for the general functions called with their default tree_filter, or the raw tree_filter expression for a custom filter. output_base_table / output_structure_table carry this attribute through to their own output, where the *_pdf() renderers read it for a self-describing file name and the cohort disclaimer.

See Also

Other inventory tables: base_table_age_class(), base_table_age_class_main_stand(), base_table_d_q_class(), base_table_d_q_class_main_stand(), output_base_table(), output_increment_overall(), output_structure_table(), structure_table_age_class(), structure_table_d_q_class(), structure_table_d_q_class_main_stand()

Examples

 # The prepared tree list ships with the package; see
 # ?data_ex3_trees_essentials for the chain that builds it. Three inventory
 # points are enough to show the shape of the result, and they keep the
 # example quick; the function takes a whole tree list alike.
 data_ex3_sample_trees_essentials |>
   dplyr::filter(plot_id %in% unique(plot_id)[1:3]) |>
   structure_table_age_class_main_stand()


Species Group Information Table by Mean Diameter Class and Single Tree Diameter Class

Description

Inventory tree data are grouped by species group, mean diameter class, and single tree diameter class. A data frame with group-wise aggregated inventory information is returned.

Usage

structure_table_d_q_class(
  inv_trees_plus,
  dclass_back,
  tree_filter = !.data$removal
)

Arguments

inv_trees_plus

Data frame which covers trees from an inventory (each row is a tree), typically obtained from an fe_inventory object with pull_trees and pre-treated with trees_add_essentials (see example).

dclass_back

Data frame listing quadratic mean diameter classes per species group and layer on plot level. Typically the output of back_table_dclass.

tree_filter

Expression describing which trees to use in the function, internally passed to filter. Default is !removal, i.e. trees that died or were removed are not included.

Value

A list of six data frames. detail holds the aggregated information by species group, mean diameter class, and single tree diameter class. total aggregates across single tree diameter classes, providing correct weighted d_q_cm/h_q_m for the total column of each species row. all_species holds the cross-species aggregation by mean diameter class and single tree diameter class (body of the "Summe" block). all_total aggregates all_species across single tree diameter classes, providing correct weighted d_q_cm/h_q_m for the total column of the Summe block. species_total aggregates across mean diameter classes and single tree diameter classes (one level up from total), i.e. the species-wise grand total used for the trailing "Summe" row output_structure_table appends within each species' block. species_dbh_total aggregates across mean diameter classes only (keeping the single tree diameter class breakdown), providing the per-dbh_class values shown in that same "Summe" row.

Attached attribute

The returned list carries a tree_selection attribute recording which tree cohort it represents: "mainstand" for the *_main_stand() functions, "alllayers" for the general functions called with their default tree_filter, or the raw tree_filter expression for a custom filter. output_base_table / output_structure_table carry this attribute through to their own output, where the *_pdf() renderers read it for a self-describing file name and the cohort disclaimer.

See Also

Other inventory tables: base_table_age_class(), base_table_age_class_main_stand(), base_table_d_q_class(), base_table_d_q_class_main_stand(), output_base_table(), output_increment_overall(), output_structure_table(), structure_table_age_class(), structure_table_age_class_main_stand(), structure_table_d_q_class_main_stand()

Examples

# The prepared tree list is shipped with the package: it is this inventory
# put through pull_trees() -> height_complete_inventory() ->
# fill_heights_back() -> pull_trees() -> trees_add_essentials(). See
# ?data_ex3_trees_essentials for that chain spelled out.
# Three inventory points are enough to show the shape of the result, and
# they keep the example quick; the function takes a whole tree list alike.
trees_with_heights <- data_ex3_sample_trees_essentials |>
  dplyr::filter(plot_id %in% unique(plot_id)[1:3])

peg_back_d <- back_table_dclass(trees_with_heights)

structure_table_d_q_class(trees_with_heights, dclass_back = peg_back_d)


Species Group Information Table by Mean Diameter Class and Single Tree Diameter Class

Description

Inventory tree data are grouped by species group, mean diameter class, and single tree diameter class. A data frame with group-wise aggregated inventory information is returned.

Usage

structure_table_d_q_class_main_stand(inv_trees_plus, dclass_back)

Arguments

inv_trees_plus

Data frame which covers trees from an inventory (each row is a tree), typically obtained from an fe_inventory object with pull_trees and pre-treated with trees_add_essentials (see example).

dclass_back

Data frame listing quadratic mean diameter classes per species group and layer on plot level. Typically the output of back_table_dclass.

Details

Very similar aggregation table to the one produced by structure_table_d_q_class, but restricted to to the main stand (layer_key == 1) only. It contains, however, estimates of areas covered by species (sub-)groups and ha-related values o these cohorts. Due the methodological dubiousness of species area calculations in mixed stands, this is only done for the main stand (comparably to how this was handled in the 3rd German National Forest Inventory).

Value

A list of six data frames. detail holds the aggregated information by species group, mean diameter class, and single tree diameter class, restricted to the main stand, including area estimates. total aggregates across single tree diameter classes, providing correct weighted d_q_cm/h_q_m for the total column of each species row. all_species holds the cross-species aggregation by mean diameter class and single tree diameter class (body of the "Summe" block). all_total aggregates all_species across single tree diameter classes, providing correct weighted d_q_cm/h_q_m for the total column of the Summe block. species_total aggregates across mean diameter classes and single tree diameter classes (one level up from total), i.e. the species-wise grand total used for the trailing "Summe" row output_structure_table appends within each species' block. species_dbh_total aggregates across mean diameter classes only (keeping the single tree diameter class breakdown), providing the per-dbh_class values shown in that same "Summe" row.

Attached attribute

The returned list carries a tree_selection attribute recording which tree cohort it represents: "mainstand" for the *_main_stand() functions, "alllayers" for the general functions called with their default tree_filter, or the raw tree_filter expression for a custom filter. output_base_table / output_structure_table carry this attribute through to their own output, where the *_pdf() renderers read it for a self-describing file name and the cohort disclaimer.

See Also

Other inventory tables: base_table_age_class(), base_table_age_class_main_stand(), base_table_d_q_class(), base_table_d_q_class_main_stand(), output_base_table(), output_increment_overall(), output_structure_table(), structure_table_age_class(), structure_table_age_class_main_stand(), structure_table_d_q_class()

Examples


# The prepared tree list is shipped with the package: it is this inventory
# put through pull_trees() -> height_complete_inventory() ->
# fill_heights_back() -> pull_trees() -> trees_add_essentials(). See
# ?data_ex3_trees_essentials for that chain spelled out.
# Three inventory points are enough to show the shape of the result, and
# they keep the example quick; the function takes a whole tree list alike.
trees_with_heights <- data_ex3_sample_trees_essentials |>
  dplyr::filter(plot_id %in% unique(plot_id)[1:3])

peg_back_d <- back_table_dclass(trees_with_heights)

structure_table_d_q_class_main_stand(trees_with_heights, dclass_back = peg_back_d)


Deadwood summary table by species group and diameter class

Description

Produces a structural deadwood summary at the level of species groups and fixed diameter classes. All metrics are calculated in absolute values (volume and number) based on representative area and then converted to percentages on state and species-group level. The resulting table is still in long format; reshaping to an L46-like wide table is done by structure_deadwood_output_table().

Usage

structure_table_deadwood_dclass(dead_trees_plus, tree_filter = TRUE)

Arguments

dead_trees_plus

Tibble with preprocessed deadwood data including plot_id, dw_state, species_group, dclass_46, v_ha, n_ha, and area_rep_ha.

tree_filter

Logical expression selecting the deadwood objects to be used. Passed to dplyr::filter().

Value

A list with two tibbles:

detail

Long-format table grouped by state × species group × diameter class, including absolute metrics, percentages, and expansion variables.

total

State × species-group totals (absolute volume and number).


Single Tree Volume Increment Estimation for Pulled Trees using the Methods of the 3rd German National Forest Inventory

Description

Estimates the dbh, height, and volume increment for each tree in a data frame x, that was generated by pull_trees, applying height_complete_inventory and trees_add_essentials to it. For estimating height and dbh increment, the functions d_age_gnfi3 and h_age_gnfi3 are used. Volumes for increment are calculated with the function v_gri.

Usage

tree_inc_gnfi_2012(x, dt = 5)

Arguments

x

Tree data frame as pulled from an fe_inventory object after height completion (height_complete_inventory), and applying trees_add_essentials.

dt

Time span for the estimate (years). Positive values project forward in time, negative values backward. Default 5 — a period that empirically works well with the gnfi3 functions across age ranges. For estimating the recent past on plots with only a single observation (e.g. in inv_inc_big_overview_2nd_only) a short backward window (typically dt = -5) is preferred over the full inter-survey distance, because the unknown mortality fraction stays small. Must be non-zero.

Details

The estimate can run in either direction in time, encoded in the sign of dt: a positive value projects the trees that many years into the future, a negative value that many years into the past. The volume increment is averaged on one year (divided by abs(dt)), so the resulting iv_hub_m3_yr_gnfi3 is positive for a growing tree in either direction. pmax(0, age_yr + dt) clamps the target age so that backward estimates stay defined for trees younger than |dt|.

The output columns share the suffix _gnfi3 that flags the estimation method. This is consistent with the other gnfi3-derived columns elsewhere in the package (e.g. iv_hub_m3_ha_per_gnfi3 in the fill-gap pipeline) and leaves the direction of estimation as a caller-side concern rather than baking it into the column names.

Value

The input data frame x with five additional columns, all carrying the _gnfi3 suffix:

dbh_cm_gnfi3:

Estimate for the trees' diameters at the target age (age_yr + dt, clamped at 0).

height_m_gnfi3:

Estimate for the trees' heights at the target age.

v_m3_gnfi3:

Tree volume at the target age based on the two preceding columns.

v_hub_m3_gnfi3:

The same volume reduced to harvested volume under bark via v_red_harvest_ubark.

iv_hub_m3_yr_gnfi3:

Annual tree volume increment, harvested under bark. For dt > 0: (v_hub_m3_gnfi3 - v_hub_m3) / dt. For dt < 0: (v_hub_m3 - v_hub_m3_gnfi3) / abs(dt). Both conventions yield a positive value for a growing tree.


Calculate the Volume Increment of the Single Trees in a Repeated Inventory with a Concentric Sampling Circle Design

Description

Provided for convenience, but typically not called directly but from within the function inv_increment_repsurv_ccirc.

Usage

tree_inc_repsurv(
  matched_trees,
  method = c("rep_classic", "rep_mean", "rep_end", "rep_trans"),
  clamp_plausible_shrinkage = TRUE
)

Arguments

matched_trees

A data frame being the output of match_trees_on_inventory_repsurv_ccirc.

method

Character string, choices are "rep_classic" (default), "rep_mean", "rep_end", and "rep_trans". These methods differ in how sampling thresholds are handled (see Details.)

clamp_plausible_shrinkage

Logical. If TRUE (default), re-measured trees with plausible volume shrinkage (below the implausibility threshold set in match_trees_on_inventory_repsurv_ccirc) receive a zero increment. If FALSE, plausible shrinkage is passed through to the increment for rep_classic, rep_mean, and rep_end. Has no effect on rep_trans, which always clamps negative volume differences to zero (a warning is issued in that case). Trees flagged as implausible always receive a zero increment regardless of this setting.

Details

Even though the volume increments are calculated on tree level here, they are upscaled to 1 ha. This is important, because otherwise the increment represented by trees that change their representation number per ha between both inventories cannot be calculated correctly. Trees present in the first survey only always get zero increment; such values can be replaced by model-based estimates in a subsequent step. The function allows to choose between four methods of increment calculation (parameter method):

Value

The input data frame with two additional columns: iv_hub_m3_ha_per_rep and iv_hub_m3_ha_yr_rep. They represent the periodic and the (mean) annual tree volume increment in m³/ha under bark and after harvest.

See Also

Other increment: harmonize_inv_for_repsurv(), increment_base_table(), increment_base_table_main_stand(), increment_ytables_base_table(), inv_inc_big_overview(), inv_inc_big_overview_2nd_only(), inv_inc_big_overview_matches_only(), inv_inc_fill_gaps_gnfi3(), inv_inc_summaric(), inv_inc_tree_2_plot(), inv_inc_tree_consolidate(), inv_inc_tree_extend(), inv_inc_tree_extend_combined(), inv_increment_gnfi3(), inv_increment_repeated_survey(), inv_increment_repsurv_ccirc(), inv_increment_ytables(), is_fe_increment_repsurv(), match_2_inventories(), match_2_inventories_by_center_coord(), match_2_inventories_by_plot_id(), match_plot_statistics(), match_trees_on_inventory_repsurv_ccirc(), match_trees_on_plot_repsurv_ccirc(), output_increment_base_table(), output_increment_base_table_pdf(), output_increment_overall(), output_increment_overall_pdf(), output_increment_overview_gnfi3(), output_increment_overview_gnfi3_pdf(), output_increment_overview_ytables_pdf(), reclassify_pseudo_ingrowth_ccirc()

Examples

  # When called directly, considerable preparation is required
  inv_a <- data_ex3_previous_sample_fe_inventory
  inv_b <- data_ex3_sample_fe_inventory

  # Match inventory points
  inv_pt_mtch <- match_2_inventories(inv_a, inv_b, "plot_id", "baysf")

  inv_a_trees <- data_ex3_previous_sample_trees_essentials
  inv_b_trees <- data_ex3_sample_trees_essentials

  # Now, match both inventories on tree level
  mtch_trs <- match_trees_on_inventory_repsurv_ccirc(
    inv_pt_mtch, inv_a, inv_b, inv_a_trees, inv_b_trees,
    tree_id_style = "baysf"
  )

  # Finally, calculate the increments
  tree_inc_repsurv(mtch_trs, method = "rep_classic")
  tree_inc_repsurv(mtch_trs, method = "rep_mean")
  tree_inc_repsurv(mtch_trs, method = "rep_end")
  tree_inc_repsurv(mtch_trs, method = "rep_trans")


Add Essential Information Like Species Groups, DBH-Classes, Basal Areas, and Volumes to a Trees Data Frame

Description

Function for intermediate calculations between pulling a trees data frame from an fe_inventory object with pull_trees and making aggregated evaluations and plots. Made for avoiding double calculations of tree volume, basal area, and species groups.

Usage

trees_add_essentials(
  inv_trees,
  method = c("WWK", "BaySF"),
  dbh_interval = 5,
  age_interval = 20
)

Arguments

inv_trees

Data frame which covers trees from an inventory (each row is a tree), obtained from an fe_inventory object with pull_trees and then height-completed. The column height_m must be present and must not contain any missing values. Note that pull_trees alone may legitimately return trees with missing heights (they are not filled in during import); complete them first, e.g. with height_complete_inventory followed by fill_heights_back (or the h_est_m fallback shown in the examples). A missing height_m column, or any NA height, is rejected with an informative error.

method

Character string indicating the method to be used for the species groups calculation. Default is "WWK", which is the method used for the species coding tum_wwk_short. Additionally "BaySF" is available, for classifying species according to the groups of the Bavarian State Forest Enterprise (bavrn_state_short).

dbh_interval

Integer indicating the interval breaks for the dbh classes to be formed. The breaks are internally handed over to cutas its parameter breaks. Default is 5-cm-classes, where diameters over 60 cm are all put into one class.

age_interval

Integer indicating the interval breaks for the age classes to be formed. The breaks are internally handed over to cut as its parameter breaks. Default is 20-years-classes, where ages over 160 years are all put into one class.

Value

The original data frame but with the additional columns

species_group:

Translation of the original species ids into the fe_species_tum_wwk_short

coding, which is useful for aggregated evaluations,

dbh_class:

The dbh class each tree belongs to according to dbh_breaks as an ordered factor,

age_class:

The age class each tree belongs to according to age_breaks as an ordered factor,

g_m2:

Basal area of each tree in m²,

v_m3:

Standing wood volume of each tree over bark in m³ (calculated with v_gri),

v_hub_m3:

Harvested wood volume of each tree under bark in m³ (calculated with v_red_harvest_ubark).

standing_area_m2:

Tree specific standing areas, calculated with the function standing_area_gnfi3

Examples

# Complete heights are necessary for trees_add_essentials. The h_q fallback
# warning is expected here (some species x layer groups lack a measured height).
trees_with_heights <- suppressWarnings(
  data_ex3_sample_fe_inventory |>
    pull_trees() |>
    height_complete_inventory(method = "Bavaria") |>
    dplyr::mutate(height_m = ifelse(!h_m_tree, h_est_m, height_m))
)

# Actual application
trees_add_essentials(trees_with_heights)


Validate an fe_inventory Object

Description

Regular users will not require this function. Expert users will want to use it in combination with the constructor new_fe_inventory. Regular users, please construct fe_inventory objects with fe_inventory.

Usage

validate_fe_inventory(x)

Arguments

x

an object that is expected to be a correct fe_inventory object

Value

Returns x, but this function is mainly called for its side effect which is pointing out any violations of the fe_inventory object specifications. In case of such violations, the function will terminate with an error.

Examples

validate_fe_inventory(data_ex4_sample_fe_inventory)


Complete Bavarian-State-Forest Yield-Table Selection

Description

A yield-table selection assigning a ForestElementsR yield table to every bavrn_state tree species code, for use with inv_increment_ytables and its overview. It is FeNEU's completed counterpart to ForestElementsR::ytables_bavrn_state_var_1: that FER dataset predates the additional bavrn_state tree species codes introduced in ForestElementsR 3.0.0 and does not cover them, so inv_increment_ytables aborts on data containing such species (e.g. recent Bavarian State Forest inventories). This selection covers all current bavrn_state tree species codes and is therefore the recommended default for the bavrn_state coding.

Usage

ytables_bavrn_state_var_1_feneu

Format

A tibble with one row per species, and two columns:

species_id

An fe_species_bavrn_state vector (ForestElementsR species coding "bavrn_state") identifying the tree species.

ytable_name

(character) The name of the ForestElementsR yield-table object assigned to that species (e.g. "fe_ytable_spruce_gehrhardt_moderate_1921").

Details

The 20 species not present in the FER selection are assigned a surrogate yield table by genus / species-group analogy to an already-assigned congener (e.g. the additional oaks use the oak table, the elms the ash table). Three assignments are silvicultural judgement calls: the cedars (Atlaszeder, Libanonzeder) use the larch table, because the Bavarian State Forest counts them in the larch species group; the Baumhasel uses the birch table, as a minor broadleaf (“sonstiges Laubholz”). The remaining 45 species keep exactly the assignments of ForestElementsR::ytables_bavrn_state_var_1.

Source

Extends ForestElementsR::ytables_bavrn_state_var_1 with surrogate assignments for the tree species codes it does not cover.

See Also

inv_increment_ytables, ForestElementsR::ytables_bavrn_state_var_1