prep_reach_dist: Calculate the distance from a well to each reach within a...

Description Usage Arguments Value Examples

View source: R/prep_reach_dist.R

Description

Calculate the distance from a well to each reach within a stream network. This function splits a polyline stream network up into a series of evenly spaced points and calculates the distance from each of those points to a well.

Usage

1
2
3
4
5
6
7
8
9
prep_reach_dist(
  wel_lon,
  wel_lat,
  stream_shp,
  reach_id,
  stream_pt_spacing,
  buffer_width = 0.1,
  nseed = 1
)

Arguments

wel_lon

longitude of well

wel_lat

latitude of well

stream_shp

shapefile of stream reaches

reach_id

string indicating name of column in stream_shp that

stream_pt_spacing

distance between points used for sampling each stream reach. The actual distance between points will be close to this (but not necessarily exact) due to sampling rounding error. The finer spacing you use, the more accurate your results will be but the function will run slower and use more memory.

buffer_width

width of buffer around stream used to match points with polylines

nseed

seed for random number generator (this is used to convert stream polylines to points)

Value

A data frame with four columns:

reach

a grouping variable with the name of each stream reach

dist

distance of a point on that stream reach to the well of interest

lat

latitude of that point

lon

longitude of that point

This data frame can be plugged directly into apportion_inverse, apportion_polygon (if latlon=T), or apportion_web

Examples

1
2
3
rdll <- prep_reach_dist(wel_lon = 295500, wel_lat = 4783200,
   stream_shp = stream_lines, reach_id = "reach", stream_pt_spacing = 1)
head(rdll)

streamDepletr documentation built on March 26, 2020, 7:27 p.m.