getAwPfromBathy: Bathymetry interpreter

View source: R/utilities_public.R

getAwPfromBathyR Documentation

Bathymetry interpreter

Description

Compute Area A(h), width w(h) and wet perimeter P(h) from a bathymetry profile (a,z).

Usage

getAwPfromBathy(
  bathy,
  hgrid = seq(min(bathy[, 2]), max(bathy[, 2]), diff(range(bathy[, 2]))/1000),
  segmentLength = sum(sqrt(apply(apply(bathy, 2, diff)^2, 1, sum)))/1000
)

Arguments

bathy

data frame, 2 columns containing abscissa (increasing values) and stage.

hgrid

numeric vector, grid of h values where A, w and P are computed. By default 1000 values in the range of bathymetry's z.

segmentLength

numeric, segment length for bathymetry subsampling. By default 1/1000 of the total bathymetry's perimeter.

Value

A 4-column dataframe containing h, A(h), w(h) and P(h)

Examples

bathy=data.frame(a=c(0,0,0,1,2,2,4,6,8),h=c(3,2,0,-0.5,0,2,2.0001,2.3,3))
plot(bathy,type='l')
df=getAwPfromBathy(bathy)
plot(df$h,df$A,type='l')
plot(df$h,df$w,type='l')
plot(df$h,df$P,type='l')

BaM-tools/RBaM documentation built on April 11, 2025, 10:01 p.m.