Check and fix cross section points with limited variation in Z values (without removing any flowlines)
get_improved_cs_pts.Rd
Duplicate process as rectify_cs() but does NOT remove any cross sections, only attempts to extend transects and improve cross sections. 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 (transects). This function assumes the cross section points have been classified via "classify_points()" and have "has_relief" and "valid_banks" logical columns. This function will look for cross section points that either have no relief or don't have valid banks, then the transect lines that generated these cross section points are extended and new points are extracted along the newly extended, longer transect line. The newly extracted points are checked for relief AND valid banks and are removed if they still have no relief or don't have valid banks. Any new points that became valid as a result of the extension process are added to the original dataset and the rectified set of cross section points will be returned with an "is_extended" logical flag, indicating if the transect line that generated the cross section points was extended. Improved function for rectifying cross section points with flat Z values by extending transect lines and reevaluating the new DEM values.
Usage
get_improved_cs_pts(
cs_pts = NULL,
net = NULL,
transects = NULL,
crosswalk_id = NULL,
points_per_cs = NULL,
min_pts_per_cs = 10,
dem =
"/vsicurl/https://prd-tnm.s3.amazonaws.com/StagedProducts/Elevation/13/TIFF/USGS_Seamless_DEM_13.vrt",
scale = 0.5,
pct_of_length_for_relief = 0.01,
fix_ids = FALSE,
verbose = TRUE
)
Arguments
- cs_pts
sf dataframe or dataframe of cross section points from cross_section_pts() followed by classify_points()
- net
Hydrographic LINESTRING Network
- transects
character, Hydrographic LINESTRING of transects along hydrographic (net) network
- crosswalk_id
character, ID column that uniquely identifies and crosswalks features between 'net', 'transects' and 'cs_pts'
- points_per_cs
the desired number of points per CS. If NULL, then approximently 1 per grid cell resultion of DEM is selected.
- min_pts_per_cs
Minimun number of points per cross section required.
- dem
the DEM to extract data from
- scale
numeric, If a transect line DEM extraction results in all equal Z values, by what percent of the transect lines length (meters) should the transect line be extended in both directions to try to capture representative Z values ? Default is 0.5 (50% of the transect length)
- pct_of_length_for_relief
numeric, percent of cs_lengthm to use as the threshold depth for classifying whether a cross section has "relief". Default is 0.01 (1% of the cross sections length).
- fix_ids
logical, whether to reenumerate the "cs_id" column to make sure cross sections are number 1 - number of total cross sections on flowline. Default is FALSE, cs_id will be kept as they were in the input data and may contain gaps between cs_ids within a flowline (hy_id). WARNING: Setting fix_ids = TRUE may result in input cross section points (cross_section_pts) having DIFFERENT cs_id values as the input transects (cs) and the inconsistency can cause problems when trying to cross walk between the datasets in the future.
- verbose
logical, whether to print messages or not. Default is TRUE