Adds attributes about the banks of each cross section in a dataframe of cross section points
Function adds "bottom", "left_bank", "right_bank" columns that are
the Z values of the "lowest" bottom point, and the "highest" left and right bank Z values, respectively. If there are
And also a "valid_banks" column is added that is TRUE if the hy_id/cs_id set of cross section point has at least 1 bottom point with
at least 1 left bank point AND 1 right bank point that are above the lowest "bottom" point.
Find braids and add to a dataframe/sf dataframe
Adds a 'braid_id' and 'is_multibraid' columns to an sf dataframe containing a crosswalk_id and sf linestring geometires
Add a unique 'hydrofabric_id` to each row of a dataframe
Internal conveniance function for when a dataframe / flowlines network does NOT have a specified ID column
Add relief attributes to a dataframe of cross sections points
Given a set of cross section points (derived from hydrofabric3D::cross_section_pts() and hydrofabric3D::classify_points()) add a "has_relief" logical
value to data. The "has_relief" value is indicating whether a cross section "has relief".
Relief is determined by checking each set of cross section points have a left OR right bank that
has a depth difference from the bottom that isgreater than or equal to a percentage of the cross section length (e.g. Assuming a 'pct_of_length_for_relief' of 0.01 (1%) of a 100m cross section would have a relief depth threshold of 1m)
Classify Cross Section Points (version 2)
Version 2 of cross section point classifier function, uses 1st and 2nd derivative of the depths to better classify channel points
Calculate the points per cross section based off length relative to a DEM
Given the length of cross sections and a DEM, approximate the appropriate number of points for each cross section length
Given a set of transect lines, a flowline network, extend the transect lines out given distances from the left and right
Flowlines are required to ensure valid transect intersection relationship is maintained
Give a set of transecct linestrings and poylgons and get the minimum distance to extend each transect line (from both directions, to try and reach the edge of a "polygons")
Superseces old version of function (now named extend_transects_to_polygons2())
Give a set of transecct linestrings and poylgons and get the minimum distance to extend each transect line (from both directions, to try and reach the edge of a "polygons")
DEPRECATED VERSION, use extend_transects_to_polygons()
WIP/internal function for extending transect lines out to FEMA 100 year flood plain polygons (VERSION 2)
Get attributes about the banks of each cross section in a dataframe of cross section points
Given a set of cross section points with point_type column, return a dataframe of the unique hy_id/cs_ids with the following calculated columns:
"bottom", "left_bank", "right_bank" columns which are the Z values of the "lowest" bottom point, and the "highest" left and right bank Z values, respectively.
And a "valid_banks" column indicating whether the hy_id/cs_id set of cross section point has at least a signle bottom point with
at least 1 left bank point AND 1 right bank point that are above the lowest "bottom" point.
Get relief attributes from a dataframe of cross sections points
Generate a dataframe from a set of classified cross section points indicating whether a cross section "has relief".
Relief is determined by checking each set of cross section points have a left OR right bank that has a depth difference from the bottom that is
greater than or equal to a percentage of the cross section length (e.g. Assuming a 'pct_of_length_for_relief' of 0.01 (1%) of a 100m cross section would have a relief depth threshold of 1m)
Detect whether a braid exists in a hydrologic network
Check if if a hydrologic network dataset contains any braids. If multiple discontinuous networks are within the 'network' data.
The function will try to infer the distinct networks and then check for braids in each component (using find_connected_components()).
Calculate percentage of points within a set of cross section points that are near the bottom of the cross section
Adds the following columns:
is_near_bottom: state whether a point is near the bottom of the cross section (within a specified distance threshold of the bottom),
pts_near_bottom: count of points near the bottom of the cross section
pct_near_bottom: percent of points near the bottom of the cross section
Check and fix cross section points with limited variation in Z values (version 2 latest)
This function takes in a set of cross section points (cs_pts), a flowline network (net) and a set of transects lines for that flowline network (cs).
The function that looks at the cross section points and identifies cross sections that are "flat"
(have a percent of all points in the cross section within a threshold distance from the bottom of the cross section).
The transect lines that generated the "flat" cross section points are then extended and new points are extracted
along this new longer transect line. The newly extracted points are checked for "flatness" and are removed if they are still "flat", otherwise the original dataset
of points is updated with the new set of point derived from an extended transect line.
Improved function for rectifying cross section points with flat Z values by extending transect lines and reevaluating the new DEM values.
Selectively removes intersecting transect lines
Attempts to remove transects intersecting other transects by first removing transects that interesect the most other transects, then re checking intersection condition, and doing this until there are no multi intersections
this gives the benefit of removing a transect line that intersects many other transects, potentially leaving those other transects with no extraneous intersections ONCE the MULTI intersecting transect is removed
Takes any transects that was extended and with multiple flowline intersections, and shortens them by the distance specified in the "extension_distance" column