View source: R/utilities_public.R
getAwPfromBathy | R Documentation |
Compute Area A(h), width w(h) and wet perimeter P(h) from a bathymetry profile (a,z).
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
)
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. |
A 4-column dataframe containing h, A(h), w(h) and P(h)
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')
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.