Skip to contents

All functions

add_attribute_based_extension_distances()
Add an extension_distance column based off valid_banks and has_relief attributes
add_bank_attributes()
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.
add_braid_ids()
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_cs_area()
Adds a cs_area column to a set of cross section points
add_cs_area2()
Adds a cs_area column to a set of cross section points (v2)
add_cs_bathymetry()
Given provide inchannel widths and depths to a set of cross section points and derive estimated shapes
add_hydrofabric_id()
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_is_outlet_flag()
Adds a logical 'is_outlet' flag to a set of transects identifying the most downstream transect
add_length_col()
Add a length column to a sf geometry dataframe
add_needs_rectification()
Add a "needs_rectification" column to a sf/dataframe
add_point_type_counts()
Add the count of each point type as a column to a dataframe of section points
add_points_per_cs()
Add a points per cross section column to an sf dataframe of linestrings given a DEM and min points value
add_powerlaw_bankful_width()
Add powerlaw_bankful_width column
add_relief()
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)
add_tmp_id()
Function to add a new "tmp_id" column to a dataframe from 2 other columns
adjust_flagged_transects()
Update a flagged set of transects by shortening them by the given extension_distance
adjust_transect_lengths()
Extend/shrink an sf linestring dataframe by a specified lengths vector
align_banks_and_bottoms()
Align banks and smooth bottoms of cross section points
calc_validity_scores()
Calculates a validity score column based on valid_banks and has_relief columns in a set of cross section points
classify_points()
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
classify_points2()
Classify Cross Section Points (v1 deprecated)
classify_points4()
Classify Cross Section Points v1 (Deprecated version)
compare_cs_validity()
Compare valid_banks and has_relief between 2 sets of cross section points
cross_section_pts()
Get Points across transects with elevation values
cut_cross_sections()
Generate Cross Sections Across Hydrographic Network
cut_transect()
Generate a Perpendicular Linestring of a Given Width
cycle_edge_list_to_cycle_edge_df()
Convert output of find_cycles() to a dataframe Converts a node cycle list to a dataframe of nodes and cycle IDs, internal helper function.
cycle_node_list_to_cycle_node_df()
Convert output of find_cycles() to a dataframe Converts a node cycle list to a dataframe of nodes and cycle IDs, internal helper function.
dem_based_points_per_cs()
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
drop_incomplete_cs_pts()
Remove entire cross sections that have any NA Z (depth) values
extend_by_length()
Extend an sf linestring dataframe by a specified lengths vector
extend_by_percent()
Extend an sf linestring dataframe by a percent of the lines length
extend_transects_by_cs_attributes()
Extend transects for any transects with invalid cross section attributes
extend_transects_sides()
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
extend_transects_to_polygons()
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())
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)
extract_dem_values()
Given a set of linestrings, extract DEM values at points along the linestring
find_braids()
Find braided sections of a network and return the unique crosswalk_ids for each idenfied braid
find_cs_area2()
Given a specific depth, an array of depths, and relative_distances return the cross sectional area (v2)
fix_braided_transects()
Fix transects found on braided river sections (latest)
flag_transects_for_change()
Add a flagged and extension distance columns to set of transects with CS attributes based on new cross section points data
geos_extend_line()
Extend a geos_geometry linestring from, one or both ends, by a given distance (meters)
get_bank_attributes()
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_braid_list()
Create a list of braid IDs containing crosswalk_ids in each braid
get_cs_bottom_length()
Calculate the length between the leftmost and rightmost bottom point in each cross section
get_extensions_by_id()
Get the left and right extension distances for a set of transects out to a set of polygons
get_improved_cs_pts()
Check and fix cross section points with limited variation in Z values (without removing any flowlines)
get_point_type_counts()
Get the count of each point type in a set of cross section points
get_points_per_cs()
Calculate the points per cross section based off length
get_relief()
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)
get_start_node()
Get a valid starting node from a graph
get_transects()
Generate Multiple cross section along a linestring
get_unique_tmp_ids()
Get a list of unique tmp_ids in a dataframe
get_validity_tally()
Get a total count of the validity attributes
is_braided()
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()).
linestring
Tester
needs_rectification()
Check if there transects without valid banks or relief
pct_pts_near_bottom()
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
plot_cs_pts()
Plots an X-Y scatter plot of cross section points
pts_to_XY()
Convert an sf dataframe with a point geometry column to non spatial with XY columns
pts_to_reevaluate()
Get a dataframe of points that should be evaluated due to their proximity (nearness in Z distance) to the bottom
rectify_flat_cs()
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.
rectify_summary()
Makes a summaru dataframe and print out of differences between 2 cross section points dataframes
remove_cols_from_df()
Remove specified columns from a dataframe if they exist.
renumber_cs_ids()
Fix IDs in a dataframe
rm_multi_intersects()
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
shorten_flagged_transects()
Shorten specific flagged transects by specified distance Shorten transects by 'extension_distance' if they have a 'flagged' column value of TRUE
shorten_multi_flowline_intersecting_extended_transects()
Takes any transects that was extended and with multiple flowline intersections, and shortens them by the distance specified in the "extension_distance" column
shorten_multi_transect_intersecting_extended_transects()
Takes any transects with multiple intersections that was extended, and shortens them by the distance specified in the "extension_distance" column
transects_to_cs_pts()
Convert SF linestring transect lines into SF points with
unpack_braids()
Utility function that takes the output from 'find_braids(nested = TRUE)' and unpacks/unnests braid_id column
validate_cs_pts()
Validate Cross Sections Points Ensure all cross section points are valid
validate_cs_pts_against_transects()
Validate Cross Section Points Against Transects Ensure all cross section points are valid relative to a set of transects
validate_transects()
Validate Transects
validate_transects_against_flowlines()
Validate Transects Against Flowlines Ensure all transects are valid relative to a set of flowlines