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_bathymetry()
Given provide inchannel widths and depths to a set of cross section points and derive estimated shapes
add_cs_id_sequence()
Add a 1:number of cross sections 'cs_id' for each crosswalk_id by cs_measure
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_intersects_ids()
Add an ID column from 'y' if it intersects with 'x'
add_is_complete_cs_flag()
Add an is_complete_cs flag to cross sections points Any cross section points that has does NOT have ANY NA Z (depth) values is flagged as is_complete_cs = TRUE
add_is_missing_depth_flag()
Add an is_missing_depth flag to cross sections points Any cross section points that has missing Z (depth = NA) values is flagged as is_missing_depth = TRUE
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_flagged_transects2()
Update a flagged set of transects by shortening them by the given left_distance and right_distance (adjust_flagged_transects() v2 ) Requires 'left_distance' and 'right_distance' columns to specify how much to adjust flagged transects by
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
braided_flowlines
Braided Flowlines
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 3) with NA removal 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 (version 2) Version 2 of cross section point classifier function, uses 1st and 2nd derivative of the depths to better classify channel points
classify_points5()
Classify Cross Section Points (v1 deprecated)
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
cs_arrange()
Rearrange transects / cross sections in order from upstream to downstream
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
diff_overlaps()
Use sf::st_difference to resolve overlaps in polygons based on intersections with other polygons
dissolve_overlaps()
Use sf::st_union to resolve overlaps in polygons based on intersections with other polygons
drop_incomplete_cs_pts()
Remove entire cross sections that have any NA Z (depth) values
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())
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
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
flowlines
Flowlines
flowlines_missing_depth
Flowlines Missing Depth
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_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_transect_extension_distances_to_polygons()
Get the left and right extension distances for a set of transects out to a set of polygons
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
invalid_flowlines
Invalid Flowlines
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()).
junction_flowlines
Junction Flowlines
linestring
Tester
needs_rectification()
Check if there transects without valid banks or relief
nextgen_braided_flowlines
NextGen Braided Flowlines
plot_cs_pts()
Plots an X-Y scatter plot of cross section points
prep_flowlines()
Prepare flowlines have a more dense and/or smoother surface for cutting transects
pts_to_XY()
Convert an sf dataframe with a point geometry column to non spatial with XY columns
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
rm_multiflowline_intersections()
Remove transect lines that intersect with more than one flowline
rm_self_intersections
Remove Self-Intersections
select_cs_pts()
Select standard cross section point columns Internal helper function for selecting cross section point columns aligning with standard data model for cross section points
select_transects()
Select standard transect columns Internal helper function for selecting transect columns aligning with standard data model for transect
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_missing_depth
Transects Missing Depth
transects_to_cs_pts()
Convert SF linestring transect lines into SF points with
trim_transects_to_polygons()
Trim a set of transects to the bounds of polygons
unpack_braids()
Utility function that takes the output from 'find_braids(nested = TRUE)' and unpacks/unnests braid_id column
validate_classified_cs_pts()
Validate Classified Cross Sections Points Ensure all cross section points are valid. This validates the points in the same manner as validate_cs_pts() but also checks that classification columns ('class', 'point_type', 'valid_banks', 'has_relief') exist.
validate_classified_cs_pts_against_transects()
Validate Classified Cross Section Points Against Transects Ensure all cross section points are valid relative to a set of transects. This validates the points in the same manner as validate_cs_pts_against_transects() but also checks that classification columns ('class', 'point_type', 'valid_banks', 'has_relief') exist.
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