Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/EarthSystemDiagnostics/sedproxy
An R package for modelling sediment archived climate proxy records.
https://github.com/EarthSystemDiagnostics/sedproxy
Last synced: about 1 month ago
JSON representation
An R package for modelling sediment archived climate proxy records.
- Host: GitHub
- URL: https://github.com/EarthSystemDiagnostics/sedproxy
- Owner: EarthSystemDiagnostics
- License: other
- Created: 2018-11-23T11:13:05.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2023-09-20T12:18:36.000Z (over 1 year ago)
- Last Synced: 2024-10-29T19:57:36.276Z (2 months ago)
- Language: R
- Homepage: https://earthsystemdiagnostics.github.io/sedproxy/
- Size: 46.5 MB
- Stars: 7
- Watchers: 3
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.Rmd
- License: LICENSE
Awesome Lists containing this project
- open-sustainable-technology - sedproxy - An R package for modeling sediment archived climate proxy records. (Climate Change / Earth and Climate Modeling)
README
---
output: github_document
---# Sedproxy: Simulation of Sediment Archived Climate Proxy Records.
[![R-CMD-check](https://github.com/EarthSystemDiagnostics/sedproxy/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/EarthSystemDiagnostics/sedproxy/actions/workflows/R-CMD-check.yaml)
[![codecov](https://codecov.io/gh/EarthSystemDiagnostics/sedproxy/branch/master/graph/badge.svg?token=hht8uueIsX)](https://codecov.io/gh/EarthSystemDiagnostics/sedproxy)```{r knitr_setup, echo=FALSE}
knitr::opts_chunk$set(dev = "svg",
fig.path = "man/figures/README-",
out.width = "100%")
```## Introduction
`sedproxy` provides a forward model for sediment archived climate proxies. The forward model and its applications are described in detail in [(Dolman and Laepple, CP 2018)](https://www.clim-past.net/14/1851/2018/cp-14-1851-2018.html).
Please contact Dr Andrew Dolman <>, or Dr Thomas Laepple <>, at the Alfred-Wegener-Institute, Helmholtz Centre for Polar and Marine Research, Germany, for more information.
This work was supported by German Federal Ministry of Education and Research (BMBF) as Research for Sustainability initiative [FONA](https://www.fona.de/) through the [PalMod](https://www.palmod.de/) project (FKZ: 01LP1509C).
![](man/figures/PalMod_Logo_RGB.png)
## Installation
**sedproxy** is available from CRAN
```{r, eval=FALSE}
install.packages("sedproxy")
```Or the development version can be installed directly from GitHub
```{r, eval=FALSE}
if (!require("remotes")) {
install.packages("remotes")
}remotes::install_github("EarthSystemDiagnostics/sedproxy")
```## Shiny app
A Shiny app is available via an additional package `shinysedproxy` which is currently only available on Github
[shinysedproxy](https://github.com/EarthSystemDiagnostics/shinysedproxy)
```{r, eval=FALSE}
remotes::install_github("EarthSystemDiagnostics/shinysedproxy")
```It provides a graphical user interface to the main `sedproxy` function `ClimToProxyClim`. Currently this app forward models a proxy from a randomly generated input climate and serves only to illustrate the functionality of `sedproxy`. The user can alter the parameters of the forward model and observe the results graphically. In future versions it may be possible to load input climates and other input parameters from a file and to save the output.
To run the Shiny app enter the following in the R terminal:
```{r run_shiny, eval=FALSE}
library(shinysedproxy)
ShinySedproxy()
```![](man/figures/sedproxy-screenshot.png)
An online version of the Shiny app is hosted at [shinyapps.io](https://limnolrgy.shinyapps.io/sedproxy-shiny/)
Below are some brief examples of how to run `sedproxy` from a script or the command line.
## Example data
`sedproxy` includes example data for a single sediment core and location: core number 41 in the Shakun et al. (2012) compilation (`r sedproxy::N41.proxy.details$Core`, Rosenthal et al. 2003). The climate signal is taken from the [TraCE-21ka](http://www.cgd.ucar.edu/ccr/TraCE/) Simulation of Transient Climate Evolution over the last 21,000 years, using the grid cell closest to core `r sedproxy::N41.proxy.details$Core`. Seasonality of *G.ruber*, the Foraminifera for which test Mg/Ca ratios were measured, is taken from the model of Fraile et al (2008). Sediment accumulation rates were estimated from the depth and age data associated with core `r sedproxy::N41.proxy.details$Core`, with a minimum rate of 0.2 * the mean rate.
**The `r sedproxy::N41.proxy.details$Core` core**
```{r message = FALSE, warning = FALSE}
library(tidyverse)
library(knitr)
library(sedproxy)
``````{r}
N41.proxy.details %>%
mutate_if(is.numeric, round, digits = 2) %>%
gather() %>%
kable(., format = "markdown", digits = 2)
```**Input climate signal**
The first 5 rows:
```{r}
(N41.t21k.climate[1:5,]-273.15) %>%
kable(., format = "markdown", digits = 2)
```**Actual proxy record**
Core `r sedproxy::N41.proxy.details$Core` (Rosenthal et al. 2003)
```{r}
kable(head(N41.proxy), format = "markdown")
```*******
## Function `ClimToProxyClim`
`ClimToProxyClim` is the main function in package `sedproxy`. It simulates a sediment archived proxy from an assumed true climate signal, the sediment accumulation rate, seasonality of the encoding organism/process, and the number of samples per timepoint.
```{r , fig.show='hold', warning=FALSE}
set.seed(26052017)
clim.in <- N41.t21k.climate[nrow(N41.t21k.climate):1,] - 273.15# The input climate signal should be a time series object
# The Trace simulation runs to the year 1990 AD, therefore the start time for
# the input climate is -39 years BP
clim.in <- ts(clim.in, start = -39)PFM <- ClimToProxyClim(clim.signal = clim.in,
timepoints = round(N41.proxy$Published.age),
calibration.type = "identity",
habitat.weights = N41.G.ruber.seasonality,
sed.acc.rate = N41.proxy$Sed.acc.rate.cm.ka,
sigma.meas = 0.23,
sigma.ind = 2,
n.samples = 30,
n.replicates = 10)
``````{r}
PFM$everything
```**Simple plotting**
```{r default_plot, fig.width=6, fig.height=5.5}
PFM %>%
PlotPFMs(max.replicates = 1)
```**Plot 5 replicates of the final simulated proxy**
```{r plot_reps, fig.width=6, fig.height=5.5}
PFM %>%
#filter(stage == "simulated.proxy") %>%
PlotPFMs(., max.replicates = 5, plot.stages = "simulated.proxy")
```**Conversion to proxy units**
The initial input climate signal can be converted into "proxy units" if a `calibration.type` is specified. This simulates the Environment -> Sensor stage of the proxy system.```{r MgCa, fig.show='hold', warning=FALSE, echo=FALSE, eval=TRUE}
set.seed(26052017)
PFM_2 <- ClimToProxyClim(clim.signal = clim.in,
timepoints = round(N41.proxy$Published.age),
calibration.type = "MgCa",
#calibration = "Ten planktonic species_350-500",
habitat.weights = N41.G.ruber.seasonality,
sed.acc.rate = N41.proxy$Sed.acc.rate.cm.ka,
sigma.meas = 0.46,
sigma.ind = 0,
n.samples = 30,
n.replicates = 1)
``````{r MgCa_plot, fig.width=6, fig.height=5.5, echo=FALSE, eval=TRUE}
PFM_2 %>%
PlotPFMs(.)
```## Literature cited
Dolman, A. M. and Laepple, T.: Sedproxy: a forward model for sediment archived climate proxies, Clim. Past Discuss., https://doi.org/10.5194/cp-2018-13, in review, 2018.
Fraile, I., Schulz, M., Mulitza, S., & Kucera, M. (2008): Predicting the global distribution of planktonic foraminifera using a dynamic ecosystem model. Biogeosciences, 5: 891–911.
Laepple, T., & Huybers, P. (2013): Reconciling discrepancies between Uk37 and Mg/Ca reconstructions of Holocene marine temperature variability. Earth and Planetary Science Letters, 375: 418–429.
Rosenthal, Y., Oppo, D. W., & Linsley, B. K. (2003): The amplitude and phasing of climate change during the last deglaciation in the Sulu Sea, western equatorial Pacific. Geophys. Res. Lett., 30: 1428.
Shakun, J. D., Clark, P. U., He, F., Marcott, S. A., Mix, A. C., Liu, Z., Otto-Bliesner, B., Schmittner, A., & Bard, E. (2012): Global warming preceded by increasing carbon dioxide concentrations during the last deglaciation. Nature, 484: 49–54.