Package 'BlueCarbon'

Title: Collection of Functions for Blue Carbon Scientists
Description: The BlueCarbon package is a collection of functions with the main focus to help "blue carbon" scientists.
Authors: Valentina Costa [aut, cre] (ORCID: <https://orcid.org/0000-0002-1513-0284>), Márcio Martins [ctb] (ORCID: <https://orcid.org/0000-0002-6969-2215>)
Maintainer: Valentina Costa <[email protected]>
License: file LICENSE
Version: 0.0.1.1
Built: 2026-06-19 08:13:59 UTC
Source: https://github.com/valybionda/BlueCarbon

Help Index


bc_compaction

Description

Calculates Percentage of core compression for cores Accepts a data.frame with core properties and returns a modified version of it, with the addition of the estimated parameters

Usage

bc_compaction(
  core_data,
  sampler_length = "sampler_length",
  internal_distance = "internal_distance",
  external_distance = "external_distance"
)

Arguments

core_data

data.frame with core properties

sampler_length

name of the column with the total length of the sampler tube

internal_distance

name of the column with distance between sampler top and core surface

external_distance

name of the column with distance between sampler top and sediment surface

Value

the initial data.frame with the addition of Percentage of core compression


Blue Carbon sediment core data

Description

Example data from cores collected for Blue Carbon stock estimations in Portugal. Cores have been de-identified.

Usage

data(bc_data)

Format

Two dataframes, with core and sample properties

bc_cores

TODO

bc_samples

TODO

Examples

data(bc_data)
TODO

bc_decomp

Description

This function uses six arguments

Usage

bc_decomp(
  data,
  sampler_length,
  internal_distance,
  external_distance,
  sampler_diameter,
  method = "linear"
)

Arguments

data

data.frame with the following columns "ID" "cm" "weight" "LOI" "c_org".

sampler_length

name of the column with the total length of the sampler tube

internal_distance

The length in cm of the part of the sampler left outside of the sediment (from the inside of the sampler).

external_distance

The length in cm of the part of the sampler left outside of the sediment (from the outside of the sampler).

sampler_diameter

diameter in cm of the sampler

method

used to estimate the decompressed depth of each section, "linear" or "exp". Default is "linear".


bc_depth_correction

Description

Calculates corrected sample depth and sample volume to account for compaction (linear or exponential methods). User provides a core data.frame and a sample data.frame User can specify if the sample volume is estimated from a half of the core or in another way.

The function returns the sample data.frame modified with the addition of the estimated parameters

Usage

bc_depth_correction(
  core_data,
  sample_data,
  sampler_length = "sampler_length",
  sampler_diameter = "sampler_diameter",
  internal_distance = "internal_distance",
  external_distance = "external_distance",
  method = "linear"
)

Arguments

core_data

data.frame with core properties

sample_data

data.frame with sample properties

sampler_length

name of the column with the total length of the sampler tube

sampler_diameter

name of the column with the diameter of the sampler tube

internal_distance

name of the column with distance between sampler top and core surface

external_distance

name of the column with distance between sampler top and sediment surface

method

linear or exponential correction

Value

the initial sample_data with the addition of the corrected sample depth and volume


bc_stock()

Description

Estimate the stock of an element contained given its concentration along a sediment core.

Usage

bc_stocks(
  sample_data,
  core_id,
  sample_depth,
  element_concentration,
  maximum_depth,
  method = NULL,
  section_height = NULL,
  diagnostic_plot = FALSE
)

Arguments

sample_data

Sediment sample properties, after calculating elemental concentration and correcting compaction

core_id

Name of for core the identifier. Should be a string

sample_depth

Name of variable for the depth at which samples were taken

element_concentration

Name of the variable for the concentration of the element whose stock is being estimated

maximum_depth

Depth to which to estimate the stock.

method

Method used to estimate the stock, one of "rectangle" or "trapezoid"

diagnostic_plot

Should a plot of how the stock was estimated be shown? FALSE (default) or TRUE

section_start

(Optional, only for "rectangle" method) Depth at which the core section represented by each sample begins

section_end

(Optional, only for "rectangle" method) Depth at which the core section represented by each sample ends

Details

Calculate elemental stocks:

  1. Trapezoid rule (Martins, M. et al 2021)

  2. Rectangle rule (Howard, J. et al 2014)

  • User provides start and end of sections represented by samples

  • Heights of sections are automatically estimated 3.(optional) - Plots how the stock is being estimated, with a special draw towards any sections that have to be extrapolated


plot_stock_diagnostic

Description

Internal function used to plot stock estimations in bc_stocks

Usage

plot_stock_diagnostic(
  sample_data,
  core_id,
  sample_depth,
  element_concentration,
  maximum_depth,
  method
)

Arguments

sample_data

Sample data as a list, split by sediment core

method

Method used to calculate elemental stock