| fetch_calculate | R Documentation |
Main entry point for fetch calculation. Takes sites and lake boundaries, calculates directional fetch using ray-casting, and returns results with exposure metrics.
fetch_calculate(
sites,
lake,
depth_m = NULL,
fetch_method = NULL,
add_context = TRUE,
find_max_fetch = FALSE
)
sites |
Data frame or sf object with site locations |
lake |
Lake boundary data from |
depth_m |
Water depth in meters for orbital velocity calculation. Can be a single value (applied to all sites), a vector (one per site), or NULL to use depth from sites data or default from options. |
fetch_method |
Method for calculating effective fetch. Options:
If NULL, uses the value from |
add_context |
Logical; add NHD context if available (default TRUE) |
find_max_fetch |
Logical; if TRUE, finds the location in each lake with
the maximum possible fetch using a longest-internal-chord algorithm. The
result is returned as a |
For each site, the function:
Assigns the site to its containing lake polygon
Buffers the site inward from shore (GPS accuracy adjustment)
Casts rays in all directions at specified angle resolution
Measures distance to shore in each direction
Calculates summary metrics (mean, max, effective fetch)
Calculates orbital velocity using depth
Derives exposure category (Sheltered/Moderate/Exposed)
Exposure thresholds can be configured via lakefetch_options.
A list with elements:
results |
sf object with fetch results for each site |
lakes |
sf object with lake polygons used |
angles |
Vector of angles used for fetch calculation |
max_fetch |
(only if |
Shore Protection Manual (1984). U.S. Army Corps of Engineers, Coastal Engineering Research Center. 4th Edition.
csv_path <- system.file("extdata", "sample_sites.csv", package = "lakefetch")
sites <- load_sites(csv_path)
lake <- get_lake_boundary(sites)
results <- fetch_calculate(sites, lake)
# With explicit depth
results <- fetch_calculate(sites, lake, depth_m = 5)
# Using cosine-weighted effective fetch (SPM method)
results <- fetch_calculate(sites, lake, fetch_method = "cosine")
# Access results
results$results # sf with all fetch data
results$lakes # lake polygons
# Find the location with maximum fetch in each lake
results <- fetch_calculate(sites, lake, find_max_fetch = TRUE)
results$max_fetch # sf with max fetch location per lake
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.