The lakefetch package has been validated through three
complementary approaches:
All validation scripts are included in the package under
inst/validation/.
Analytical validation uses synthetic lake geometries where the expected fetch values can be calculated mathematically. This provides the most rigorous test of algorithm correctness.
| Test | Geometry | Expected | Result |
|---|---|---|---|
| Circular lake center | r=1000m, point at center | 1000m all directions | PASS (0% error) |
| Circular lake edge | r=1000m, point 800m from center | Min: 200m, Max: 1800m | PASS (0% error) |
| Rectangular lake N/S | 2000x1000m, center point | 500m | PASS (0% error) |
| Rectangular lake E/W | 2000x1000m, center point | 1000m | PASS (0% error) |
| Effective fetch | Circular center, top 3 mean | 1000m | PASS (0% error) |
Literature validation compares fetch calculations against real lakes with published morphometry data from the World Lake Database (ILEC) and state limnology surveys.
| Lake | State | Published Area | Calculated Area | Result |
|---|---|---|---|---|
| Lake Sunapee | NH | 16.7 km² | 16.85 km² | PASS |
| Cayuga Lake | NY | 172 km² | 173.87 km² | PASS |
| Green Lake | WI | 29.6 km² | 32.66 km² | PASS |
For each lake:
Cayuga Lake (a Finger Lake) correctly hit the 50 km fetch cap, demonstrating proper handling of very elongated lakes.
Edge case validation tests challenging geometries that could cause algorithm failures.
| Test | Geometry | Key Finding | Result |
|---|---|---|---|
| Central island | Island at lake center | Rays correctly stop at island | PASS |
| Offset island | Island 800m north of center | North rays blocked at 500m | PASS |
| Complex shoreline | Sinusoidal variation ±300m | Fetch varies 1119-1881m | PASS |
| Multiple islands | 3 islands at different positions | Each blocks rays independently | PASS |
| Very large lake | Lake Erie | OSM limitation* | SKIPPED |
*Great Lakes require pre-downloaded shapefiles due to OSM bounding box limitations.
The lakefetch package implements fetch calculation
following established standards:
The Shore Protection Manual defines effective fetch using radial
measurements weighted by direction. lakefetch uses a
similar ray-casting approach with configurable angular resolution
(default 5°). ### Mason et al. (2018)
Mason et al. used a comparable ray-casting approach to create effective fetch maps for the Great Lakes at 30m resolution. Their methodology was validated against USACE Wave Information Studies (R² = 0.635).
lakefetch calculates effective fetch as the mean of the
top 3 directional fetch values. This provides a robust exposure metric
independent of specific wind direction, suitable for ecological
applications where wind patterns may vary.
In addition to validation scripts, the package includes 79 formal
unit tests using the testthat framework:
| Test File | Tests | Coverage |
|---|---|---|
| test-fetch_core.R | 18 | Core algorithm, analytical validation |
| test-data_loading.R | 25 | Input handling, column detection |
| test-options.R | 24 | Configuration management |
| test-visualization.R | 12 | Plotting functions |
Run tests with:
The package passes R CMD check with:
The validation suite demonstrates that lakefetch:
Mason, L.A., Riseng, C.M., Layman, A.J., Jensen, R. (2018). Effective fetch and relative exposure index maps for the Laurentian Great Lakes. Scientific Data 5:180295. doi:10.1038/sdata.2018.295
U.S. Army Corps of Engineers (1984). Shore Protection Manual, 4th ed.
Håkanson, L.A. (1981). A Manual of Lake Morphometry. Springer-Verlag.