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_flat_cs.Rd
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.
Usage
rectify_flat_cs(
cs_pts = NULL,
net = NULL,
cs = 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,
threshold = 0,
pct_threshold = 0.99,
fix_ids = FALSE
)
Arguments
- cs_pts
Output from extract_dem_values_first
- net
Hydrographic LINESTRING Network
- cs
character, Hydrographic LINESTRING Network file path
- 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)
- threshold
numeric, threshold Z value (meters) that determines if a cross section is flat. A threshold = 0 means if all Z values are the same, then the cross section is considered flat. A threshold value of 1 means that any cross section with Z values all within 1 meter of eachother, is considered flat. Default is 0.
- pct_threshold
numeric, threshold percent of points in the cross section that are within threshold of bottom to determine whether point should be considered for re evaluation. Default is 0.99 (i.e. 99% of points are near the bottom)
- 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 (cs_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.