-
Notifications
You must be signed in to change notification settings - Fork 0
/
temp_calc.R
55 lines (54 loc) · 2.53 KB
/
temp_calc.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#' Calculate the temperature from d18Occ and the d18Osw
#'
#' Defaults to the relationship from Kim & O'neil 1997,
#' as updated by Bemis et al., 1998.
#'
#' @param d18Occ The oxygen isotope composition of the carbonate in VPDB.
#' @param d18Osw The oxygen isotope composition of the sea water in VSMOW
#' @param equation Character vector with the equation to use. Defaults to Kim & O'Neil, 1997.
#' @returns The temperature in degrees Celsius.
#' @author Ilja J. Kocken
#' @inherit supported_equations references
#' @examples
#' temp_calc(3, 0, "KimONeil1997")
#' @export
temp_calc <- function(d18Occ, d18Osw, equation = NULL) {
equation <- equation_supported(equation)
if (equation == "Shackleton1974") {
temp <- general_bemis_temp(d18Occ, d18Osw, a = 16.9, b = -4.0, c = NA, d = -0.20)
} else if (equation == "ErezLuz1983") {
temp <- general_bemis_temp(d18Occ, d18Osw, a = 17.0, b = -4.52, c = 0.03, d = -0.22)
} else if (equation == "KimONeil1997") {
temp <- general_bemis_temp(d18Occ, d18Osw, a = 16.1, b = -4.64, c = 0.09, d = -0.27)
} else if (equation == "Bemis1998") {
# there are a lot of variants in table 1
## d18Osw <- general_bemis_temp(d18Occ, temperature, a = 17.0, b = -4.52, c = 0, d = -0.20)
} else if (equation == "Marchitto2014") {
# Equation 9
# (δcp - δws + 0.27) = -0.245±0.005t + 0.0011±0.0002t² + 3.58±0.02
# (x - y + d) = a + b*t + c*t^2, where a = 3.58, b = -0.245 and c = 0.0011
temp <- -(sqrt(4 * 0.0011 * (-3.58 + d18Occ - d18Osw + 0.27) + (-0.245)^2) - 0.245) / (2 * 0.0011)
}
temp
}
#' General Bemis et al. 1998 table 1
#'
#' \eqn{T (°C) = a + b(\delta_{c} - \delta_{w}) + c(\delta_{c}- \delta_{w})^{2}}{T (°C) = a + b(δc - δw) + c(δc - δw)^2}
#'
#' @param d18Occ \eqn{\delta^{18}O}{δ18O} of the calcite in VPDB.
#' @param d18Osw \eqn{\delta^{18}O}{δ18O} of the sea water in VSMOW.
#' @param a Intercept.
#' @param b Slope.
#' @param c Slope of quadratic term.
#' @param d The conversion correction from VSMOW to VPDB.
#' @returns The calculated temperature in °C.
#'
#' @references Bemis, B. E., Spero, H. J., Bijma, J., & Lea, D. W. (1998). Reevaluation of the oxygen isotopic composition of planktonic foraminifera: Experimental results and revised paleotemperature equations. Paleoceanography, 13(2), 150–160. https://doi.org/10.1029/98PA00070
general_bemis_temp <- function(d18Occ, d18Osw, a, b, c, d) {
if (is.na(c)) {
temperature <- a + b * (d18Occ - (d18Osw + d))
} else {
temperature <- a + b * (d18Occ - (d18Osw + d)) + c * (d18Occ - (d18Osw + d))^2
}
temperature
}