Salinity

## ============================================================================
## Code to produce a temperature-salinity plot
## implemented by Karline Soetaert
## ============================================================================

library(marelac)
library(plot3D)
S.seq  <- seq(from = 30, to = 38, length.out = 100)
t.seq  <- seq(from = -5, to = 30, length.out = 100)
sig.mat <- outer(S.seq, t.seq, FUN = function(S, t) sw_dens(S = S, t = t) - 1000)

contour2D(x = S.seq, y = t.seq, z = sig.mat, lwd = 2,
   xlab = "Salinity, psu", ylab = "Temperature, dgC", 
   main = "Sigma, p = 0 dbars")

# Measurements:
t <- c(10.119,    4.036,  13.062,  -0.579,  21.602,   2.984, 
       24.836,    0.111, 14.954)
S <- c(34.7130, 33.7890, 35.5660, 33.6816, 36.5660, 34.5210, 
       36.4310, 32.8912, 35.9200)
sigma <- sw_dens(S = S, t = t) - 1000       

scatter2D(S, t, colvar = sigma, pch = 18, cex = 2, add = TRUE, 
   clim = range(sig.mat), colkey = FALSE)

Go back