mwlSource: Water Source Using Meteoric Water Line

View source: R/watercomp.R

mwlSourceR Documentation

Water Source Using Meteoric Water Line

Description

Given parameters describing a meteoric water line in H-O isotope space, generate a posterior sample of unevaporated source water values conditioned on one or more sample values.

Usage

mwlSource(obs, MWL = NULL, slope, stype = 1, edist = "unif", 
  eprior = NULL, ngens=1e4, ncores = 1)

Arguments

obs

iso object containing isotope values for one or more samples.

MWL

numeric. Vector of length 6 containing parameters describing a meteoric water line (see Details).

slope

numeric. Vector of length two specifying prior parameters for the evaporation line slope (mean, standard deviation).

stype

integer. Line statistic used to constrain the source prior: 1 = confidence interval, 2 = prediction interval (see Details).

edist

character. One of "unif" or "gamma", specifying whether the evaporation prior is modeled using a uniform or gamma distribution.

eprior

numeric. Vector of length 2 giving prior parameter estimates for the oxygen isotope evaporation effect. For edist = "unif" these are maximum and minimum values and the default values are c(0, 15). For edist = "gamma" these are shape and rate parameters, and the defaults are c(1, 1).

ngens

integer. Number of posterior samples to obtain (per chain).

ncores

integer. Number of cores to use for parallel processing.

Details

The prior distribution of source values is constrained by MWL, which contains the parameters: slope, intercept, average d18O, sum of squares in d18O, root mean square error, and number of samples for an empirically-determined meteoric water line. This object can be created from a H and O isotope dataset using the function mwl. The default value (if MWL = NULL) reflects the Global Meteoric Water Line estimated from a global precipitation compilation in Bowen, et al. (2019). stype determines how the source uncertainty about the MWL is calculated; the default (1, confidence interval) is appropriate if the source is best represented as an integrated mixture of the samples defining the MWL, whereas option 2 (prediction interval) is appropriate if the source is best represented as a single sample.

If ncores = 1, three chains will be run on a single core. If ncores > 1, ncores chains will be run in parallel on ncores cores.

Value

Returns an object of class “mwlSource”, a list containing:

summary

matrix. Summary table of JAGS MCMC results, including parameter posterior distributions and convergence statistics.

results

data.frame. Posterior samples of model parameters.

source_d2H

Hydrogen isotopic composition of unevaporated source.

source_d18O

Oxygen isotopic composition of unevaporated source.

S

Evaporation line slope.

E

Evaporation index, equal to the difference between the sample and unevaporated source mixture oxygen isotope values.

References

Bowen et al. (2019) Isotopes in the water cycle: Regional- to global-Scale patterns and applications. Annual Review of Earth and Planetary Sciences 47 453–479. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1146/annurev-earth-053018-060220")}.

Examples

#Prep MWL
O = runif(10, -15, -2)
H = O * 8 + 10 + rnorm(10, 0, 6)
MWL = mwl(data.frame(H, O), plot = FALSE)

#Sample data
obs = iso(-60, -6, 0.5, 0.1, 0)

#Evaporation slope
slope = c(5, 0.3)

#Run and report...likely not converged!
ws = mwlSource(obs, MWL, slope, ngens = 1e3)
ws$summary

#A traceplot 
plot(ws$results$source_d18O[1:1000], type = "l")
lines(ws$results$source_d18O[1001:2000], col = 2)
lines(ws$results$source_d18O[2001:3000], col = 3)

SPATIAL-Lab/isoWater documentation built on Dec. 9, 2024, 1:05 a.m.