swath_stats {geoprofiler}R Documentation

Summary Statistics on Swath Elevation Profile

Description

Statistics of the elevation data across a swath profile.

Usage

swath_stats(x, profile.length = NULL)

Arguments

x

list. The return object of swath_profile()

profile.length

numeric or units object. If NULL the fractional distance is returned, i.e. 0 at start and 1 at the end of the profile.

Value

tibble

See Also

swath_profile()

Examples

# Create a random raster
r <- terra::rast(ncol = 10, nrow = 10, xmin = -150, xmax = -80, ymin = 20, ymax = 60)
terra::values(r) <- runif(terra::ncell(r))

# Create a random profile
profile <- data.frame(lon = c(-140, -90), lat = c(55, 25)) |>
  sf::st_as_sf(coords = c("lon", "lat"), crs = "WGS84")
swath <- swath_profile(profile, r, k = 5, dist = 10)

swath_stats(swath, profile.length = profile_length(profile_line(profile)))

[Package geoprofiler version 0.0.2 Index]