Vertical Volume Weighted Mean of Matter Concentrations in Water Bodies

Share:

Description

Calculate vertical mean values which respect to depths of different layers or lake morphometry.

Usage

1
vertmean(depth, vari, level, top, bot, vol, total=FALSE)

Arguments

depth

sorted vector of sampled depths,

vari

measurements corresponding to depth (concentration, temperature, ...),

level

surface water level (above ground or above sea level (m a.s.l.), depending on bathymetric function used,

top

top water level of requested layer over which to average or integrate,

bot

bottom water level of requested layer over which to average or intgrate,

vol

hypsographic function to be used (e.g. vol.depth),

total

if TRUE the total sum over the water body is returned (integrated value), instead of the volumetric mean.

Value

Volumetric average respectively total value (for total =TRUE) for a given quantity (concentration, energy, temperature) in the requested layer between depths top and bottom.

Author(s)

Thomas Petzoldt

See Also

coriolis, viscosity, diffcoeff, ssd2rad, gravity

Examples

 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
56
57
58
59
60
61
62
63
64
65
66
67
## define a bathymetric formula for a given lake or basin
## z:     water depth  (m below surface)
## zz:    water column (m above ground)
## level: total water depth (m above ground or above reference level)
weight.vol <- function(z, level) {
  zz  <- level - z
  if (any(zz < 0)) stop("depth > maximum depth")
  vol <- 175947 * zz^2 + 2686 * zz^3 # m^3
}

## area is first derivative
area <- function(z, level) {
  zz  <- level - z
  A   <-   0.5 * 175947 * zz + 1/3 * 2686 * zz^2 # m^2
}

## dummy formula for depth-weighted averaging
## (water column, instead of bathymetric curve)
weight.column <- function(z, level) {z}

## Plot of lake volume (bathymetric curve)
par(mfrow = c(1, 2))
z <- 0:12
V <- weight.vol(z, 12)
plot(V, z, type = "l", ylim = c(12, 0), xlab = "Volume (m3)",
  ylab = "Depth (m)")
polygon(c(V, 0), c(z, 0), col = "cyan")

## Test Data
level <- 12
depth <- c(0, 1, 3.5, 5, 7, 10, 10.5, 11.5)
pconc <- c(3.7, 4.2, 6.1, 8.9, 7.8, 9.7, 11.4, 11.4)

## Plot test data
plot(pconc, depth, xlim=range(c(0, pconc)), ylim=c(12,0), type="n",
  xlab="P concentration (mu g / L)", ylab="Depth (m)")
segments(rep(0, 13), depth, pconc, depth, lwd=3)

## simple means
m <- mean(pconc[depth <= 4])
lines(c(m, m), c(0, 4), col="blue", lwd=2)

m <- mean(pconc[depth >= 4])
lines(c(m, m), c(4, 12), col="blue", lwd=2)

## depth weighted
m <- vertmean(depth, pconc, level, top=0, bot=4, weight.column)
lines(c(m, m), c(0, 4), col="red", lwd=2)

m <- vertmean(depth, pconc, level, top=4, bot=12, weight.column)
lines(c(m, m), c(4, 12), col="red", lwd=2)

## volume weighted
m <- vertmean(depth, pconc, level, top=0, bot=4, weight.vol)
lines(c(m, m), c(0, 4), col="green", lwd=2)

m <- vertmean(depth, pconc, level, top=4, bot=12, weight.vol)
lines(c(m, m), c(4, 12), col="green", lwd=2)

m <- vertmean(depth, pconc, level, top=4, bot=12, weight.vol)
lines(c(m, m), c(4, 12), col="green", lwd=2)

legend("topright", col=c("blue", "red", "green"), lwd=2, cex=0.7,
  legend=c("non weighted", "depth weighted", "volume weighted"))

## total sum over the whole water column
vertmean(depth, pconc, level, top=0, bot=12, weight.vol, total=TRUE)

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.