LSDTopoTools
 All Classes Files Functions Variables Friends Pages
Public Member Functions | Protected Attributes | List of all members
LSDJunctionNetwork Class Reference

Object to create a channel network from an LSDFlowInfo object. More...

#include <LSDJunctionNetwork.hpp>

Public Member Functions

 LSDJunctionNetwork ()
 This defines a channel network, is empty. More...
 
 LSDJunctionNetwork (vector< int > Sources, LSDFlowInfo &FlowInfo)
 This defines a channel network based on a FlowInfo object and a list of source nodes. More...
 
LSDJunctionNetworkoperator= (const LSDJunctionNetwork &LSDR)
 Assignment operator. More...
 
void get_UTM_information (int &UTM_zone, bool &is_North)
 this function gets the UTM_zone and a boolean that is true if the map is in the northern hemisphere More...
 
void get_x_and_y_locations (int row, int col, double &x_loc, double &y_loc)
 this gets the x and y location of a node at row and column More...
 
void get_x_and_y_locations (int row, int col, float &x_loc, float &y_loc)
 this gets the x and y location of a node at row and column More...
 
void get_lat_and_long_locations (int row, int col, double &lat, double &longitude, LSDCoordinateConverterLLandUTM Converter)
 a function to get the lat and long of a node in the raster Assumes WGS84 ellipsiod More...
 
void get_x_and_y_from_latlong (vector< float > latitude, vector< float > longitude, vector< float > &UTME, vector< float > &UTMN)
 This takes latitude and longitude (in WGS 84) and converts to vectors of easting and northing in UTM. More...
 
void add_to_stack (int lm_index, int &j_index, int bl_node)
 Recursive add_to_stack routine to build the junction tree, from Braun and Willett (2012) equations 12 and 13. More...
 
vector< int > get_upslope_junctions (int junction_number_outlet)
 This returns all the upstream junction of a junction_number_outlet. More...
 
vector< int > get_all_source_junctions_of_an_outlet_junction (int junction_number_outlet)
 This finds all the junctions that are source junctions upslope of a given junction. More...
 
vector< int > get_all_source_nodes_of_an_outlet_junction (int junction_number_outlet)
 This finds all the nodes that are source nodes upslope of a given junction. More...
 
vector< int > get_donor_nodes (int node)
 this function gets a list of the junction indices of the donors to a particular junction IMPORTANT: this has only retained the string "node" to keep equivalence with the FlowInfo object. It takes junctions and returns junctions!! Also note that base level nodes have themselves as a donor More...
 
int map_junction_to_upslope_junction_list (vector< int > upslope_junctions, int junction)
 This function maps a junction onto the indexing of the upslope junction list. More...
 
int get_maximum_stream_order ()
 This function returns the maximum stream order in the DEM. More...
 
int get_number_of_streams (LSDFlowInfo &FlowInfo, int stream_order)
 This function returns the number of streams of a given stream order. More...
 
map< int, vector< float > > calculate_junction_angles (vector< int > JunctionList, LSDFlowInfo &FlowInfo)
 This calculates the junction angles based on a number of junctions. More...
 
vector< float > calculate_junction_angle_statistics_upstream_of_junction (int target_junction, LSDFlowInfo &FlowInfo)
 This function gets the mean and standard error of every junction angle upslope of a given junction. More...
 
vector< float > calculate_junction_angle_statistics_upstream_of_junction (int target_junction, LSDFlowInfo &FlowInfo, int threshold_SO)
 Overloaded function similar to above but removes any junctions not greater than threshold SO. More...
 
void calculate_junction_angle_statistics_for_order (LSDFlowInfo &FlowInfo, int BasinOrder, vector< int > &junction_list, vector< float > &junction_angle_averages, vector< float > &junction_angle_stderr, vector< int > &N_junctions)
 This takes the junction angle statistics for all basins of a given order. More...
 
void print_junction_angles_from_basin_list (vector< int > JunctionList, LSDFlowInfo &FlowInfo, string csv_outname)
 This function takes a vector of basin junctions and prints statistics of all the junctions upstream of each basin junction to a CSV. The statstics are separated by stream order. More...
 
void print_junction_angles_to_csv (vector< int > JunctionList, LSDFlowInfo &FlowInfo, string csv_name)
 This prints the junction angles to a csv file. More...
 
int get_Junction_of_Node (int Node, LSDFlowInfo &FlowInfo)
 This gets the junction number of a given node. More...
 
vector< int > get_Junctions_of_Sources (LSDFlowInfo &FlowInfo)
 This gets the junction number all the sources. More...
 
int get_penultimate_node_from_stream_link (int upstream_junction, LSDFlowInfo &FlowInfo)
 returns the penultimate node of the stream link below given junction More...
 
LSDIndexRaster StreamOrderArray_to_LSDIndexRaster ()
 This sends the StreamOrderArray to a LSDIndexRaster. More...
 
void StreamOrderArray_to_WGS84CSV (string FileName)
 Method to flatten an te stream order array and place the non NDV values in a csv file. Each value is placed on its own line, so that it can be read more quickly in python etc. It includes the lat long coordinates in CSV, in WGS84 coordinate system EPSG:4326. More...
 
void PrintChannelNetworkToCSV (LSDFlowInfo &flowinfo, string fname_prefix)
 This prints a stream network to a csv in WGS84 This function prints a network that is ordered by sources, channels have stream orders and junction numbers attached param FlowInfo the flow info object which translates node indices to actual points. More...
 
LSDIndexRaster JunctionArray_to_LSDIndexRaster ()
 This sends the JunctionArray to a LSDIndexRaster. More...
 
LSDIndexRaster JunctionIndexArray_to_LSDIndexRaster ()
 This sends the JunctionIndexArray to a LSDIndexRaster. More...
 
LSDIndexRaster StreamOrderArray_to_BinaryNetwork_LSDIndexRaster ()
 Turns the StreamOrderArray into a binary rastser where 1 is channel and 0 is hillslope. More...
 
vector< int > get_BaseLevel_DonorJunctions ()
 This gets the largest donor junction to the baselevel nodes so that you can automate basin selection. (e.g. for use with chi analysis) More...
 
vector< int > Prune_Junctions_Edge (vector< int > &BaseLevelJunctions_Initial, LSDFlowInfo &FlowInfo)
 This function takes a list of junctions and then prunes junctions based whether they drain from the edge. This attempts to remove junctions that are through-flowing and thus do not have the correct drainage area. More...
 
vector< int > Prune_Junctions_Edge_Ignore_Outlet_Reach (vector< int > &BaseLevelJunctions_Initial, LSDFlowInfo &FlowInfo, LSDRaster &TestRaster)
 This function takes a list of junctions and then prunes junctions based whether they drain from the edge. This attempts to remove junctions that are through-flowing and thus do not have the correct drainage area Only gets the donor of the baselelve donor to ignore the nodes near the outlet, which often intersect nodata in cut DEMs. More...
 
vector< int > Prune_To_Largest_Complete_Basins (vector< int > &BaseLevelJunctions_Initial, LSDFlowInfo &FlowInfo, LSDRaster &TestRaster, LSDIndexRaster &FlowAcc)
 This function looks through all baselevel nodes and then looks for the largest basin that is not influenced by the edge. It returns a vector of these junctions. Note that it only returns one basin per baselevel node at most so might not do a great job of space filling. More...
 
vector< int > Prune_Junctions_By_Contributing_Pixel_Window (vector< int > &Junctions_Initial, LSDFlowInfo &FlowInfo, LSDIndexRaster &FlowAcc, int lower_limit, int upper_limit)
 This function removes basins that fall outside a contributing pixel Window. More...
 
vector< int > Prune_Junctions_By_Contributing_Pixel_Window_Remove_Nested_And_Nodata (LSDFlowInfo &FlowInfo, LSDRaster &TestRaster, LSDIndexRaster &FlowAcc, int lower_limit, int upper_limit)
 This function removes basins that fall outside a contributing pixel Window, those that are bounded by nodata, and those that are nested. A rather intensive pruning process that hopeuflly results in a number of basins that are a similar size This doesn't just look for baselevel junctions: it goes through all junctions in the DEM. Warning: computationally expensive! More...
 
vector< int > Prune_Junctions_If_Nested (vector< int > &Junctions_Initial, LSDFlowInfo &FlowInfo, LSDIndexRaster &FlowAcc)
 This function removes basins that are nested within any other basin in the list. More...
 
vector< int > Prune_Junctions_Area (vector< int > &BaseLevelJunctions_Initial, LSDFlowInfo &FlowInfo, LSDIndexRaster &FlowAcc, int Threshold)
 This function takes a list of junctions and then prunes junctions based on their number of contributing pixels. More...
 
vector< int > Prune_Junctions_Largest (vector< int > &BaseLevelJunctions_Initial, LSDFlowInfo &FlowInfo, LSDIndexRaster &FlowAcc)
 This function takes a list of junctions retains ONLY the larges bains The junction is returned as an int vector so that it can be passed to other functions requiring junction lists. More...
 
vector< int > Prune_Junctions_Threshold_Elevation (vector< int > &BaseLevelJunctions_Initial, LSDFlowInfo &FlowInfo, LSDRaster &Elev, float threshold_elevation, bool keep_junctions_below_threshold)
 This function takes a list of junctions retains ONLY the junctions that have an outlet elevation greater or less than the threshold elevation Selection of greater or lower is determined by bool keep_junctions_below_threshold. More...
 
vector< int > Prune_Junctions_Elevation_Window (vector< int > &BaseLevelJunctions_Initial, LSDFlowInfo &FlowInfo, LSDRaster &Elev, float lower_threshold, float upper_threshold)
 This function takes a list of junctions retains ONLY the junctions that have an outlet elevation with an elevation window. More...
 
vector< int > get_contributing_pixels_from_specified_junctions (vector< int > &JunctionList, LSDFlowInfo &FlowInfo, LSDIndexRaster &FlowAcc)
 You give this a list of junction numbers and it returns the number of upslope pixels. More...
 
int retrieve_junction_number_at_row_and_column (int row, int col)
 Get Junction number at a location. More...
 
void print_longest_channel (int outlet_junction, LSDFlowInfo &FInfo, LSDIndexRaster &dist_code, LSDRaster &dist_from_outlet)
 Function for printing out the longest channel upstream of a point. More...
 
void print_junction_info_vectors (string filename)
 Prints the information about the junctions to file. More...
 
LSDIndexChannel generate_link_index_channel_from_junction (int start_junction, LSDFlowInfo &FlowInfo)
 This generates an LSDChannelIndex object given a junction. More...
 
LSDIndexChannel generate_longest_index_channel_from_junction (int outlet_junction, LSDFlowInfo &FInfo, LSDRaster &dist_from_outlet)
 This function extracts the longest channel originating from a junction number outlet_junction. More...
 
LSDIndexChannel generate_longest_index_channel_in_basin (int basin_junction, LSDFlowInfo &FInfo, LSDRaster &dist_from_outlet)
 This generates the longest channel in a basin. More...
 
vector< int > get_basin_sources_from_outlet_vector (vector< int > basin_junctions, LSDFlowInfo &FlowInfo, LSDRaster &dist_from_outlet)
 This generates the upstream source nodes from a vector of basin junctions. More...
 
vector< int > extract_basins_order_outlet_junctions (int BasinOrder, LSDFlowInfo &FlowInfo)
 This extracts the junction numbers, in a vector of integers, of all basins of a given order. More...
 
vector< int > extract_basins_order_outlet_nodes (vector< int > &BasinOutletJunctions, LSDFlowInfo &FlowInfo)
 this function gets the outlet node of a list of basins. More...
 
void extract_tributary_junctions_to_main_stem (LSDIndexChannel &MainStem, LSDFlowInfo &FlowInfo, vector< int > &tributary_junctions, vector< int > &nodes_on_main_stem_of_tributaries)
 This function gets tributaries along a continous channel. More...
 
vector< int > get_pruned_tributaries_from_main_stem (LSDFlowInfo &FlowInfo, LSDJunctionNetwork &ChannelNetwork, int starting_junction, LSDRaster &DistanceFromOutlet, int pruning_switch, float pruning_threshold)
 this function gets the tributary junctions upstream of the starting_junction based on pruning criteria. More...
 
vector< int > extract_basin_nodes_by_drainage_area (float DrainageAreaThreshold, LSDFlowInfo &FlowInfo)
 This function extracts basin nodes according to their accumulated drainage area. More...
 
vector< int > extract_basin_nodes_above_drainage_area_threshold (LSDFlowInfo &FlowInfo, float DrainageAreaThreshold)
 This function extracts nodes where the basins of both tributaries are greater than a certain drainage area threshold. Moves downstream from sources to baselevel so that nested catchments will be selected. More...
 
vector< int > modify_basin_nodes_from_mask (vector< int > basin_nodes, LSDFlowInfo &FlowInfo, LSDRaster &MaskRaster)
 This function checks all of the basin nodes to check if they fall within a mask (input raster). If they fall within the mask raster then the first node upstream not in the mask is selected. More...
 
vector< int > extract_basin_junctions_from_nodes (vector< int > basin_nodes, LSDFlowInfo &FlowInfo)
 This function extracts basin junctions from a list of basin outlet nodes. More...
 
LSDIndexRaster extract_basin_from_junction (int basin_junction, int basin_reference_number, LSDFlowInfo &FlowInfo)
 This function gets the node indices of outlets of basins of a certain order. More...
 
vector< int > Get_Channel_Head_Junctions (vector< int > Sources, LSDFlowInfo &FlowInfo)
 This function converts a list of sources used to generate the initial channel network into a list of junction indexes of channel heads which can be used to extract hollows. More...
 
LSDIndexRaster extract_hollow (int CH_junction, LSDFlowInfo &FlowInfo)
 This function extracts a single hollow from a given channel head junction. More...
 
LSDIndexRaster extract_hollow (vector< int > CH_junctions, LSDFlowInfo &FlowInfo)
 This function extracts a series of hollows from a vector of channel head junctions. More...
 
LSDIndexRaster extract_basins_from_junction_vector (vector< int > basin_junctions, LSDFlowInfo &FlowInfo)
 This function gets the an LSDIndexRaster of basins draining from a vector of junctions. More...
 
LSDIndexRaster extract_basins_from_junction_vector_nested (vector< int > basin_junctions, LSDFlowInfo &FlowInfo)
 This function gets an LSDIndexRaster of basins draining from a vector of junctions. More...
 
LSDIndexRaster extract_basins_from_junctions_rudimentary (vector< int > junctions, LSDFlowInfo &FlowInfo)
 This function gets the an LSDIndexRaster of basins draining from a vector of junctions. More...
 
LSDIndexRaster ExtractBasinsOrder (int BasinOrder, LSDFlowInfo &FlowInfo)
 Basin extraction - extracts all drainage basins of specified stream order. More...
 
vector< int > ExtractBasinJunctionOrder (int BasinOrder, LSDFlowInfo &FlowInfo)
 This function extracts the juctions of all non-beheaded drainage basins of a given order, n. More...
 
vector< int > ExtractBasinJunctionOrderKeepEdgeBasins (int BasinOrder, LSDFlowInfo &FlowInfo)
 This function extracts the juctions of all non-beheaded drainage basins of a given order, n. Like the previous version but in this case includes basins at the edge (abutting nodata) More...
 
vector< int > FindFarthestUpslopeHilltopsFromSources (int JunctionNumber, LSDFlowInfo &FlowInfo, LSDRaster &FlowDistance)
 Get farthest upslope hilltops. More...
 
int GetChannelHeadsChiMethodFromNode (int NodeNumber, int MinSegLength, float A_0, float m_over_n, LSDFlowInfo &FlowInfo, LSDRaster &FlowDistance, LSDRaster &ElevationRaster)
 This function generates LSDChannels that run from the hilltops above all the sources of the junction JunctionNumber. More...
 
int GetChannelHeadsChiMethodFromSourceNode (int NodeNumber, int MinSegLength, float A_0, float m_over_n, LSDFlowInfo &FlowInfo, LSDRaster &FlowDistance, LSDRaster &ElevationRaster, int NJunctions)
 This function generates LSDChannels that run from the hilltops above all the sources from the valley network down to a specified number of downstream junctions below the sources. More...
 
void write_valley_hilltop_chi_profiles_to_csv (vector< int > sources, float A_0, float m_over_n, LSDFlowInfo &FlowInfo, LSDRaster &FlowDistance, LSDRaster &ElevationRaster, int NJunctions, string output_path, string DEM_ID)
 This function generates LSDChannels that run from the hilltops above all the sources from the valley network down to a specified number of downstream junctions below the sources and writes the profile to csv. More...
 
LSDIndexRaster GetChannelfromDreich (int NodeNumber, int MinSegLength, float A_0, float m_over_n, LSDFlowInfo &FlowInfo, LSDRaster &FlowDistance, LSDRaster &ElevationRaster, string path_name, int NJunctions)
 This function generates an LSDIndexRaster of the channel that runs from the hilltop above the furthest upslope source of the junction JunctionNumber. More...
 
vector< int > GetChannelHeadsChiMethodFromValleys (vector< int > ValleyNodes, int MinSegLength, float A_0, float m_over_n, LSDFlowInfo &FlowInfo, LSDRaster &FlowDistance, LSDRaster &ElevationRaster)
 This function returns all potential channel heads in a DEM. It looks for channel heads organized by a basin order which is fed to the code The basin order just determines how far downstream the algorithm looks for the 'fluvial' section. It returns a vector<int> of nodeindices where the channel heads are. More...
 
vector< int > GetChannelHeadsChiMethodFromSources (vector< int > ValleySources, int MinSegLength, float A_0, float m_over_n, LSDFlowInfo &FlowInfo, LSDRaster &FlowDistance, LSDRaster &ElevationRaster, int NJunctions)
 This function returns all potential channel heads in a DEM. It looks for. More...
 
LSDIndexRaster GetChannelsDreich (vector< int > ValleySources, int MinSegLength, float A_0, float m_over_n, LSDFlowInfo &FlowInfo, LSDRaster &FlowDistance, LSDRaster &ElevationRaster, string path_name, int NJunctions)
 This function returns all channels in the DEM that the DrEICH algorithm uses for segiment fitting. It looks for channels based on the outlet junctions of valleys. It returns a LSDIndexRaster with the channels. More...
 
Array2D< int > GetChannelHeadsChiMethodAllPixels (int JunctionNumber, float A_0, float m_over_n, float bin_width, LSDFlowInfo &FlowInfo, LSDRaster &ElevationRaster)
 This function returns a 2D array containing the locations of all pixels identified as being part of the channel using chi profiles. It calculates the chi and elevation value of every pixel upstream of the given junction, then bins this data and calculates the pixels in the 95th percentile of each bin. Any pixels above the 95th percentile are considered part of the channel, and any below are considered to be hillslopes. This is the first part of the channel head prediction using chi profiles. More...
 
vector< int > GetSourceNodesChiMethodAllPixels (int JunctionNumber, float A_0, float m_over_n, float bin_width, LSDFlowInfo &FlowInfo, LSDRaster &ElevationRaster)
 This function returns an integer vector with the node indexes of the furthest upstream pixels identified as being part of the channel using chi profiles. It calculates the chi and elevation value of every pixel upstream of the given junction, then bins this data and calculates the pixels in the 95th percentile of each bin. Any pixels above the 95th percentile are considered part of the channel, and any below are considered to be hillslopes. This is the first part of the channel head prediction using chi profiles. More...
 
vector< int > calculate_pelletier_channel_heads (float tan_curv_threshold, LSDFlowInfo &FlowInfo, Array2D< float > &tan_curv_array)
 This function is used to predict channel head locations based on the method proposed by Pelletier (2013). More...
 
vector< int > calculate_pelletier_channel_heads_DTM (LSDFlowInfo &FlowInfo, Array2D< float > topography, float tan_curv_threshold, Array2D< float > &tan_curv_array, Array2D< float > &tan_curv_array_LW)
 This function predicts channel head locations based on a tangential threshold as proposed by Pelletier (2013). More...
 
vector< int > identify_upstream_limits (LSDFlowInfo &FlowInfo, Array2D< float > &topography, vector< int > source_row_vec, vector< int > source_col_vec, Array2D< float > &tan_curv)
 This function identifies upstream limit of channel network. More...
 
Array2D< int > find_valleys (LSDFlowInfo &FlowInfo, Array2D< float > &tan_curv_array, vector< int > sources, int no_connecting_nodes, float tan_curv_threshold=0.1)
 This function is used to identify concave portions of the landscape using a tangential curvature threshold. More...
 
vector< int > get_outlet_nodes_from_sources (LSDFlowInfo &FlowInfo, vector< int > sources)
 This function is used to get the outlet nodes from a vector of input source nodes. More...
 
Array2D< int > find_valleys_adaptive_threshold (LSDFlowInfo &FlowInfo, Array2D< float > &tan_curv_array, vector< int > sources, int no_connecting_nodes, Array2D< float > &tan_curv_threshold)
 This function is used to identify concave portions of the landscape using a tangential curvature threshold which is adaptive for each portion of the landscape. More...
 
Array2D< int > find_valleys_using_channel_mask (LSDFlowInfo &FlowInfo, Array2D< int > &channel_mask, vector< int > sources, int no_connecting_nodes)
 This function uses a predefined channel mask to locate valley junctions. More...
 
LSDRaster ExtractRidges (LSDFlowInfo &FlowInfo)
 Ridge network extraction - extracts ridge network, defined as boundaries between two basins of the same stream order. More...
 
LSDRaster ExtractRidges (LSDFlowInfo &FlowInfo, int &min_order, int &max_order)
 
LSDRaster ExtractHilltops (LSDRaster &RidgeRaster, LSDRaster &SlopeRaster, float MaxSlope)
 This last function gets the hilltops: ridges limited by a maximum slope. More...
 
LSDIndexRaster ChannelIndexer (LSDFlowInfo &flowinfo)
 This function iterates through the junction nodes and assigns the unique junction ID to every stream pixel. More...
 
void GetChannelNodesAndJunctions (LSDFlowInfo &flowinfo, vector< int > &NIvec, vector< int > &JIvec, vector< int > &SOvec)
 This extracts vectors containing node incidex, junction indices and stream orders of pixels in the channel network. The vectors are replaced by the method. More...
 
LSDIndexRaster SplitChannel (LSDFlowInfo &FlowInfo, vector< int > Sources, int TargetSegmentLength)
 This function splits the channel into a series of segments, providing a convenient unit with which to analyse landscapes. The user provides the TargetSegmentLength, which specifies how many nodes should be in each segment, and a MinimumSegmentLength, which specifies the fewest permissable number of nodes. Segments smaller than this are amalgamated into the upstream segment. The algorithm loops through the sources and traces downstream, stopping a segment after the target segment length, when the stream order increases (to preserve structure of drainage network), or when a channel pixel has already been visited. More...
 
void TypologyModel (LSDFlowInfo &FlowInfo, vector< int > Sources, vector< int > BaselineSources, vector< int > CatchIDs, vector< int > HydroCodes, int MinReachLength, int search_radius, LSDRaster &ElevationRaster, LSDRaster &DischargeRaster, LSDIndexRaster &ChannelSegments, vector< vector< int > > &SegmentInfoInts, vector< vector< float > > &SegmentInfoFloats)
 
void remove_tributary_segments (LSDFlowInfo &FlowInfo, vector< int > Sources, vector< vector< int > > &SegmentInfoInts, vector< vector< float > > &SegmentInfoFloats)
 This function removes channel segments from the typology model which are not downstream of a given list of source nodes. More...
 
void print_channel_segments_to_csv (LSDFlowInfo &FlowInfo, vector< vector< int > > SegmentInfoInts, vector< vector< float > > SegmentInfoFloats, string outfilename)
 This function prints information about the channel segments from the TypologyModel function to a csv file so it can be read by a GIS. More...
 
LSDIndexRaster SplitHillslopes (LSDFlowInfo &FlowInfo, LSDIndexRaster &ChannelSegmentsRaster)
 This function is intended to follow the SplitChannel function. It traces through the receiver nodes from every hillslope pixel and then assigns them an integer value that matches the index of the section of channel that is setting the base level of that hillslope. More...
 
LSDIndexRaster SplitHillslopes (LSDFlowInfo &FlowInfo, LSDIndexRaster &ChannelSegmentsRaster, LSDIndexRaster &MultiThreadChannelRaster)
 This is an overloaded function doing the same as the previous version to segment hillslopes according to the channel index of the channel setting its base level. However, this has been adapted to include an additional input raster - MultiThreadChannelRaster - which recognises that real channels may be multithreaded and/or have widths greater than or equal to one pixel. To be rigourous, these should be removed from analyses of hillslope properties. More...
 
LSDIndexRaster GetStreams (int order)
 Quick and dirty way to get channels of a defined stream order. More...
 
LSDIndexRaster GetStreams (int min_order, int max_order)
 Quick and dirty way to get channels of a defined range of stream orders. More...
 
bool node_tester (LSDFlowInfo &FlowInfo, int input_junction)
 Function to test whether a junction's upstream nodes border areas of No Data important to ensure basins are not being artificially truncated. More...
 
int get_receiver_junction_for_specified_coordinates (float X_coordinate, float Y_coordinate, LSDFlowInfo &FlowInfo)
 Function to snap input coordinates to the nearest junction. This enables easy extraction of a particular catchment for analysis. More...
 
int get_nodeindex_of_nearest_channel_for_specified_coordinates (float X_coordinate, float Y_coordinate, int threshold_stream_order, int search_radius_nodes, LSDFlowInfo &FlowInfo)
 Function to snap input coordinates to the nearest channel node. This enables easy extraction of a particular catchment for analysis. More...
 
int get_junction_of_nearest_channel_from_lat_long (double latitude, double longitude, LSDFlowInfo &FlowInfo, LSDCoordinateConverterLLandUTM Converter)
 Function to snap input coordinates to the nearest channel node from latitude and longitude. More...
 
void get_info_nearest_channel_to_node (int &StartingNode, int &threshold_SO, LSDFlowInfo &FlowInfo, LSDRaster &DistFromOutlet, int &ChannelNode, float &FlowLength, float &DistanceUpstream)
 Function to get info about the nearest channel node of a given node. More...
 
void get_info_nearest_channel_to_node_main_stem (int &StartingNode, LSDFlowInfo &FlowInfo, LSDRaster &ElevationRaster, LSDRaster &DistFromOutlet, LSDIndexChannel &MainStem, int &ChannelNode, float &FlowLength, float &DistanceUpstream, float &Relief)
 Function to get info about the nearest channel node on the main stem of a given node. More...
 
int find_upstream_junction_from_channel_nodeindex (int ChannelNodeIndex, LSDFlowInfo &FlowInfo)
 This function takes a node index, checks to see if it is on a channel, and then works its way up the channel to find the upstream junction. More...
 
int check_stream_order_of_upstream_nodes (int junction, LSDFlowInfo &FlowInfo)
 This function checks whether any of the upstream nodes of a given junction are the same steam order as the junction itself. It returns an integer value which is 1 if the SO is the same and 0 if it is not the same. More...
 
int get_upstream_node_max_stream_order (int current_node, LSDFlowInfo &FlowInfo)
 This function returns the node index of the donor node of a given node with the highest stream order. More...
 
void snap_point_locations_to_channels (vector< float > x_locs, vector< float > y_locs, int search_radius_nodes, int threshold_stream_order, LSDFlowInfo &FlowInfo, vector< int > &valid_cosmo_points, vector< int > &snapped_node_indices, vector< int > &snapped_junction_indices)
 this function is a wrapper that takes a list of x and y locations, filters them to make sure they are in the data bounds, and then calculates the nearest channel and junction. It is primarily used to snap cosmo data to the channel network More...
 
int find_base_level_node_of_junction (int StartingJunction)
 This functions takes a junction number and then follwos the receiver junctions until it hits a baselevel junction. More...
 
void print_junctions_to_csv (LSDFlowInfo &FlowInfo, vector< int > JunctionList, string fname)
 Prints a list of junctions, with their locations in both UTM and in lat long WGS1984 to file The format of the file is: junction,node,x,y,latitude,longitude. More...
 
void print_junctions_to_csv (LSDFlowInfo &FlowInfo, string fname)
 Prints all junctions, with their locations in both UTM and in lat long WGS1984 to file The format of the file is: junction,node,x,y,latitude,longitude. More...
 
int get_NRows () const
 
int get_NCols () const
 
float get_XMinimum () const
 
float get_YMinimum () const
 
float get_DataResolution () const
 
int get_NoDataValue () const
 
map< string, string > get_GeoReferencingStrings () const
 
int get_Node_of_Junction (int junction) const
 
int get_Receiver_of_Junction (int junction) const
 
vector< int > get_node_list_from_junction_list (vector< int > junction_list)
 
vector< int > get_node_list_of_penultimate_node_from_junction_list (vector< int > junction_list, LSDFlowInfo &FlowInfo)
 
int get_downstream_junction (int starting_junction, LSDFlowInfo &FlowInfo)
 
int get_StreamOrder_of_Node (LSDFlowInfo &FlowInfo, int node)
 
int get_StreamOrder_of_Junction (LSDFlowInfo &FlowInfo, int junction)
 
int get_StreamOrder_of_Junction (int junction)
 
int get_Next_StreamOrder_Junction (int junction)
 
bool is_junction_upstream (int current_junction, int test_junction)
 
int is_Junction_BaseLevel (int junction)
 
int get_NJunctions () const
 
vector< int > get_JunctionVector () const
 
vector< int > get_BaseLevelJunctions () const
 
vector< int > get_ReceiverVector () const
 
vector< int > get_StreamOrderVector () const
 
vector< int > get_SourcesVector () const
 
Array2D< int > get_StreamOrderArray () const
 
void couple_hillslope_nodes_to_channel_nodes (LSDRaster &Elevation, LSDFlowInfo &FlowInfo, LSDRaster &D_inf_Flowdir, LSDIndexRaster &ChannelNodeNetwork, int OutletJunction, vector< int > &hillslope_nodes, vector< int > &baselevel_channel_nodes)
 
LSDRaster calculate_relief_from_channel (LSDRaster &ElevationRaster, LSDFlowInfo &FlowInfo, int threshold_SO)
 
LSDRaster calculate_relief_from_channel_connected_components (LSDRaster &ElevationRaster, LSDIndexRaster &ConnectedComponents, LSDRaster &DistFromOutlet, LSDFlowInfo &FlowInfo, int threshold_SO, int search_distance)
 
Array2D< int > Get_Elevation_of_Nearest_Channel_for_Connected_Components (LSDIndexRaster &ConnectedComponents, LSDRaster &ElevationRaster, LSDRaster &DistFromOutlet, LSDFlowInfo &FlowInfo, int threshold_SO, int search_distance)
 
float find_mean_elevation_of_channel_reach (int StartingNode, int search_distance, LSDRaster &ElevationRaster, LSDFlowInfo &FlowInfo)
 
float find_distance_to_nearest_floodplain_pixel (int point_node, int search_distance, LSDRaster &FloodplainRaster, LSDFlowInfo &FlowInfo)
 
void get_overlapping_channels (LSDFlowInfo &FlowInfo, vector< int > BaseLevel_Junctions, LSDRaster &DistanceFromOutlet, vector< int > &source_nodes, vector< int > &outlet_nodes, int n_nodes_to_visit)
 
void get_overlapping_channels (LSDFlowInfo &FlowInfo, vector< int > BaseLevel_Junctions, LSDRaster &DistanceFromOutlet, vector< int > &source_nodes, vector< int > &outlet_nodes, vector< int > &baselevel_nodes, int n_nodes_to_visit)
 
void get_overlapping_channels_to_downstream_outlets (LSDFlowInfo &FlowInfo, vector< int > BaseLevel_Junctions, LSDRaster &DistanceFromOutlet, vector< int > &source_nodes, vector< int > &outlet_nodes, int n_nodes_to_visit)
 
void get_overlapping_channels_to_downstream_outlets (LSDFlowInfo &FlowInfo, vector< int > BaseLevel_Junctions, LSDRaster &DistanceFromOutlet, vector< int > &source_nodes, vector< int > &outlet_nodes, vector< int > &baselevel_nodes, int n_nodes_to_visit)
 I THINK THIS MIGHT CAUSE A SEG FAULT: NEED TO UPDATE!!!!! More...
 
vector< int > get_channel_pixels_along_line (vector< int > line_rows, vector< int > line_cols, int threshold_SO, LSDFlowInfo &FlowInfo)
 
void write_river_profiles_to_csv (vector< int > &BasinJunctions, LSDFlowInfo &FlowInfo, LSDRaster &DistanceFromOutlet, LSDRaster &Elevation, string csv_filename)
 function to take a vector of basin outlet junctions and write data about the longest channel in each to csv. More...
 
void write_river_profiles_to_csv_all_tributaries (vector< int > &BasinJunctions, LSDFlowInfo &FlowInfo, LSDRaster &DistanceFromOutlet, LSDRaster &Elevation, string csv_filename)
 function to take a vector of basin outlet junctions and write data about all tribs to csv More...
 
float GetTotalChannelLengthUpstream (int this_node, LSDFlowInfo &FlowInfo)
 function get the total length of channels upstream of a node More...
 
void write_river_profiles_to_csv_all_sources (float channel_length, int slope_window_size, LSDFlowInfo &FlowInfo, LSDRaster &Elevation, string csv_filename)
 function to write data about channels downstream of all channel heads for a specified length More...
 

Protected Attributes

int NRows
 Number of rows.
 
int NCols
 Number of columns.
 
float XMinimum
 Minimum X coordinate.
 
float YMinimum
 Minimum Y coordinate.
 
float DataResolution
 Data resolution.
 
int NoDataValue
 No data value.
 
map< string, string > GeoReferencingStrings
 A map of strings for holding georeferencing information.
 
int NJunctions
 The number of junctions.
 
vector< int > SourcesVector
 A list of the node indices that are sources. More...
 
vector< int > BaseLevelJunctions
 This vector lists the node index of the base level nodes that have a source within their catchements.
 
vector< int > JunctionVector
 A list of the junctions. It is an index into the nodevector from the FlowInfo object.
 
vector< int > StreamOrderVector
 The stream order of the junction node/link. More...
 
vector< int > BLBasinVector
 A vector that give the baselevel index of each junction node.
 
vector< int > NDonorsVector
 Stores the number of donors to each junction.
 
vector< int > ReceiverVector
 Stores the node index of the receiving junction.
 
vector< int > DeltaVector
 
vector< int > DonorStackVector
 This is a vector that stores the donor junction of of the junction and is indexed by the DeltaVector.
 
vector< int > SVector
 This vector is used to calculate flow accumulation. More...
 
vector< int > SVectorIndex
 This points to the starting point in the S vector of each node.
 
vector< int > NContributingJunctions
 The number of contributing junctions !!INCULDING SELF!! to a current pixel. More...
 
Array2D< int > StreamOrderArray
 This array stores the stream indices of all the channels.
 
Array2D< int > JunctionArray
 This array stores a junction counter. More...
 
Array2D< int > JunctionIndexArray
 

Detailed Description

Object to create a channel network from an LSDFlowInfo object.

Constructor & Destructor Documentation

LSDJunctionNetwork::LSDJunctionNetwork ( )
inline

This defines a channel network, is empty.

Author
SMM
Date
30/07/14
LSDJunctionNetwork::LSDJunctionNetwork ( vector< int >  Sources,
LSDFlowInfo FlowInfo 
)
inline

This defines a channel network based on a FlowInfo object and a list of source nodes.

Parameters
FlowInfoLSDFlowInfo object.
Sourcesvector of source nodes.
Author
SMM
Date
01/09/12

Member Function Documentation

void LSDJunctionNetwork::add_to_stack ( int  lm_index,
int &  j_index,
int  bl_node 
)

Recursive add_to_stack routine to build the junction tree, from Braun and Willett (2012) equations 12 and 13.

Parameters
lm_indexInteger
j_indexInteger
bl_nodeInteger
Author
SMM
Date
01/09/12
void LSDJunctionNetwork::calculate_junction_angle_statistics_for_order ( LSDFlowInfo FlowInfo,
int  BasinOrder,
vector< int > &  junction_list,
vector< float > &  junction_angle_averages,
vector< float > &  junction_angle_stderr,
vector< int > &  N_junctions 
)

This takes the junction angle statistics for all basins of a given order.

Parameters
FlowInfothe LSDFlowInfo object
BasinOrderthe basin order of interest
junction_lista vector of ints holding the junctions of interest is replaced in the function
junction_angle_averagesAverage junction angles is replaced in the function
junction_angle_stdera vector junction angle standard errors is replaced in the function
N_junctionsa vector of ints holding the numer of junctions in each larger basin is replaced in the function
Author
SMM
Date
24/04/2017
vector< float > LSDJunctionNetwork::calculate_junction_angle_statistics_upstream_of_junction ( int  target_junction,
LSDFlowInfo FlowInfo 
)

This function gets the mean and standard error of every junction angle upslope of a given junction.

Parameters
target_junctionThe target junction
FlowInfoan LSDFlowInfo object
Returns
A vector of that has the mean and the standard error of the upslope junction angles
Author
SMM
Date
23/04/2017
vector<float> LSDJunctionNetwork::calculate_junction_angle_statistics_upstream_of_junction ( int  target_junction,
LSDFlowInfo FlowInfo,
int  threshold_SO 
)

Overloaded function similar to above but removes any junctions not greater than threshold SO.

Parameters
target_junctionThe target junction
FlowInfoan LSDFlowInfo object
threshold_SOthreshold stream order to keep junctions (greater than this)
Returns
A vector of that has the stats of the upslope junction angles
Author
FJC
Date
08/03/18
map< int, vector< float > > LSDJunctionNetwork::calculate_junction_angles ( vector< int >  JunctionList,
LSDFlowInfo FlowInfo 
)

This calculates the junction angles based on a number of junctions.

Parameters
JunctionLista list of junctions
FlowInfoan LSDFlowInfo object
Returns
A vector of junction angles
Author
SMM
Date
21/04/2017
vector< int > LSDJunctionNetwork::calculate_pelletier_channel_heads ( float  tan_curv_threshold,
LSDFlowInfo FlowInfo,
Array2D< float > &  tan_curv_array 
)

This function is used to predict channel head locations based on the method proposed by Pelletier (2013).

It creates a contour curvature map and identifies channel heads as pixels greater than a user defined contour curvature threshold value, set by default at 0.1. The threshold curvature can also be defined as a multiple of the standard deviation of the curvature. Before this function is called the DEM must be filtered using the wiener filter in the LSDRasterSpectral object in order to remove high frequency noise.

Reference: Pelletier (2013) A robust, two-parameter method for the extraction of drainage networks from high-resolution digital elevation models (DEMs): Evaluation using synthetic and real-world DEMs, Water Resources Research 49: 1-15

Parameters
tan_curv_thresholdDouble curvature threshold value.
FlowInfoFlow Info object
tan_curv_array2D array of tangential curvature.
Returns
2D array of predicted channel head locations.
Author
FC
Date
16/07/13
vector< int > LSDJunctionNetwork::calculate_pelletier_channel_heads_DTM ( LSDFlowInfo FlowInfo,
Array2D< float >  topography,
float  tan_curv_threshold,
Array2D< float > &  tan_curv_array,
Array2D< float > &  tan_curv_array_LW 
)

This function predicts channel head locations based on a tangential threshold as proposed by Pelletier (2013).

This function is used to predict channel head locations based on the method proposed by Pelletier (2013). First it creates a contour curvature map and identifies channel heads as pixels with tangential curvature greater than a user defined threshold value. This map needed to be reduced to give the source pixels only. This is done by i) sorting all the possible sources by elevation and ii) routing flow from each potential source using an adaption of Freeman MD flow. Any potential sources that are located on ANY down-slope pathway within convergent part of the topography from previously visited source pixels are excluded.

Reference: Pelletier (2013) A robust, two-parameter method for the extraction of drainage networks from high-resolution digital elevation models (DEMs): Evaluation using synthetic and real-world DEMs, Water Resources Research 49: 1-15

Parameters
FlowInfoobject
rastercontaining elevation data
athreshold value of tangential curvature
anarray of tangential curvature
Author
DTM
Date
03/06/2014
LSDRaster LSDJunctionNetwork::calculate_relief_from_channel ( LSDRaster ElevationRaster,
LSDFlowInfo FlowInfo,
int  threshold_SO 
)

This function calculates the relief of each pixel compared to the nearest downstream channel pixel equal or greater to the threshold stream order

Parameters
ElevationRasterLSDRaster with elevations
FlowInfoLSDFlowInfo object
threshold_SOthreshold stream order to calculate relief from
Returns
LSDRaster with channel relief
Author
FJC
Date
17/11/15
LSDRaster LSDJunctionNetwork::calculate_relief_from_channel_connected_components ( LSDRaster ElevationRaster,
LSDIndexRaster ConnectedComponents,
LSDRaster DistFromOutlet,
LSDFlowInfo FlowInfo,
int  threshold_SO,
int  search_distance 
)

This function calculates the relief of each pixel compared to the nearest downstream channel pixel equal or greater to the threshold stream order for that connected components patch

Parameters
ElevationRasterLSDRaster with elevations
ConnectedComponentsconnected components raster
DistFromOutletraster of flow lengths
FlowInfoLSDFlowInfo object
threshold_SOoriginal threshold stream order to calculate relief from
Returns
LSDRaster with channel relief
Author
FJC
Date
29/09/16
LSDIndexRaster LSDJunctionNetwork::ChannelIndexer ( LSDFlowInfo flowinfo)

This function iterates through the junction nodes and assigns the unique junction ID to every stream pixel.

This can be used with the LSDRaster hilltop_flow_routing function to assign a unique ID to each hilltop section tying it to a specific section of the channel network.

Parameters
flowinfoLSDFlowInfo object.
Returns
LSDIndexRaster of the indexed channel newtork.
Author
SWDG
Date
04/04/13
int LSDJunctionNetwork::check_stream_order_of_upstream_nodes ( int  junction,
LSDFlowInfo FlowInfo 
)

This function checks whether any of the upstream nodes of a given junction are the same steam order as the junction itself. It returns an integer value which is 1 if the SO is the same and 0 if it is not the same.

Parameters
junctionjunction of interest
FlowInfoLSDFlowInfo object.
Returns
integer value 0 or 1
Author
FJC and MAH
Date
18/03/16
LSDIndexRaster LSDJunctionNetwork::extract_basin_from_junction ( int  basin_junction,
int  basin_reference_number,
LSDFlowInfo FlowInfo 
)

This function gets the node indices of outlets of basins of a certain order.

IMPORTANT: The junctions always point downstream since they can have one and only one receiver. However, for a basin of given order, this starts just upstream of the confluence to the next basin order. So the basin INCLUDES the channel flowing downstream to the penultamite node.

Parameters
basin_junctionJunction of basin to be extracted.
basin_reference_numberReference number for printing to the IndexRaster.
FlowInfoLSDFlowInfo object.
Returns
LSDIndexRaster of extracted basin.
Author
SMM
Date
01/09/12
vector< int > LSDJunctionNetwork::extract_basin_junctions_from_nodes ( vector< int >  basin_nodes,
LSDFlowInfo FlowInfo 
)

This function extracts basin junctions from a list of basin outlet nodes.

Parameters
basin_nodeslist of basin outlet nodes
FlowInfoLSDFlowInfo object
Returns
vector of basin junctions
Author
FJC
Date
15/01/2014
vector< int > LSDJunctionNetwork::extract_basin_nodes_above_drainage_area_threshold ( LSDFlowInfo FlowInfo,
float  DrainageAreaThreshold 
)

This function extracts nodes where the basins of both tributaries are greater than a certain drainage area threshold. Moves downstream from sources to baselevel so that nested catchments will be selected.

Parameters
FlowInfoLSDFlowInfo object.
DrainageAreaThresholdThreshold drainage area.
Returns
Vector of basin nodes. These are the nodes just upstream of the outlet junction at the confluence of the basins.
Author
FJC
Date
10/01/17
vector< int > LSDJunctionNetwork::extract_basin_nodes_by_drainage_area ( float  DrainageAreaThreshold,
LSDFlowInfo FlowInfo 
)

This function extracts basin nodes according to their accumulated drainage area.

Parameters
ThresholdThreshold drainage area.
FlowInfoLSDFlowInfo object.
Returns
Vector of basin nodes.
Author
DTM
Date
07/05/2013
LSDIndexRaster LSDJunctionNetwork::extract_basins_from_junction_vector ( vector< int >  basin_junctions,
LSDFlowInfo FlowInfo 
)

This function gets the an LSDIndexRaster of basins draining from a vector of junctions.

IMPORTANT: The junctions always point downstream since they can have one and only one receiver. However, for a basin of given order, this starts just upstream of the confluence to the next basin order. So the basin INCLUDES the channel flowing downstream to the penultamite node.

Parameters
basin_junctionsVector of junction numbers of basins to be extracted.
FlowInfoLSDFlowInfo object.
Returns
LSDIndexRaster of extracted basin.
Author
SMM
Date
01/09/12
LSDIndexRaster LSDJunctionNetwork::extract_basins_from_junction_vector_nested ( vector< int >  basin_junctions,
LSDFlowInfo FlowInfo 
)

This function gets an LSDIndexRaster of basins draining from a vector of junctions.

IMPORTANT: The junctions always point downstream since they can have one and only one receiver. However, for a basin of given order, this starts just upstream of the confluence to the next basin order. So the basin INCLUDES the channel flowing downstream to the penultamite node. UPDATED so that if basins are nested, they don't overwrite each other - basins are sorted by the number of contributing pixels, and the smaller basins are written first.

Parameters
basin_junctionsVector of junction numbers of basins to be extracted.
FlowInfoLSDFlowInfo object.
Returns
LSDIndexRaster of extracted basin.
Author
FJC
Date
10/01/17
LSDIndexRaster LSDJunctionNetwork::extract_basins_from_junctions_rudimentary ( vector< int >  junctions,
LSDFlowInfo FlowInfo 
)

This function gets the an LSDIndexRaster of basins draining from a vector of junctions.

IThis is a highly rudimentary version, which just collects all the upslope nodes.

Parameters
basin_junctionsVector of junction numbers of basins to be extracted.
FlowInfoLSDFlowInfo object.
Returns
LSDIndexRaster of extracted basin.
Author
SMM
Date
08/05/15
vector< int > LSDJunctionNetwork::extract_basins_order_outlet_junctions ( int  BasinOrder,
LSDFlowInfo FlowInfo 
)

This extracts the junction numbers, in a vector of integers, of all basins of a given order.

For basins, the basin includes nodes downstream of the basinJunction, until the penulatmite node in this downstream channel.

IMPORTANT: the junctions always point downstream since they can have one and only one receiver. However, for a basin of given order, this starts just upstream of the confluence to the next basin order. So the basin INCLUDES the channel flowing downstream to the penultamite node.

Parameters
BasinOrderInteger of the basin order.
FlowInfoLSDFlowInfo object.
Returns
Vector of junctions of basins of given order.
Author
SMM
Date
01/09/12
vector< int > LSDJunctionNetwork::extract_basins_order_outlet_nodes ( vector< int > &  BasinOutletJunctions,
LSDFlowInfo FlowInfo 
)

this function gets the outlet node of a list of basins.

The basin outlet node is DOWNSTREAM from the outlet junction, it is the penultamite node of the channel index.

Parameters
BasinOutletJunctions
FlowInfoLSDFlowInfo object.
Returns
Vector of outlet nodes of basins.
Author
SMM
Date
01/09/12
LSDIndexRaster LSDJunctionNetwork::extract_hollow ( int  CH_junction,
LSDFlowInfo FlowInfo 
)

This function extracts a single hollow from a given channel head junction.

The junction index of channel heads can be extracted using LSDJunctionNetwork.Get_Channel_Head_Junctions.

Parameters
CH_junctionJunction index to extract.
FlowInfoLSDFlowInfo object.
Returns
LSDIndexRaster of the extracted hollow, coded with junction number.
Author
SWDG
Date
05/12/13
LSDIndexRaster LSDJunctionNetwork::extract_hollow ( vector< int >  CH_junctions,
LSDFlowInfo FlowInfo 
)

This function extracts a series of hollows from a vector of channel head junctions.

The junction index of channel heads can be extracted using LSDJunctionNetwork.Get_Channel_Head_Junctions.

Parameters
CH_junctionsVector of juntions to extract.
FlowInfoLSDFlowInfo object.
Returns
LSDIndexRaster of the extracted hollows, coded with junction numbers.
Author
SWDG
Date
05/12/13
void LSDJunctionNetwork::extract_tributary_junctions_to_main_stem ( LSDIndexChannel MainStem,
LSDFlowInfo FlowInfo,
vector< int > &  tributary_junctions,
vector< int > &  nodes_on_main_stem_of_tributaries 
)

This function gets tributaries along a continous channel.

What it does is goes down the index channel looking at the JunctionIndexArray to see if there is a junction. If it hits a junction then all the contributing junction it overwrites two vectors:
tributary_junctions, which lists all junctions whose reciever is the main stem and nodes_on_main_stem_of_tributaries, which are the njodes on the main_stem LSDIndexChannel where the tributaries intersect the main stem this second vector is used to calcualte the chi values of the downstream node of the tributaries.

Parameters
MainStemLSDIndexChannel of the main stem.
FlowInfoLSDFlowInfo object.
tributary_junctions
nodes_on_main_stem_of_tributaries
Author
SMM
Date
01/09/12
vector< int > LSDJunctionNetwork::ExtractBasinJunctionOrder ( int  BasinOrder,
LSDFlowInfo FlowInfo 
)

This function extracts the juctions of all non-beheaded drainage basins of a given order, n.

Parameters
BasinOrderInteger basin order to extract.
FlowInfoLSDFlowInfo object.
Returns
Vector of junction indexes.
Author
SWDG
Date
24/10/2013
vector< int > LSDJunctionNetwork::ExtractBasinJunctionOrderKeepEdgeBasins ( int  BasinOrder,
LSDFlowInfo FlowInfo 
)

This function extracts the juctions of all non-beheaded drainage basins of a given order, n. Like the previous version but in this case includes basins at the edge (abutting nodata)

Parameters
BasinOrderInteger basin order to extract.
FlowInfoLSDFlowInfo object.
Returns
Vector of junction indexes.
Author
SMM
Date
29/04/2017
LSDIndexRaster LSDJunctionNetwork::ExtractBasinsOrder ( int  BasinOrder,
LSDFlowInfo FlowInfo 
)

Basin extraction - extracts all drainage basins of specified stream order.

Parameters
BasinOrderInteger basin order to extract.
FlowInfoLSDFlowInfo object.
Returns
LSDIndexRaster of extracted basins.
Author
DTM
Date
17/10/2012
LSDRaster LSDJunctionNetwork::ExtractHilltops ( LSDRaster RidgeRaster,
LSDRaster SlopeRaster,
float  MaxSlope 
)

This last function gets the hilltops: ridges limited by a maximum slope.

Resticts ridgeline to part of ridge network where the slope is less than a threshold value.

Now outputs an LSDRaster to fall in line with other hilltop tools - SWDG 29/8/13

Parameters
RidgeRasterLSDIndexRaster of extracted ridges.
SlopeRasterLSDRaster of slope.
MaxSlopeMaximum threshold slope value.
Returns
LSDIndexRaster of hilltops.
Author
DTM
Date
01/04/2013
LSDRaster LSDJunctionNetwork::ExtractRidges ( LSDFlowInfo FlowInfo)

Ridge network extraction - extracts ridge network, defined as boundaries between two basins of the same stream order.

This function extracts the ridge network by defining it as the co-boundaries of basins of equivalent order, for all basin orders within the landscape. This is relatively trivial since in each array containing the basins of the same order, each basin is labelled with a unique identifier, thus co- boundaries are found by locating pixels that neighbour pixels from another basin of the same order.

Updated to return an LSDRaster object as ridges can now be assigned CHT values, using LSDRaster::RidgeSample, which are not integers. - SWDG

Parameters
FlowInfoLSDFlowInfo object.
Returns
LSDRaster of ridges.
Author
DTM
Date
18/10/2012
LSDRaster LSDJunctionNetwork::ExtractRidges ( LSDFlowInfo FlowInfo,
int &  min_order,
int &  max_order 
)

This overloaded function extracts the ridge network for a defined stream order, passed in by the user.

Updated to return an LSDRaster object as ridges can now be assigned CHT values, using LSDRaster::RidgeSample, which are not integers. - SWDG

Parameters
FlowInfoLSDFlowInfo object.
min_orderLowest order of ridges to extract.
max_orderHighest order of ridges to extract.
Returns
LSDRaster of ridges.
Author
DTM, SWDG
Date
18/10/2012, 28/03/2013
int LSDJunctionNetwork::find_base_level_node_of_junction ( int  StartingJunction)

This functions takes a junction number and then follwos the receiver junctions until it hits a baselevel junction.

Parameters
ajunction node to start from.
Returns
The base level junction to which the starting junction drains
Author
SMM
Date
21/02/2014
float LSDJunctionNetwork::find_distance_to_nearest_floodplain_pixel ( int  point_node,
int  search_distance,
LSDRaster FloodplainRaster,
LSDFlowInfo FlowInfo 
)

This function returns the node index of the nearest FIP to a specified node.

Parameters
point_nodeNode to start with
search_distanceDistance to search upstream and downstream for a FIP
FloodplainRasterRaster with binary floodplain
FlowInfoLSDFlowInfo object
Returns
node index of nearest FIP
Author
FJC
Date
09/09/16
float LSDJunctionNetwork::find_mean_elevation_of_channel_reach ( int  StartingNode,
int  search_distance,
LSDRaster ElevationRaster,
LSDFlowInfo FlowInfo 
)

This function finds the mean elevation of the channel reach given a node on the channel network

Parameters
StartingNodenode to check
search_distancereach distance - will check both upstream and downstream this distance
ElevationRasterelevation raster
FlowInfoLSDFlowInfo object
Returns
mean elevation of reach
Author
FJC
Date
29/09/16
int LSDJunctionNetwork::find_upstream_junction_from_channel_nodeindex ( int  ChannelNodeIndex,
LSDFlowInfo FlowInfo 
)

This function takes a node index, checks to see if it is on a channel, and then works its way up the channel to find the upstream junction.

Parameters
ChannelNodeIndexis the node index of the channel node (if it isn't a channel the function returns NoDataValue
FlowInfoLSDFlowInfo object.
Returns
Returns the Junction Number of the nearest upslope junction
Author
SMM
Date
21/10/2013
Array2D< int > LSDJunctionNetwork::find_valleys ( LSDFlowInfo FlowInfo,
Array2D< float > &  tan_curv_array,
vector< int >  sources,
int  no_connecting_nodes,
float  tan_curv_threshold = 0.1 
)

This function is used to identify concave portions of the landscape using a tangential curvature threshold.

It defines the threshold based on a multiple of the standard deviation of the curvature. It then identifies valleys in which there are a linked series of pixels which have a curvature value greater than the threshold, and finds the outlet junction number of this valley. This can be passed to the channel head prediction algorithm using the chi method.

Parameters
FlowInfoLSDFlowInfo object
tan_curv_array2D array with curvature
sourcesvector with sources of channel network
no_connecting_nodesnumber of nodes that need to be above the threshold before the valley is identified
Returns
Array2D<int> with nodes at the base of each of the valleys
Author
FC
Date
29/10/2013
Array2D< int > LSDJunctionNetwork::find_valleys_adaptive_threshold ( LSDFlowInfo FlowInfo,
Array2D< float > &  tan_curv_array,
vector< int >  sources,
int  no_connecting_nodes,
Array2D< float > &  tan_curv_threshold 
)

This function is used to identify concave portions of the landscape using a tangential curvature threshold which is adaptive for each portion of the landscape.

It defines the threshold based on the standard deviation of the curvature. It then identifies valleys in which there are a linked series of pixels which have a curvature value greater than the threshold, and finds the outlet junction number of this valley. This can be passed to the channel head prediction algorithm using the chi method.

Parameters
FlowInfoLSDFlowInfo object
tan_curv_array2D array with curvature
sourcesvector with sources of channel network
no_connecting_nodesnumber of nodes that need to be above the threshold before the valley is identified
tan_curv_thresholdarray with the curvature thresholds for each row and col
Returns
Array2D<int> with nodes at the base of each of the valleys
Author
FC
Date
29/10/2013
Array2D< int > LSDJunctionNetwork::find_valleys_using_channel_mask ( LSDFlowInfo FlowInfo,
Array2D< int > &  channel_mask,
vector< int >  sources,
int  no_connecting_nodes 
)

This function uses a predefined channel mask to locate valley junctions.

This uses the same approach as the find_valleys function, but allows greater flexibility in how the valley network is defined

Parameters
FlowInfoLSDFlowInfo object
channel_mask2D binary array with multi-pixel channel network marked by 1s
sourcesvector with sources of channel network
no_connecting_nodesnumber of nodes that need to be above the threshold before the valley is identified
Returns
Array2D<int> with nodes at the base of each of the valleys
vector< int > LSDJunctionNetwork::FindFarthestUpslopeHilltopsFromSources ( int  JunctionNumber,
LSDFlowInfo FlowInfo,
LSDRaster FlowDistance 
)

Get farthest upslope hilltops.

This function looks at all the source junctions in a network upstream of a given junction and returns the node index of the hilltop node that is the farthest upstream from the source junction

Parameters
JunctionNumberthe junction number upstream of which you want to search for sources
FlowInfothe flow info object
FlowDistancedistance upslope
Returns
vector<int> a vector of node indices to the ridge nodes that are farthest upslope of the sources
Author
SMM
Date
26/09/2013
LSDIndexChannel LSDJunctionNetwork::generate_link_index_channel_from_junction ( int  start_junction,
LSDFlowInfo FlowInfo 
)

This generates an LSDChannelIndex object given a junction.

NOTE: junctions start at the upstream end of the channel section.

Parameters
start_junctionJunction to extract the channel from.
FlowInfoLSDFlowInfo object.
Returns
The channel for the given junction.
Author
SMM
Date
01/09/12
LSDIndexChannel LSDJunctionNetwork::generate_longest_index_channel_from_junction ( int  outlet_junction,
LSDFlowInfo FInfo,
LSDRaster dist_from_outlet 
)

This function extracts the longest channel originating from a junction number outlet_junction.

Parameters
outlet_junctionOutlet of junction.
FInfoLSDFlowInfo object.
dist_from_outletDistance from outlet junction.
Returns
LSDIndexRaster of the longest channel.
Author
SMM
Date
01/09/12
LSDIndexChannel LSDJunctionNetwork::generate_longest_index_channel_in_basin ( int  basin_junction,
LSDFlowInfo FInfo,
LSDRaster dist_from_outlet 
)

This generates the longest channel in a basin.

The basin starts where a channel of some order intersects with a channel of higher order. So the bain includes the basin junction, but also the channel flowing downstream from this basin junction. It starts from the node of the reciever junction, so if one were to extract the basin from this node one would get a basin that starts one node upstream from the lowest node in this.

Parameters
basin_junction
FInfoLSDFlowInfo object.
dist_from_outlet
Returns
LSDIndexRaster of the longest channel.
Author
SMM
Date
01/09/12
vector< int > LSDJunctionNetwork::get_all_source_junctions_of_an_outlet_junction ( int  junction_number_outlet)

This finds all the junctions that are source junctions upslope of a given junction.

Parameters
junction_number_outletThe junction number of the outlet
Returns
source_junctions a vector of junction numbers: these are the sources
Author
SMM
Date
18/05/2016
vector< int > LSDJunctionNetwork::get_all_source_nodes_of_an_outlet_junction ( int  junction_number_outlet)

This finds all the nodes that are source nodes upslope of a given junction.

Parameters
junction_number_outletThe junction number of the outlet
Returns
source_nodes a vector of node numbers: these are the sources the nodes are node indices from the FlowInof object
Author
SMM
Date
19/05/2016
vector< int > LSDJunctionNetwork::get_BaseLevel_DonorJunctions ( )

This gets the largest donor junction to the baselevel nodes so that you can automate basin selection. (e.g. for use with chi analysis)

This function returns a integer vector containing the junction number of the largest donor catchment (i.e. donor junction with greatest drainage area) upslope of each baselevel node. These can then be used as the starting locations for performing chi analysis.

IMPORTANT: the junctions always point downstream since they can have one and only one receiver. However, for a basin of given order, this starts just upstream of the confluence to the next basin order. So the basin INCLUDES the channel flowing downstream to the penultamite node.

Returns
Integer vector containing the junction number of the largest donor catchment.
Author
MDH
Date
19/6/13
vector<int> LSDJunctionNetwork::get_BaseLevelJunctions ( ) const
inline
Returns
Get the baselevel junstions
vector< int > LSDJunctionNetwork::get_basin_sources_from_outlet_vector ( vector< int >  basin_junctions,
LSDFlowInfo FlowInfo,
LSDRaster dist_from_outlet 
)

This generates the upstream source nodes from a vector of basin junctions.

The basin starts where a channel of some order intersects with a channel of higher order. So the bain includes the basin junction, but also the channel flowing downstream from this basin junction. It starts from the node of the reciever junction, so if one were to extract the basin from this node one would get a basin that starts one node upstream from the lowest node in this.

Parameters
basin_junction
FInfoLSDFlowInfo object.
dist_from_outlet
Returns
LSDIndexRaster of the longest channel.
Author
FJC
Date
21/03/17
vector< int > LSDJunctionNetwork::Get_Channel_Head_Junctions ( vector< int >  Sources,
LSDFlowInfo FlowInfo 
)

This function converts a list of sources used to generate the initial channel network into a list of junction indexes of channel heads which can be used to extract hollows.

Parameters
SourcesA vector of source nodes that correspond to channel heads.
FlowInfoLSDFlowInfo object.
Returns
A vector of junction indexes for each channel head.
Author
SWDG
Date
05/12/13
vector< int > LSDJunctionNetwork::get_channel_pixels_along_line ( vector< int >  line_rows,
vector< int >  line_cols,
int  threshold_SO,
LSDFlowInfo FlowInfo 
)

This function gets all the pixels along a line defined by a series of points and finds the pixels greater than a specified stream order.

Parameters
PointsPointData object with the points
ElevationRasterraster of elevations
threshold_SOthreshold stream order
FlowInfoLSDFlowInfo object
Author
FJC
Date
17/04/17
vector< int > LSDJunctionNetwork::get_contributing_pixels_from_specified_junctions ( vector< int > &  JunctionList,
LSDFlowInfo FlowInfo,
LSDIndexRaster FlowAcc 
)

You give this a list of junction numbers and it returns the number of upslope pixels.

Parameters
BaseLevelJunctions_Initiala vector of integers containg an inital list of base level nodes
FlowInfoThe LSDFlowInfo object
FlowAccan LSDIndexRaster with the number of pixels for flow accumulation
ThresholdThe minimum number of accumulated pixels needed to keep a base level node.
Returns
a vector with the N contributing pixels for the junctions specified
Author
SMM
Date
21/06/17
float LSDJunctionNetwork::get_DataResolution ( ) const
inline
Returns
Data resolution as an integer.
vector< int > LSDJunctionNetwork::get_donor_nodes ( int  node)

this function gets a list of the junction indices of the donors to a particular junction IMPORTANT: this has only retained the string "node" to keep equivalence with the FlowInfo object. It takes junctions and returns junctions!! Also note that base level nodes have themselves as a donor

Parameters
nodethis is the nodeindex of the node for which you want to find the donors
Returns
a vector of the donor nodes
Author
SMM
Date
15/06/2015
int LSDJunctionNetwork::get_downstream_junction ( int  starting_junction,
LSDFlowInfo FlowInfo 
)

Get downstream junction

Parameters
starting_junctionstarting junction
FlowInfoLSDFlowInfo object
Returns
integer with downstream junction number
Author
FJC
Date
08/10/15
Array2D< int > LSDJunctionNetwork::Get_Elevation_of_Nearest_Channel_for_Connected_Components ( LSDIndexRaster ConnectedComponents,
LSDRaster ElevationRaster,
LSDRaster DistFromOutlet,
LSDFlowInfo FlowInfo,
int  threshold_SO,
int  search_distance 
)

This function takes in a raster of connected component patches. It finds the elevation of the nearest channel for the patch.

Parameters
ConnectedComponentsconnected components raster
ElevationRasterLSDRaster of elevations
FlowInfoLSDFlowInfo object
DistFromOutletLSDRaster of flow lengths
threshold_SOthreshold stream order to calculate relief from
search_distancelength of channel reach to get elevation from
Returns
2D array with the elevation of nearest channel for each patch
Author
FJC
Date
29/09/16
map<string,string> LSDJunctionNetwork::get_GeoReferencingStrings ( ) const
inline
Returns
Georeferencing information
void LSDJunctionNetwork::get_info_nearest_channel_to_node ( int &  StartingNode,
int &  threshold_SO,
LSDFlowInfo FlowInfo,
LSDRaster DistFromOutlet,
int &  ChannelNode,
float &  FlowLength,
float &  DistanceUpstream 
)

Function to get info about the nearest channel node of a given node.

Parameters
StartingNodeindex of node of interest
threshold_SOthreshold stream order for finding the nearest channel
FlowInfoLSDFlowInfo object
DistFromOutletLSDRaster of flow lengths
ChannelNodeint to store the NI of the nearest channel
FlowLengthfloat to store the flow length to the nearest channel
DistanceUpstreamfloat to store the distance upstream of the nearest channel
Author
FJC
Date
29/09/16
void LSDJunctionNetwork::get_info_nearest_channel_to_node_main_stem ( int &  StartingNode,
LSDFlowInfo FlowInfo,
LSDRaster ElevationRaster,
LSDRaster DistFromOutlet,
LSDIndexChannel MainStem,
int &  ChannelNode,
float &  FlowLength,
float &  DistanceUpstream,
float &  Relief 
)

Function to get info about the nearest channel node on the main stem of a given node.

Parameters
StartingNodeindex of node of interest
FlowInfoLSDFlowInfo object
ElevationRasterLSDRaster of elevations
DistFromOutletLSDRaster of flow lengths
ChannelNodeint to store the NI of the nearest channel
FlowLengthfloat to store the flow length to the nearest channel
DistanceUpstreamfloat to store the distance upstream of the nearest channel
Relieffloat to store relief compared to nearest channel
Author
FJC
Date
05/10/16
int LSDJunctionNetwork::get_junction_of_nearest_channel_from_lat_long ( double  latitude,
double  longitude,
LSDFlowInfo FlowInfo,
LSDCoordinateConverterLLandUTM  Converter 
)

Function to snap input coordinates to the nearest channel node from latitude and longitude.

Parameters
latitude
longitude
FlowInfoLSDFlowInfo object.
ConverterLSDCoordinateConverterLLandUTM object
Returns
Returns the NodeIndex of the nearest channel node.
Author
FJC
Date
20/11/17
int LSDJunctionNetwork::get_Junction_of_Node ( int  Node,
LSDFlowInfo FlowInfo 
)

This gets the junction number of a given node.

Parameters
Node
FlowInfoFlow Info object
Returns
JunctionNumber
Author
FC
Date
31/10/13
vector< int > LSDJunctionNetwork::get_Junctions_of_Sources ( LSDFlowInfo FlowInfo)

This gets the junction number all the sources.

Parameters
FlowInfoFlow Info object
Returns
A vector of junctions from all the sources
Author
SMM
Date
08/05/15
vector<int> LSDJunctionNetwork::get_JunctionVector ( ) const
inline
Returns
The Vector of Junctions. Note that these are the node indices of the junctions. The junction numbers just go from 0 to NJunctions
void LSDJunctionNetwork::get_lat_and_long_locations ( int  row,
int  col,
double &  lat,
double &  longitude,
LSDCoordinateConverterLLandUTM  Converter 
)

a function to get the lat and long of a node in the raster Assumes WGS84 ellipsiod

Parameters
rowthe row of the node
colthe col of the node
latthe latitude of the node (in decimal degrees, replaced by function) Note: this is a double, because a float does not have sufficient precision relative to a UTM location (which is in metres)
longthe longitude of the node (in decimal degrees, replaced by function) Note: this is a double, because a float does not have sufficient precision relative to a UTM location (which is in metres)
Convertera converter object (from LSDShapeTools)
Author
SMM
Date
22/12/2014
int LSDJunctionNetwork::get_maximum_stream_order ( )

This function returns the maximum stream order in the DEM.

Returns
Maximum stream order as an integer.
Author
SMM
Date
01/09/12
int LSDJunctionNetwork::get_NCols ( ) const
inline
Returns
Number of columns as an integer.
int LSDJunctionNetwork::get_Next_StreamOrder_Junction ( int  junction)

This gets the junction that is at the next Strahler stream order from the current junction.

Parameters
junctionthe current junction
Returns
the junction that is at the next stream order if the next stream order is not reached before baselevel it returns a NoDataValue
Author
SMM
Date
26/10/2014
int LSDJunctionNetwork::get_NJunctions ( ) const
inline
Returns
The number of junctions
int LSDJunctionNetwork::get_NoDataValue ( ) const
inline
Returns
No Data Value as an integer.
vector< int > LSDJunctionNetwork::get_node_list_from_junction_list ( vector< int >  junction_list)

Gets a node list from a junction list

Parameters
junction_lista vector of junctions
Returns
vector of nodes
Author
SMM
Date
20/01/2018
vector< int > LSDJunctionNetwork::get_node_list_of_penultimate_node_from_junction_list ( vector< int >  junction_list,
LSDFlowInfo FlowInfo 
)

Gets a node list from a junction list. The nodes are the penultimate nodes before the reciever juctions

Parameters
junction_lista vector of junctions
FlowInfothe LSDFlowInfo object
Returns
vector of nodes
Author
SMM
Date
20/01/2018
int LSDJunctionNetwork::get_Node_of_Junction ( int  junction) const

Gets the node of a junction

Parameters
junctioninteger node index.
Returns
Integer node of junction.
Author
SMM
Date
01/01/2014
int LSDJunctionNetwork::get_nodeindex_of_nearest_channel_for_specified_coordinates ( float  X_coordinate,
float  Y_coordinate,
int  threshold_stream_order,
int  search_radius_nodes,
LSDFlowInfo FlowInfo 
)

Function to snap input coordinates to the nearest channel node. This enables easy extraction of a particular catchment for analysis.

Parameters
X_coordinateof point. In coordiantes of DEM (usually UTM).
Y_coordinateof point. In coordiantes of DEM (usually UTM).
threshold_stream_orderThe minimum stream order that will be considers a 'channel' by the algorithm
search_radius_nodesthe radius of the kernal used to check if there is a nearby channel. A radius of 0 only includes the centre point, a radius of 1 has a kernal diameter of 3, radius of 2 has a kernal diameter of 5 and so on
FlowInfoLSDFlowInfo object.
Returns
Returns the NodeIndex of the nearest channel node.
Author
SMM
Date
21/10/2013
int LSDJunctionNetwork::get_NRows ( ) const
inline
Returns
Number of rows as an integer.
int LSDJunctionNetwork::get_number_of_streams ( LSDFlowInfo FlowInfo,
int  stream_order 
)

This function returns the number of streams of a given stream order.

Parameters
FlowInfoLSDFlowInfo object
stream_orderStream order of interest
Returns
integer with number of streams.
Author
FJC
Date
15/03/16
vector< int > LSDJunctionNetwork::get_outlet_nodes_from_sources ( LSDFlowInfo FlowInfo,
vector< int >  sources 
)

This function is used to get the outlet nodes from a vector of input source nodes.

It is used to get a list of valley nodes that can be used in the DrEICH algorithm. The function goes downstream from each source node until the stream order of the downstream node is greater than that of the current node

Parameters
FlowInfoLSDFlowInfo object
sourcesvector with sources of channel network
Returns
vector<int> with node at the base of each of the valleys
Author
FJC
Date
19/08/2015
void LSDJunctionNetwork::get_overlapping_channels ( LSDFlowInfo FlowInfo,
vector< int >  BaseLevel_Junctions,
LSDRaster DistanceFromOutlet,
vector< int > &  source_nodes,
vector< int > &  outlet_nodes,
int  n_nodes_to_visit 
)

This overwrites two vecotrs that give all of the starting and finishing nodes of channels in a basin

Parameters
FlowInfoan LSDFlowInfo object
BaseLevel_Junctionsan integer vector that contains the base level junctions
DistanceFromOutletan LSDRaster with the flow distance
source_nodesa vector continaing the sorted sorce nodes (by flow distance) THIS GETS OVERWRITTEN
outlet_nodesa vector continaing the outlet nodes THIS GETS OVERWRITTEN
Author
SMM
Date
20/05/2016
void LSDJunctionNetwork::get_overlapping_channels ( LSDFlowInfo FlowInfo,
vector< int >  BaseLevel_Junctions,
LSDRaster DistanceFromOutlet,
vector< int > &  source_nodes,
vector< int > &  outlet_nodes,
vector< int > &  baselevel_nodes,
int  n_nodes_to_visit 
)

This overwrites two vecotrs that give all of the starting and finishing nodes of channels in a basin

Parameters
FlowInfoan LSDFlowInfo object
BaseLevel_Junctionsan integer vector that contains the base level junctions
DistanceFromOutletan LSDRaster with the flow distance
source_nodesa vector continaing the sorted sorce nodes (by flow distance) THIS GETS OVERWRITTEN
outlet_nodesa vector continaing the outlet nodes THIS GETS OVERWRITTEN
baselevel_nodesa vector continaing the baselevel nodes (i.e. the node of the outlet of the basin) THIS GETS OVERWRITTEN
Author
SMM
Date
21/06/2017
void LSDJunctionNetwork::get_overlapping_channels_to_downstream_outlets ( LSDFlowInfo FlowInfo,
vector< int >  BaseLevel_Junctions,
LSDRaster DistanceFromOutlet,
vector< int > &  source_nodes,
vector< int > &  outlet_nodes,
int  n_nodes_to_visit 
)

This overwrites two vectors that give all of the starting and finishing nodes of channels in a basin continuing downstream from the selected junction to its outlet

Parameters
FlowInfoan LSDFlowInfo object
BaseLevel_Junctionsan integer vector that contains the base level junctions
DistanceFromOutletan LSDRaster with the flow distance
source_nodesa vector continaing the sorted sorce nodes (by flow distance) THIS GETS OVERWRITTEN
outlet_nodesa vector continaing the outlet nodes THIS GETS OVERWRITTEN
Author
MDH
Date
16/6/2017
void LSDJunctionNetwork::get_overlapping_channels_to_downstream_outlets ( LSDFlowInfo FlowInfo,
vector< int >  BaseLevel_Junctions,
LSDRaster DistanceFromOutlet,
vector< int > &  source_nodes,
vector< int > &  outlet_nodes,
vector< int > &  baselevel_nodes,
int  n_nodes_to_visit 
)

I THINK THIS MIGHT CAUSE A SEG FAULT: NEED TO UPDATE!!!!!

This overwrites two vectors that give all of the starting and finishing nodes of channels in a basin continuing downstream from the selected junction to its outlet

Parameters
FlowInfoan LSDFlowInfo object
BaseLevel_Junctionsan integer vector that contains the base level junctions
DistanceFromOutletan LSDRaster with the flow distance
source_nodesa vector continaing the sorted sorce nodes (by flow distance) THIS GETS OVERWRITTEN
outlet_nodesa vector continaing the outlet nodes THIS GETS OVERWRITTEN
baselevel_nodesa vector continaing the baselevel nodes (i.e. the node of the outlet of the basin) THIS GETS OVERWRITTEN
Author
SMM
Date
21/6/2017
int LSDJunctionNetwork::get_penultimate_node_from_stream_link ( int  upstream_junction,
LSDFlowInfo FlowInfo 
)

returns the penultimate node of the stream link below given junction

Parameters
upstreamjunction of desired stream link
FlowInfoobject
Returns
node index (for FlowInfo) of penultimate node in stream link
Author
DTM
Date
04/06/14
vector< int > LSDJunctionNetwork::get_pruned_tributaries_from_main_stem ( LSDFlowInfo FlowInfo,
LSDJunctionNetwork ChannelNetwork,
int  starting_junction,
LSDRaster DistanceFromOutlet,
int  pruning_switch,
float  pruning_threshold 
)

this function gets the tributary junctions upstream of the starting_junction based on pruning criteria.

This function extracts tributaries juncions to the main stem of the channel, then selects a sample based on various criteria set by an integer called pruning switch

pruning_switch == 0 channels are only added if they exceed a threshold drainage area
pruning_switch == 1 channels are only added if the ratio between them and the mainstem exceeds a certain value (pruning_threshold)
pruning_switch == 2 channels are only added if the ratio between them and the area of the mainstem at the junction exceeds a certain value
pruning_switch == 3 channels are only added if the channel order is >= threshold.

Parameters
FlowInfoLSDFlowInfo object.
ChannelNetworkLSDJunctionNetwork object.
starting_junction
DistanceFromOutletLSDIndexRaster of outlet distances.
pruning_switch
pruning_threshold
Returns
Pruned tributary junctions.
Author
DTM
Date
30/04/2013
int LSDJunctionNetwork::get_receiver_junction_for_specified_coordinates ( float  X_coordinate,
float  Y_coordinate,
LSDFlowInfo FlowInfo 
)

Function to snap input coordinates to the nearest junction. This enables easy extraction of a particular catchment for analysis.

Parameters
X_coordinateof point. In coordiantes of DEM (usually UTM).
Y_coordinateof point. In coordiantes of DEM (usually UTM).
FlowInfoLSDFlowInfo object.
Author
DTM
Date
17/10/2013
int LSDJunctionNetwork::get_Receiver_of_Junction ( int  junction) const

Gets the receiver of a junction

Parameters
junctioninteger reciever index.
Returns
Integer reciever of junction.
Author
SMM
Date
01/01/2014
vector<int> LSDJunctionNetwork::get_ReceiverVector ( ) const
inline
Returns
The Vector of recievers.
vector<int> LSDJunctionNetwork::get_SourcesVector ( ) const
inline
Returns
The vector of sources. The vector is composed of node indices
int LSDJunctionNetwork::get_StreamOrder_of_Junction ( LSDFlowInfo FlowInfo,
int  junction 
)

Gets the stream order of a junction

Parameters
FlowInfoLSDFlowInfo object
junctionthe junction of interest
Returns
integer with stream order of junction
Author
FJC
Date
20/03/14
int LSDJunctionNetwork::get_StreamOrder_of_Junction ( int  junction)

Gets the stream order of a junction

Parameters
junctionthe junction of interest
Returns
integer with stream order of junction
Author
SMM
Date
26/10/14
int LSDJunctionNetwork::get_StreamOrder_of_Node ( LSDFlowInfo FlowInfo,
int  node 
)

Gets the stream order of a node

Parameters
FlowInfoLSDFlowInfo object
nodenode of interest
Returns
integer with stream order of junction
Author
FJC
Date
29/09/16
Array2D<int> LSDJunctionNetwork::get_StreamOrderArray ( ) const
inline
Returns
the stream order array
vector<int> LSDJunctionNetwork::get_StreamOrderVector ( ) const
inline
Returns
The Vector of stream orders.
vector< int > LSDJunctionNetwork::get_upslope_junctions ( int  junction_number_outlet)

This returns all the upstream junction of a junction_number_outlet.

Parameters
junction_number_outletInteger of junction of interest.
Returns
integer vector containing all the junction numbers upslope of the chosen junction.
Author
SMM
Date
01/09/12
int LSDJunctionNetwork::get_upstream_node_max_stream_order ( int  current_node,
LSDFlowInfo FlowInfo 
)

This function returns the node index of the donor node of a given node with the highest stream order.

Parameters
current_nodeThe current node index
FlowInfoLSDFlowInfo object.
Returns
node index of the donor node with the highest stream order
Author
FJC
Date
31/01/17
void LSDJunctionNetwork::get_UTM_information ( int &  UTM_zone,
bool &  is_North 
)

this function gets the UTM_zone and a boolean that is true if the map is in the northern hemisphere

Parameters
UTM_zonethe UTM zone. Replaced in function.
is_Northa boolean that is true if the DEM is in the northern hemisphere. replaced in function
Author
SMM
Date
22/12/2014
void LSDJunctionNetwork::get_x_and_y_from_latlong ( vector< float >  latitude,
vector< float >  longitude,
vector< float > &  UTME,
vector< float > &  UTMN 
)

This takes latitude and longitude (in WGS 84) and converts to vectors of easting and northing in UTM.

Parameters
latitudea vector of latitudes in UTM84
longitudea vector of longitudes in WGS84
UTMEThe easting coordinate (is overwritten)
UTMNThe northing coordinate (is overwritten)
Author
SMM
Date
13/02/2017
void LSDJunctionNetwork::get_x_and_y_locations ( int  row,
int  col,
double &  x_loc,
double &  y_loc 
)

this gets the x and y location of a node at row and column

Parameters
rowthe row of the node
colthe column of the node
x_locthe x location (Northing) of the node
y_locthe y location (Easting) of the node
Author
SMM
Date
22/12/2014
void LSDJunctionNetwork::get_x_and_y_locations ( int  row,
int  col,
float &  x_loc,
float &  y_loc 
)

this gets the x and y location of a node at row and column

Parameters
rowthe row of the node
colthe column of the node
x_locthe x location (Northing) of the node
y_locthe y location (Easting) of the node
Author
SMM
Date
22/12/2014
float LSDJunctionNetwork::get_XMinimum ( ) const
inline
Returns
Minimum X coordinate as an integer.
float LSDJunctionNetwork::get_YMinimum ( ) const
inline
Returns
Minimum Y coordinate as an integer.
LSDIndexRaster LSDJunctionNetwork::GetChannelfromDreich ( int  NodeNumber,
int  MinSegLength,
float  A_0,
float  m_over_n,
LSDFlowInfo FlowInfo,
LSDRaster FlowDistance,
LSDRaster ElevationRaster,
string  path_name,
int  NJunctions 
)

This function generates an LSDIndexRaster of the channel that runs from the hilltop above the furthest upslope source of the junction JunctionNumber.

Parameters
BasinOrder
MinSegLength
A_0
m_over_n
FlowInfo
FlowDistance
ElevationRaster
Returns
LSDIndexRaster with channel
Author
FJC
Date
21/08/15
Array2D< int > LSDJunctionNetwork::GetChannelHeadsChiMethodAllPixels ( int  JunctionNumber,
float  A_0,
float  m_over_n,
float  bin_width,
LSDFlowInfo FlowInfo,
LSDRaster ElevationRaster 
)

This function returns a 2D array containing the locations of all pixels identified as being part of the channel using chi profiles. It calculates the chi and elevation value of every pixel upstream of the given junction, then bins this data and calculates the pixels in the 95th percentile of each bin. Any pixels above the 95th percentile are considered part of the channel, and any below are considered to be hillslopes. This is the first part of the channel head prediction using chi profiles.

Parameters
JunctionNumber
A_0
m_over_n
bin_width
FlowInfoFlow Info object
ElevationRaster
Returns
Array2D<float> with channel pixels
Author
FC
Date
01/10/2013
int LSDJunctionNetwork::GetChannelHeadsChiMethodFromNode ( int  NodeNumber,
int  MinSegLength,
float  A_0,
float  m_over_n,
LSDFlowInfo FlowInfo,
LSDRaster FlowDistance,
LSDRaster ElevationRaster 
)

This function generates LSDChannels that run from the hilltops above all the sources of the junction JunctionNumber.

Author
SMM
Date
26/09/2013
int LSDJunctionNetwork::GetChannelHeadsChiMethodFromSourceNode ( int  NodeNumber,
int  MinSegLength,
float  A_0,
float  m_over_n,
LSDFlowInfo FlowInfo,
LSDRaster FlowDistance,
LSDRaster ElevationRaster,
int  NJunctions 
)

This function generates LSDChannels that run from the hilltops above all the sources from the valley network down to a specified number of downstream junctions below the sources.

Author
FJC
Date
10/09/15
vector< int > LSDJunctionNetwork::GetChannelHeadsChiMethodFromSources ( vector< int >  ValleySources,
int  MinSegLength,
float  A_0,
float  m_over_n,
LSDFlowInfo FlowInfo,
LSDRaster FlowDistance,
LSDRaster ElevationRaster,
int  NJunctions 
)

This function returns all potential channel heads in a DEM. It looks for.

channel heads based on the valley source nodes identified as concave parts of the landscape

Parameters
ValleyJunctions
MinSegLength
A_0
m_over_n
FlowInfo
FlowDistance
ElevationRaster
NJunctionsnumber of downstream junctions to run the channel profiles from
Returns
vector<int> a vector of node_indices of potential channel heads
Author
FC
Date
10/09/15
vector< int > LSDJunctionNetwork::GetChannelHeadsChiMethodFromValleys ( vector< int >  ValleyNodes,
int  MinSegLength,
float  A_0,
float  m_over_n,
LSDFlowInfo FlowInfo,
LSDRaster FlowDistance,
LSDRaster ElevationRaster 
)

This function returns all potential channel heads in a DEM. It looks for channel heads organized by a basin order which is fed to the code The basin order just determines how far downstream the algorithm looks for the 'fluvial' section. It returns a vector<int> of nodeindices where the channel heads are.

Returns
vector<int> a vector of node_indices of potential channel heads
Author
SMM
Date
26/09/2013 This function returns all potential channel heads in a DEM. It looks for channel heads based on the outlet junctions of the valleys (which are identified by looking for portions of the landscape with 10 or more nodes with a high curvature that are linked)
Parameters
ValleyJunctions
MinSegLength
A_0
m_over_n
FlowInfo
FlowDistance
ElevationRaster
Returns
vector<int> a vector of node_indices of potential channel heads
Author
FC
Date
31/10/2013
void LSDJunctionNetwork::GetChannelNodesAndJunctions ( LSDFlowInfo flowinfo,
vector< int > &  NIvec,
vector< int > &  JIvec,
vector< int > &  SOvec 
)

This extracts vectors containing node incidex, junction indices and stream orders of pixels in the channel network. The vectors are replaced by the method.

Author
SMM
Date
14/11/2016
LSDIndexRaster LSDJunctionNetwork::GetChannelsDreich ( vector< int >  ValleySources,
int  MinSegLength,
float  A_0,
float  m_over_n,
LSDFlowInfo FlowInfo,
LSDRaster FlowDistance,
LSDRaster ElevationRaster,
string  path_name,
int  NJunctions 
)

This function returns all channels in the DEM that the DrEICH algorithm uses for segiment fitting. It looks for channels based on the outlet junctions of valleys. It returns a LSDIndexRaster with the channels.

Parameters
ValleyNodes
MinSegLength
A_0
m_over_n
FlowInfo
FlowDistance
ElevationRaster
Returns
LSDIndexRaster with all channels
Author
FJC
Date
21/08/15
vector< int > LSDJunctionNetwork::GetSourceNodesChiMethodAllPixels ( int  JunctionNumber,
float  A_0,
float  m_over_n,
float  bin_width,
LSDFlowInfo FlowInfo,
LSDRaster ElevationRaster 
)

This function returns an integer vector with the node indexes of the furthest upstream pixels identified as being part of the channel using chi profiles. It calculates the chi and elevation value of every pixel upstream of the given junction, then bins this data and calculates the pixels in the 95th percentile of each bin. Any pixels above the 95th percentile are considered part of the channel, and any below are considered to be hillslopes. This is the first part of the channel head prediction using chi profiles.

Parameters
JunctionNumber
A_0
m_over_n
bin_width
FlowInfoFlow Info object
ElevationRaster
Returns
vector<int> with source nodes
Author
FC
Date
04/10/2013
LSDIndexRaster LSDJunctionNetwork::GetStreams ( int  order)

Quick and dirty way to get channels of a defined stream order.

No input error handling, will return an LSDIndexRaster of NoDataValues if an erroneous order is passed in.

Parameters
orderInteger of the required stream order.
Returns
LSDIndexRaster of the desired channels.
Author
SWDG
Date
04/13
LSDIndexRaster LSDJunctionNetwork::GetStreams ( int  min_order,
int  max_order 
)

Quick and dirty way to get channels of a defined range of stream orders.

No input error handling, will return an LSDIndexRaster of NoDataValues if an erroneous order is passed in.

Parameters
min_orderInteger of the miniumum required stream order.
max_orderInteger of the max required stream order.
Returns
LSDIndexRaster of the desired channels.
Author
SWDG
Date
04/13
float LSDJunctionNetwork::GetTotalChannelLengthUpstream ( int  this_node,
LSDFlowInfo FlowInfo 
)

function get the total length of channels upstream of a node

Parameters
this_nodenode of interest
FlowInfoLSDFlowInfo object
Author
FJC
Date
30/04/18
vector< int > LSDJunctionNetwork::identify_upstream_limits ( LSDFlowInfo FlowInfo,
Array2D< float > &  topography,
vector< int >  source_row_vec,
vector< int >  source_col_vec,
Array2D< float > &  tan_curv 
)

This function identifies upstream limit of channel network.

This is used to reduce a map of channel pixels down to a vector of sources for channel extraction. It finds the upstream limit of each channel and then removes channelised pixels that are on ANY downslope pathway, within convergent part of the topography, from previous sources. It uses a similar algorithm to the Freeman multi-directional flow routing algorithm in the LSDRaster object.

Parameters
FlowInfoobject
rastercontaining elevation data
avector of row coordinates for possible source pixels
avector of column coordinates for possible source pixels
anarray of tangential curvature
Author
DTM
Date
03/06/2014
int LSDJunctionNetwork::is_Junction_BaseLevel ( int  junction)

Returns an integer to check whether junction is at base level.

Parameters
junctionthe junction of interest @ return int 1 = base level, 0 = not base level
Author
FJC
Date
11/01/2017
bool LSDJunctionNetwork::is_junction_upstream ( int  current_junction,
int  test_junction 
)

Returns an bool to check whether junction is upstream of another base level

Parameters
current_junctionthe junction of interest
test_junctionthe junction to see if it is upstream @ return true or false
Author
SMM
Date
23/06/2017
LSDIndexRaster LSDJunctionNetwork::JunctionArray_to_LSDIndexRaster ( )

This sends the JunctionArray to a LSDIndexRaster.

Returns
LSDIndexRaster of JunctionArray.
Author
SMM
Date
01/09/12
LSDIndexRaster LSDJunctionNetwork::JunctionIndexArray_to_LSDIndexRaster ( )

This sends the JunctionIndexArray to a LSDIndexRaster.

Returns
LSDIndexRaster of JunctionIndexArray.
Author
SMM
Date
01/09/12
int LSDJunctionNetwork::map_junction_to_upslope_junction_list ( vector< int >  upslope_junctions,
int  junction 
)

This function maps a junction onto the indexing of the upslope junction list.

If you get an upslope junction list the indexing starts at the furthest downslope junction. All of the junction pointing refers to the master junction list however.

Parameters
upslope_junctionsVector of upslope junctions of interest.
junctionInteger of junction of interest.
Returns
Vector of mapped junctions.
Author
SMM
Date
01/09/12
vector< int > LSDJunctionNetwork::modify_basin_nodes_from_mask ( vector< int >  basin_nodes,
LSDFlowInfo FlowInfo,
LSDRaster MaskRaster 
)

This function checks all of the basin nodes to check if they fall within a mask (input raster). If they fall within the mask raster then the first node upstream not in the mask is selected.

Parameters
basin_nodesvector of basin nodes
FlowInfoLSDFlowInfo object
MaskRasterraster to use as mask
Returns
vector with the modified basin nodes
Author
FJC
Date
31/01/17
bool LSDJunctionNetwork::node_tester ( LSDFlowInfo FlowInfo,
int  input_junction 
)

Function to test whether a junction's upstream nodes border areas of No Data important to ensure basins are not being artificially truncated.

Parameters
FlowInfoLSDFlowInfo object.
input_junctionJunction to be tested.
Returns
Boolean indicating if no data values are present or not:
false (0) = only good data values
true (1) = no data values present
Updated 24/10/13 to handle junction numbers in the same way that the basin extraction code does, by searching one junction downstream of the given junction and then going back up by one node - SWDG.
Author
SWDG
Date
27/06/2013
LSDJunctionNetwork & LSDJunctionNetwork::operator= ( const LSDJunctionNetwork LSDR)

Assignment operator.

the copy constructor

void LSDJunctionNetwork::print_channel_segments_to_csv ( LSDFlowInfo FlowInfo,
vector< vector< int > >  SegmentInfoInts,
vector< vector< float > >  SegmentInfoFloats,
string  outfilename 
)

This function prints information about the channel segments from the TypologyModel function to a csv file so it can be read by a GIS.

Parameters
FlowInfoLSDFlowInfo object
SegmentInfoIntsvec<vec> of segment info (integer)
SegmentInfoFloatsvec<vec> of segment info (floating point)
outfilenamestring, csv filename
void LSDJunctionNetwork::print_junction_angles_from_basin_list ( vector< int >  JunctionList,
LSDFlowInfo FlowInfo,
string  csv_outname 
)

This function takes a vector of basin junctions and prints statistics of all the junctions upstream of each basin junction to a CSV. The statstics are separated by stream order.

Parameters
JunctionListlist of basin junctions
FlowInfoLSDFlowInfo object
csv_outnamename of output csv
Author
FJC
Date
08/03/18
void LSDJunctionNetwork::print_junction_angles_to_csv ( vector< int >  JunctionList,
LSDFlowInfo FlowInfo,
string  csv_name 
)

This prints the junction angles to a csv file.

Parameters
JunctionListThe list of junctions to analyze. If this is an empty vector, the code analyses all junctions in the DEM
FlowInfoThe LSDFlowInfo object
csv_nameThe name of the file. Needs full path and csv extension
Author
SMM
Date
23/04/2017
void LSDJunctionNetwork::print_junction_info_vectors ( string  filename)

Prints the information about the junctions to file.

Parameters
filenameOutput filename to be appended with '.txt'.
Author
SMM
Date
01/09/12
void LSDJunctionNetwork::print_junctions_to_csv ( LSDFlowInfo FlowInfo,
vector< int >  JunctionList,
string  fname 
)

Prints a list of junctions, with their locations in both UTM and in lat long WGS1984 to file The format of the file is: junction,node,x,y,latitude,longitude.

Parameters
FlowInfoan LSDFlowInfo object
JunctionListA list of junctions in an integer vector
fnameThe filename of the csv file
Author
SMM
Date
18/05/2016
void LSDJunctionNetwork::print_junctions_to_csv ( LSDFlowInfo FlowInfo,
string  fname 
)

Prints all junctions, with their locations in both UTM and in lat long WGS1984 to file The format of the file is: junction,node,x,y,latitude,longitude.

Parameters
FlowInfoan LSDFlowInfo object
fnameThe filename of the csv file
Author
SMM
Date
21/04/2017
void LSDJunctionNetwork::print_longest_channel ( int  outlet_junction,
LSDFlowInfo FInfo,
LSDIndexRaster dist_code,
LSDRaster dist_from_outlet 
)

Function for printing out the longest channel upstream of a point.

Parameters
outlet_junction
FInfoLSDFlowInfo object.
dist_code
dist_from_outlet
Author
SMM
Date
01/09/12
void LSDJunctionNetwork::PrintChannelNetworkToCSV ( LSDFlowInfo flowinfo,
string  fname_prefix 
)

This prints a stream network to a csv in WGS84 This function prints a network that is ordered by sources, channels have stream orders and junction numbers attached param FlowInfo the flow info object which translates node indices to actual points.

Parameters
FileName_prefixThe prefix of the file to write, if no path is included it will write to the current directory. The csv extension is added automatically.
Author
SMM
Date
14/11/16
vector< int > LSDJunctionNetwork::Prune_Junctions_Area ( vector< int > &  BaseLevelJunctions_Initial,
LSDFlowInfo FlowInfo,
LSDIndexRaster FlowAcc,
int  Threshold 
)

This function takes a list of junctions and then prunes junctions based on their number of contributing pixels.

Parameters
BaseLevelJunctions_Initiala vector of integers containg an inital list of base level nodes
FlowInfoThe LSDFlowInfo object
FlowAccan LSDIndexRaster with the number of pixels for flow accumulation
ThresholdThe minimum number of accumulated pixels needed to keep a base level node.
Returns
a pruned list of base level nodes
Author
SMM
Date
16/05/16
vector< int > LSDJunctionNetwork::Prune_Junctions_By_Contributing_Pixel_Window ( vector< int > &  Junctions_Initial,
LSDFlowInfo FlowInfo,
LSDIndexRaster FlowAcc,
int  lower_limit,
int  upper_limit 
)

This function removes basins that fall outside a contributing pixel Window.

Parameters
Junctions_Initiala vector of integers containg an inital list of junctions
FlowInfoThe LSDFlowInfo object
FlowAccan LSDIndexRaster with the number of pixels for flow accumulation
lower_limitThe minimum number of contributing pixels
upper_limitThe maximum number of contributing pixels
Returns
a pruned list of base level nodes
Author
SMM
Date
26/06/17
vector< int > LSDJunctionNetwork::Prune_Junctions_By_Contributing_Pixel_Window_Remove_Nested_And_Nodata ( LSDFlowInfo FlowInfo,
LSDRaster TestRaster,
LSDIndexRaster FlowAcc,
int  lower_limit,
int  upper_limit 
)

This function removes basins that fall outside a contributing pixel Window, those that are bounded by nodata, and those that are nested. A rather intensive pruning process that hopeuflly results in a number of basins that are a similar size This doesn't just look for baselevel junctions: it goes through all junctions in the DEM. Warning: computationally expensive!

Parameters
FlowInfoThe LSDFlowInfo object
TestRasterA raster that is just used to look for nodata
FlowAccan LSDIndexRaster with the number of pixels for flow accumulation
lower_limitThe minimum number of contributing pixels
upper_limitThe maximum number of contributing pixels
Returns
a pruned list of base level nodes
Author
SMM
Date
26/06/17
vector< int > LSDJunctionNetwork::Prune_Junctions_Edge ( vector< int > &  BaseLevelJunctions_Initial,
LSDFlowInfo FlowInfo 
)

This function takes a list of junctions and then prunes junctions based whether they drain from the edge. This attempts to remove junctions that are through-flowing and thus do not have the correct drainage area.

Parameters
BaseLevelJunctions_Initiala vector of integers containg an inital list of base level nodes
FlowInfoThe LSDFlowInfo object
Returns
a pruned list of base level nodes
Author
SMM
Date
16/05/16
vector< int > LSDJunctionNetwork::Prune_Junctions_Edge_Ignore_Outlet_Reach ( vector< int > &  BaseLevelJunctions_Initial,
LSDFlowInfo FlowInfo,
LSDRaster TestRaster 
)

This function takes a list of junctions and then prunes junctions based whether they drain from the edge. This attempts to remove junctions that are through-flowing and thus do not have the correct drainage area Only gets the donor of the baselelve donor to ignore the nodes near the outlet, which often intersect nodata in cut DEMs.

Parameters
BaseLevelJunctions_Initiala vector of integers containg an inital list of base level nodes
FlowInfoThe LSDFlowInfo object
TestRasterA raster that is just used to look for nodata
Returns
a pruned list of base level nodes
Author
SMM
Date
29/05/17
vector< int > LSDJunctionNetwork::Prune_Junctions_Elevation_Window ( vector< int > &  BaseLevelJunctions_Initial,
LSDFlowInfo FlowInfo,
LSDRaster Elev,
float  lower_threshold,
float  upper_threshold 
)

This function takes a list of junctions retains ONLY the junctions that have an outlet elevation with an elevation window.

Parameters
BaseLevelJunctions_Initiala vector of integers containg an inital list of base level nodes
FlowInfoThe LSDFlowInfo object
Elevan LSDRaster of elevation
lower_thresholdthe lower threshold elevation
upper_thresholdthe lower threshold elevation
Returns
a pruned list of base level nodes
Author
SMM
Date
19/01/18
vector< int > LSDJunctionNetwork::Prune_Junctions_If_Nested ( vector< int > &  Junctions_Initial,
LSDFlowInfo FlowInfo,
LSDIndexRaster FlowAcc 
)

This function removes basins that are nested within any other basin in the list.

Parameters
Junctions_Initiala vector of integers containg an inital list of junctions
FlowInfoThe LSDFlowInfo object
TestRasterA raster that is just used to look for nodata
FlowAccan LSDIndexRaster with the number of pixels for flow accumulation
Returns
a pruned list of base level nodes
Author
SMM
Date
26/06/17
vector< int > LSDJunctionNetwork::Prune_Junctions_Largest ( vector< int > &  BaseLevelJunctions_Initial,
LSDFlowInfo FlowInfo,
LSDIndexRaster FlowAcc 
)

This function takes a list of junctions retains ONLY the larges bains The junction is returned as an int vector so that it can be passed to other functions requiring junction lists.

Parameters
BaseLevelJunctions_Initiala vector of integers containg an inital list of base level nodes
FlowInfoThe LSDFlowInfo object
FlowAccan LSDIndexRaster with the number of pixels for flow accumulation
Returns
a pruned list of base level nodes
Author
SMM
Date
03/06/16
vector< int > LSDJunctionNetwork::Prune_Junctions_Threshold_Elevation ( vector< int > &  BaseLevelJunctions_Initial,
LSDFlowInfo FlowInfo,
LSDRaster Elev,
float  threshold_elevation,
bool  keep_junctions_below_threshold 
)

This function takes a list of junctions retains ONLY the junctions that have an outlet elevation greater or less than the threshold elevation Selection of greater or lower is determined by bool keep_junctions_below_threshold.

Parameters
BaseLevelJunctions_Initiala vector of integers containg an inital list of base level nodes
FlowInfoThe LSDFlowInfo object
Elevan LSDRaster of elevation
threshold_elevationthe threshold elevation to kepp
keep_junctions_below_thresholdif true keep junctions below threshold
Returns
a pruned list of base level nodes
Author
SMM
Date
18/01/18
vector< int > LSDJunctionNetwork::Prune_To_Largest_Complete_Basins ( vector< int > &  BaseLevelJunctions_Initial,
LSDFlowInfo FlowInfo,
LSDRaster TestRaster,
LSDIndexRaster FlowAcc 
)

This function looks through all baselevel nodes and then looks for the largest basin that is not influenced by the edge. It returns a vector of these junctions. Note that it only returns one basin per baselevel node at most so might not do a great job of space filling.

Parameters
BaseLevelJunctions_Initiala vector of integers containg an inital list of base level nodes
FlowInfoThe LSDFlowInfo object
TestRasterA raster that is just used to look for nodata
FlowAccan LSDIndexRaster with the number of pixels for flow accumulation
Returns
a pruned list of base level nodes
Author
SMM
Date
21/06/17
void LSDJunctionNetwork::remove_tributary_segments ( LSDFlowInfo FlowInfo,
vector< int >  Sources,
vector< vector< int > > &  SegmentInfoInts,
vector< vector< float > > &  SegmentInfoFloats 
)

This function removes channel segments from the typology model which are not downstream of a given list of source nodes.

Parameters
FlowInfoLSDFlowInfo object
Sourcesvector of source nodes
SegmentInfoIntsvec<vec> of segment info (integer)
SegmentInfoFloatsvec<vec> of segment info (floating point)
int LSDJunctionNetwork::retrieve_junction_number_at_row_and_column ( int  row,
int  col 
)
inline

Get Junction number at a location.

Parameters
rowInteger row index.
colInteger column index.
Returns
Junction number at location row,col.
Author
SMM
Date
01/09/12
void LSDJunctionNetwork::snap_point_locations_to_channels ( vector< float >  x_locs,
vector< float >  y_locs,
int  search_radius_nodes,
int  threshold_stream_order,
LSDFlowInfo FlowInfo,
vector< int > &  valid_cosmo_points,
vector< int > &  snapped_node_indices,
vector< int > &  snapped_junction_indices 
)

this function is a wrapper that takes a list of x and y locations, filters them to make sure they are in the data bounds, and then calculates the nearest channel and junction. It is primarily used to snap cosmo data to the channel network

Parameters
x_locsthe x locations of the points
y_locsthe y locations of the points
search_radius_nodesthe number of nodes around the point to search for a channel
threshold_stream_orderthe minimum stream order to which the point will snap
FlowInfothe LSDFlowInfo object
valid_cosmo_pointsa vector<int> of indices into the x and y vectors. for example if the only valid points were at x_loc[12] and x_loc[34] this would return a vector with two elements, 12 and 34. This vector is overwritten by this function
snapped_node_indicesa vector containing the node indices of the points snapped to the nearest channel (within search radius and over the drainage order threshold). This is overwritten by this method.
snapped_junction_indicesa vector<int> continaing the junction numbers downstream of the nearest channel node. This is overwritten by this method.
Author
SMM
Date
14/11/2014
LSDIndexRaster LSDJunctionNetwork::SplitChannel ( LSDFlowInfo FlowInfo,
vector< int >  Sources,
int  TargetSegmentLength 
)

This function splits the channel into a series of segments, providing a convenient unit with which to analyse landscapes. The user provides the TargetSegmentLength, which specifies how many nodes should be in each segment, and a MinimumSegmentLength, which specifies the fewest permissable number of nodes. Segments smaller than this are amalgamated into the upstream segment. The algorithm loops through the sources and traces downstream, stopping a segment after the target segment length, when the stream order increases (to preserve structure of drainage network), or when a channel pixel has already been visited.

SplitChannel

Parameters
FlowInfoLSDFlowInfo object
Sourcesa vector of sources
TargetSegmentLength(suggest 200 for 1m DEM)
Returns
LSDIndexRaster with channel segments labelled by unique ID
Author
DTM
Date
23/10/2013
LSDIndexRaster LSDJunctionNetwork::SplitHillslopes ( LSDFlowInfo FlowInfo,
LSDIndexRaster ChannelSegmentsRaster 
)

This function is intended to follow the SplitChannel function. It traces through the receiver nodes from every hillslope pixel and then assigns them an integer value that matches the index of the section of channel that is setting the base level of that hillslope.

SplitHillslopes

Parameters
FlowInfoLSDFlowInfo object
ChannelSegmentsRastera raster of channel segments, produced by the SplitChannel function
Returns
LSDIndexRaster hillslope segments labelled by ID of channel segments
Author
DTM
Date
29/10/2013
LSDIndexRaster LSDJunctionNetwork::SplitHillslopes ( LSDFlowInfo FlowInfo,
LSDIndexRaster ChannelSegmentsRaster,
LSDIndexRaster MultiThreadChannelRaster 
)

This is an overloaded function doing the same as the previous version to segment hillslopes according to the channel index of the channel setting its base level. However, this has been adapted to include an additional input raster - MultiThreadChannelRaster - which recognises that real channels may be multithreaded and/or have widths greater than or equal to one pixel. To be rigourous, these should be removed from analyses of hillslope properties.

SplitHillslopes

Parameters
FlowInfoLSDFlowInfo object
ChannelSegmentsRastera raster of channel segments, produced by the SplitChannel function
MultiThreadChannelRastera binary raster with the full channel extent
Returns
LSDIndexRaster hillslope segments labelled by ID of channel segments
Author
DTM
Date
29/10/2013
LSDIndexRaster LSDJunctionNetwork::StreamOrderArray_to_BinaryNetwork_LSDIndexRaster ( )

Turns the StreamOrderArray into a binary rastser where 1 is channel and 0 is hillslope.

Returns
Binary LSDIndexRaster of the channel network.
Author
SMM
Date
01/09/12
LSDIndexRaster LSDJunctionNetwork::StreamOrderArray_to_LSDIndexRaster ( )

This sends the StreamOrderArray to a LSDIndexRaster.

Returns
LSDIndexRaster of StreamOrderArray.
Author
SMM
Date
01/09/12
void LSDJunctionNetwork::StreamOrderArray_to_WGS84CSV ( string  FileName)

Method to flatten an te stream order array and place the non NDV values in a csv file. Each value is placed on its own line, so that it can be read more quickly in python etc. It includes the lat long coordinates in CSV, in WGS84 coordinate system EPSG:4326.

Parameters
FileName_prefixThe prefix of the file to write, if no path is included it will write to the current directory. The csv extension is added automatically.
Author
SMM
Date
12/11/16
void LSDJunctionNetwork::TypologyModel ( LSDFlowInfo FlowInfo,
vector< int >  Sources,
vector< int >  BaselineSources,
vector< int >  CatchIDs,
vector< int >  HydroCodes,
int  MinReachLength,
int  search_radius,
LSDRaster ElevationRaster,
LSDRaster DischargeRaster,
LSDIndexRaster ChannelSegments,
vector< vector< int > > &  SegmentInfoInts,
vector< vector< float > > &  SegmentInfoFloats 
)

TypologyModel

This function splits the channel into a series of segments, providing a convenient unit with which to analyse landscapes. Function modified from original SplitChannel function so that the segment length varies with the drainage area of the cahtchment. Length (m) is calculated based on: L = Min_reach_length * sqrt(Drainage Area (km)) User must pass in the minimum reach length in metres The algorithm starts a new segment either after the target length, when the stream order increases, or when a channel pixel has already been visited. User must pass in an empty IndexRaster which will be populated with the channel segments data, and two vector of vectors which will be populated: vector< vector<int> > SegmentInfoInts has the following layout: 0 - segment IDS 1 - start node of each segment (upstream) 2 - end nodes (downstream) vector< vector<float> > SegmentInfoFloats has the following layout: 0 - segment lengths 1 - elevation of the start nodes 2 - slope of the segment

Parameters
FlowInfoLSDFlowInfo object
Sourcesa vector of sources
BaselineSourcesvector of baseline DRN sources
CatchIDsvector of catchment IDs from DRN
HydroCodesvector of hydrocodes from DRN
MinReachLengthin metres
search_radiussearch radius for snapping rasters to the channel segments (pixels)
ElevationRasterraster with elevation values
DischargeRasterraster with discharge values (CEH one is in l/second, weirdly)
ChannelSegmentsempty LSDIndexRaster, returned with channel segments labelled by unique ID
SegmentInfoIntvec<vec> with integer segment info
SegmentInfoFloatvec<vec> with floating segment info
Author
FJC
Date
06/02/17
void LSDJunctionNetwork::write_river_profiles_to_csv ( vector< int > &  BasinJunctions,
LSDFlowInfo FlowInfo,
LSDRaster DistanceFromOutlet,
LSDRaster Elevation,
string  csv_filename 
)

function to take a vector of basin outlet junctions and write data about the longest channel in each to csv.

Parameters
BasinJunctionsvector of basin junctions
FlowInfo
DistanceFromOutlet
Elevationelev raster
csv_filenamethe output csv file name
Author
FJC
Date
06/04/18
void LSDJunctionNetwork::write_river_profiles_to_csv_all_sources ( float  channel_length,
int  slope_window_size,
LSDFlowInfo FlowInfo,
LSDRaster Elevation,
string  csv_filename 
)

function to write data about channels downstream of all channel heads for a specified length

Parameters
channel_lengthlength downstream to stop writing info
FlowInfo
Elevationelev raster
csv_filenamethe output csv file name
Author
FJC
Date
02/05/18
void LSDJunctionNetwork::write_river_profiles_to_csv_all_tributaries ( vector< int > &  BasinJunctions,
LSDFlowInfo FlowInfo,
LSDRaster DistanceFromOutlet,
LSDRaster Elevation,
string  csv_filename 
)

function to take a vector of basin outlet junctions and write data about all tribs to csv

Parameters
BasinJunctionsvector of basin junctions
FlowInfo
DistanceFromOutlet
Elevationelev raster
csv_filenamethe output csv file name
Author
FJC
Date
02/05/18
void LSDJunctionNetwork::write_valley_hilltop_chi_profiles_to_csv ( vector< int >  sources,
float  A_0,
float  m_over_n,
LSDFlowInfo FlowInfo,
LSDRaster FlowDistance,
LSDRaster ElevationRaster,
int  NJunctions,
string  output_path,
string  DEM_ID 
)

This function generates LSDChannels that run from the hilltops above all the sources from the valley network down to a specified number of downstream junctions below the sources and writes the profile to csv.

Author
FJC
Date
23/12/16

Member Data Documentation

vector<int> LSDJunctionNetwork::DeltaVector
protected

Stores the delta vector which is used to index into the donor stack and order contributing junction see Braun and Willett [2012].

Array2D<int> LSDJunctionNetwork::JunctionArray
protected

This array stores a junction counter.

If zero there is no junction
if 1 it is a junction unvisted by the junction gathering algorithm
if 2 or more it is a previously visited junction

Array2D<int> LSDJunctionNetwork::JunctionIndexArray
protected

This is an array where the elements are nodata if there is no junction and an integer indicating the junction number.

vector<int> LSDJunctionNetwork::NContributingJunctions
protected

The number of contributing junctions !!INCULDING SELF!! to a current pixel.

It is used in conjunction with the SVectorIndex to build basins upslope of any and all nodes in the junction list.

vector<int> LSDJunctionNetwork::SourcesVector
protected

A list of the node indices that are sources.

Note: are not the node indices not junctions. To find the junctions you need to use the get_Junction_of_Node member function

vector<int> LSDJunctionNetwork::StreamOrderVector
protected

The stream order of the junction node/link.

Note that each junction has one and only one receiver junction so the stream order of a junction node will apply to all nodes along the path to the next junction.

vector<int> LSDJunctionNetwork::SVector
protected

This vector is used to calculate flow accumulation.

For each base level junction it progresses from a hilltop to a confluence and then jumps to the next hilltop so that by cascading down through the node indices in this list one can quickly calculate drainage area, discharge, sediment flux, etc.


The documentation for this class was generated from the following files: