Skip to contents

Calculate the volume of a lake using bathymetry data or a hypsograph

Usage

calculate_lake_volume(
  bathy_raster = NULL,
  hyps = NULL,
  depth = NULL,
  return_rast = FALSE
)

Arguments

bathy_raster

SpatRaster object with the bathymetry data.

hyps

data.frame with columns 'depth' and 'area'.

depth

numeric. The depth to which to calculate the volume. If provided, the volume will be calculated to this depth. If not provided, the volume will be calculated to the maximum depth of the bathymetry raster or the hypsograph.

return_rast

logical. If TRUE, return a raster with the calculated volume in each grid cell. Default is FALSE.

Value

numeric. The volume of the lake in cubic meters.

Examples

shoreline <- readRDS(system.file("extdata/rotoma_shoreline.rds",
package = "bathytools"))
point_data <- readRDS(system.file("extdata/depth_points.rds",
package = "bathytools"))
bathy_raster <- rasterise_bathy(shoreline = shoreline,
point_data = point_data, crs = 2193)
#> Generating depth points... [2024-11-13 23:08:19]
#> Finished! [2024-11-13 23:08:19]
#> Interpolating to raster... [2024-11-13 23:08:19]
#> Adjusting depths >= 0 to  -0.82 m
#> Finished! [2024-11-13 23:08:36]

calculate_lake_volume(bathy_raster = bathy_raster)
#> [1] 435826908