BlueCarbon is a collection of functions with the main focus to help "blue carbon" scientists
Please note that the devtools, tidyverse, aomisc, drc package are necessary, and must be available prior to the installation of 'BlueCarbon'.
install.packages("tidyverse") # only the first time
install.packages("drc") # only the first time
install.packages("devtools") # only the first time
devtools::install_github("OnofriAndreaPG/aomisc")
library("aomisc")
library("tidyverse")
library("drc")
Install the BlueCarbon package (and the vignettes):
# You can install (and update) the BlueCarbon package from GitHub
devtools::install_github("costavale/BlueCarbon", build_vignettes = TRUE)
To use the functions collected here, you need to provide 2 data.frame:
- Sediment core properties
- Sediment sample properties
The data is expected to follow tidy data format, with one observation per row and one variable per column.
In particular, for each core core_ID (one row per each core) the following information need to be provided :
- sampler_length, total length of the sampler
- sampler_diameter, internal diameter of the sampler
- internal_distance, distance between sampler top and core surface
- external_distance, distance between sampler top and sediment surface
- Core_ID, Important use the same identification code in both data.frames as this column is the key to identify the core from which a sample is originated.
- sample_ID, identification code used to identify each sample
- depth, sampling depth in cm of each sample
- weight, weight in g of each sample
- LOI, value of each sample
- Corg, value of each sample
- other variables (optional)
The following functions are presented:
- bc_compaction (WORKING)
- bc_depth_correction (WORK IN PROGRESS)
- bc_decomp (OLD VERSION - NOT WORKING)
- bc_stock (WORK IN PROGRESS)
The user provides the core_data data.frame and the function calculates compaction rates (in percentage) adding a column in the data.frame.
The function uses four arguments
bc_compaction(
core_data,
sampler_lenght,
internal_distance,
external_distance)
core_data
data.frame with core propertiessampler_lenght
name of the column with the length of the sampler,internal_distance
name of the column with the distance between sampler top and core surface,external_distance
name of the column with the distance between sampler top and sediment surface
compaction rates, percentage of compression in the core
The user provides the core_data data.frame and the sample_data sample data.frame and the function calculates corrected sample depth and sample volume to account for compaction (linear or exponential methods).
The 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.
bc_depth_correction(
core_data,
sample_data,
sampler_lenght,
sampler_diameter,
internal_distance,
external_distance,
method)
core_data
data.frame with core properties,sample_data
data.frame with sample properties,sampler_length
name of the column with the length of the sampler,sampler_diameter
name of the column with the diameter of the sampler,internal_distance
name of the column with the distance between sampler top and core surface,external_distance
name of the column with the distance between sampler top and sediment surfacemethod
used to estimate the decompressed depth of each section, "linear" or "exp". Default is "linear"
corrected sample depth, sample depth corrected taking into account the compaction rate sample volume, volume of each sample corrected for the compaction rate
Suggestions:
Break down in 2 functions:
1. Correct sample depth and sample volume to account for compaction (linear and exponential methods). Currently done in `bc_decomp`
- User provides the core data.frame from `1` and another data.frame with the sample data. User can specify if the sample volume is estimated from a half of the core or if the sample volume was measured in another way.
2. Estimate carbon content from LOI, using pre-measured values. Currently done in `bc_decomp`
- User can provide some measurements of carbon content and organic matter. The OC content of samples where OC was NOT measured is then added (when OC was measured, that value is maintained). Also allows the user to provide more data that just the one being analyzed (if you are analyzing cores from one area but have more samples with measured OC contents and wnat to use them in your model)
2.1 Add dry bulk density and carbon concentation (g cm3)
bc_decomp uses six arguments
bc_decomp(data, tube_lenght, core_in, core_out, diameter, method = "linear)
data
data.frame with the following columns "ID" "cm" "weight" "LOI" "c_org"tube_length
length in cm of the sampler,core_in
length in cm of the part of the sampler left outside of the sediment (from the inside of the sampler),core_out
length in cm of the part of the sampler left outside of the sediment (from the outside of the sampler),diameter
in cm of the samplermethod
used to estimate the decompressed depth of each section, "linear" or "exp". Default is "linear"
The output is a data.frame that use the same "ID" of the data provided. For each row, the following information are calculated:
cm_deco
, decompressed depth of each section expressed in cm
sect_h
, height of each section expressed in cm
volume
, volume of each section expressed in cm3
density
, density of each section expressed in g/cm3
c_org_est
, estimation of organic carbon concentration based on the linear relationship between LOI and c_org data provided
c_org_density
, density of organic carbon concentration expressed in g/cm3
c_org_dens_sect
, density of organic carbon concentration of each section expressed in g/cm2
bc_stock calculates carbon stock
bc_stock(data, depth = 1)
data
data.frame with the following columns "ID", "cm_deco", "c_org_dens_sect"depth
used to standardize the amount of carbon stored. Default is 1 m
Please note that the BlueCarbon project is released with a Contributor Code of Conduct. By contributing to this project, you agree to abide by its terms.