Description Usage Arguments Details Value Author(s) Examples
View source: R/calc_stream_voronoi_weights.R
These coordinates are used as "weights" in the PBJ MODFLOW-USG package to interpolate heads and distribute flows.
1 2 3 4 5 6 7 8 9 10 11 | calc_stream_voronoi_weights(
stream,
voronoi,
triangles,
addTo = NULL,
geometry = T,
correct_seg_order = T,
cutoff_value = 1e-07,
seg_min_length = 1e-07,
keep_stream_cols = NULL
)
|
stream |
sf polyline, "exploded" into segments (see |
voronoi |
sf polygon of voronoi tesselation (unstructured model grid). Shapefile ID field will be used to determine node ID. |
triangles |
sf polygon of delaunay triangulation corresponding to voronoi grid. |
addTo |
(optional) existing calc_stream_voronoi_weights() output new output should be added to (False by default) |
geometry |
(optional) T/F whether to include sf geometry in output dataframe (default: True) |
correct_seg_order |
(optional) T/F to re-order the line segments after finding overlaps with the triangle grid. Will crash if you have multiple seperate lines (e.g. two streams). (default: True) |
cutoff_value |
numeric, minimum barcentric coordinate value. Values below will be forced to zero (1e-7 by default) |
seg_min_length |
numeric, minimum length of segment to include in calculation (default 1e-7). Generally just to weed out numerical errors. |
keep_stream_cols |
character array, columns in stream segment dataframe to add to returned dataframe. |
The function can take a while to run
DataFrame or sf object, if geometry = True. Each row is one segment-triangle overlap, with six barycentric weights (three for segment end), the three voronoi shape IDs (model nodes) connected by the triangle, and the segment length in the triangle.
This the expected input of stream_elev_from_slope
and
the calc_conductance*
functions (e.g. calc_conductance_modflow
)
Leland Scantlebury
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | #-- Read in shapefiles
str <- read_sf(system.file("extdata", "MehlandHill2010_stream.shp", package = "pbjr"))
tri <- read_sf(system.file("extdata", "720_triangles.shp", package = "pbjr"))
vor <- read_sf(system.file("extdata", "720_voronoi.shp", package = "pbjr"))
#-- Explode polyline
str <- line_explode(str)
#-- Run the function
swdf <- calc_stream_voronoi_weights(stream = str, voronoi = vor, triangles = tri)
#-- Example of addTo use (more likely run with new stream shapefile)
more_swdf <- calc_stream_voronoi_weights(stream = str, voronoi = vor, triangles = tri,
addTo = swdf)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.