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

This object packages a number of tools for chi analysis. More...

#include <LSDChiTools.hpp>

Public Member Functions

 LSDChiTools (LSDRaster &ThisRaster)
 Create an LSDChiTools from a raster. More...
 
 LSDChiTools (LSDIndexRaster &ThisRaster)
 Create an LSDChiTools from a raster. More...
 
 LSDChiTools (LSDFlowInfo &ThisFI)
 Create an LSDChiTools from a LSDFlowInfo object. More...
 
 LSDChiTools (LSDJunctionNetwork &ThisJN)
 Create an LSDChiTools from a LSDJunctionNetwork. More...
 
void reset_data_maps ()
 This resets all the data maps. 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 print_mchisegmented_knickpoint_version (LSDFlowInfo &FlowInfo, string filename)
 
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_lat_and_long_locations_from_coordinate (float X, float Y, double &lat, double &longitude, LSDCoordinateConverterLLandUTM Converter)
 a function to get the lat and long of a coordinate point in the raster Assumes WGS84 ellipsiod - does not correspond necessarly to a node 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 update_chi_data_map (LSDFlowInfo &FlowInfo, LSDRaster &Chi_coord)
 This takes a chi raster and updates the chi data map. WARNING you must use a raster derived from the topography raster that was used to make the FlowInfo object. This function does not check the dimensions of the raster. More...
 
void update_chi_data_map (LSDFlowInfo &FlowInfo, float A_0, float movern)
 This takes a chi raster and updates the chi data map. Overloaded from the previous function: this one calculates chi directly from the FlowInfo so you have no problems with raster size WARNING you must use a raster derived from the topography raster that was used to make the FlowInfo object. This function does not check the dimensions of the raster. More...
 
void update_chi_data_map_for_single_basin (LSDFlowInfo &FlowInfo, float A_0, float movern, int minimum_contributing_pixels, int basin_key, map< int, int > outlet_node_from_basin_key_map)
 This recalcualtes chi for a single basin. Built for speed and is used by the MCMC routines. More...
 
void update_chi_data_map_for_single_basin (LSDFlowInfo &FlowInfo, float A_0, float movern, int minimum_contributing_pixels, int basin_key, map< int, int > outlet_node_from_basin_key_map, LSDRaster &Discharge)
 This recalcualtes chi for a single basin. Built for speed and is used by the MCMC routines. This version uses a discharge raster. More...
 
void chi_map_to_csv (LSDFlowInfo &FlowInfo, string filename, float A_0, float m_over_n, float area_threshold)
 This function makes a chi map and prints to a csv file the lat and long coordinates in the csv are in WGS84. More...
 
void chi_map_to_csv (LSDFlowInfo &FlowInfo, string chi_map_fname, LSDRaster &chi_coord)
 This function takes a raster prints to a csv file the lat and long coordinates in the csv are in WGS84. More...
 
void chi_map_to_csv (LSDFlowInfo &FlowInfo, string chi_map_fname, LSDRaster &chi_coord, LSDIndexRaster &basin_raster)
 This function takes a raster prints to a csv file. Includes the junction number in the file the lat and long coordinates in the csv are in WGS84. More...
 
void segment_counter (LSDFlowInfo &FlowInfo, float maximum_segment_length)
 This function is used to tag channels with a segment number It decides on segments if the M_Chi value has changed so should only be used with chi networks that have used a skip of 0 and a monte carlo itertions of 1 This data is used by other routines to look at the spatial distribution of hillslope-channel coupling. WARNING: ONLY use if you have segmented with skip 0 and iterations 1. Otherwise you will get a new segment for every channel pixel. More...
 
LSDIndexRaster segment_mapping (LSDFlowInfo &FlowInfo, float maximum_segment_length)
 This function is used to tag channels with a segment number It decides on segments if the M_Chi value has changed so should only be used with chi networks that have used a skip of 0 and a monte carlo itertions of 1 This data is used by other routines to look at the spatial distribution of hillslope-channel coupling. WARNING: ONLY use if you have segmented with skip 0 and iterations 1. Otherwise you will get a new segment for every channel pixel. More...
 
void segment_counter_knickpoint (LSDFlowInfo &FlowInfo, float threshold_knickpoint, float threshold_knickpoint_length)
 This function calculates the fitted elevations: It uses m_chi and b_chi data to get the fitted elevation of the channel points. More...
 
void ksn_knickpoint_detection (LSDFlowInfo &FlowInfo)
 This function extract the difference,ratio,sign between each segments of the M_segmented_chi analysis. More...
 
void knickzone_weighting_completion (map< pair< int, int >, vector< int > > mapofnode)
 This function extract the difference,ratio,sign between each segments of the M_segmented_chi analysis. More...
 
void calculate_segmented_elevation (LSDFlowInfo &FlowInfo)
 Development function based on segment_counter to help knickpoint detection. More description will be added when it will be functional. More...
 
void baselevel_and_source_splitter (vector< int > &n_sources_for_baselevel, vector< int > &index_into_sources_vec)
 This splits all the sources from the baselevels so that individual baselevel catchemnts can be compared in sequence. It produces a map where the sources for each baselelvel are split into incremetally numberered (0,1,2) channels. More...
 
void print_basin_and_source_indexing_to_screen ()
 This prints all the indexing and keys to screen for bug checking. More...
 
float test_segment_collinearity (LSDFlowInfo &FlowInfo, int reference_channel, int test_channel, float sigma)
 This returns an maximum liklihood estiamtor by comparing a channel (with a particular source number) against a reference channel. More...
 
float test_segment_collinearity_using_points (LSDFlowInfo &FlowInfo, int reference_channel, int test_channel, float sigma, vector< float > chi_distances_to_test)
 This returns an maximum liklihood estiamtor by comparing a channel (with a particular source number) against a reference channel, using specific points on the test channel. More...
 
vector< float > retrieve_all_residuals_by_basin (LSDFlowInfo &FlowInfo, bool only_use_mainstem_as_reference, int baselevel_key)
 This takes a basin key and returns all the residuals of the channels. More...
 
float test_all_segment_collinearity_by_basin (LSDFlowInfo &FlowInfo, bool only_use_mainstem_as_reference, int basin_key, vector< int > &reference_source, vector< int > &test_source, vector< float > &MLE_values, vector< float > &RMSE_values, float sigma)
 This computes a collinearity metric for all combinations of channels for a given basin It takes all the combinations of sources and gets the goodness of fit between each pair of sources. More...
 
float test_all_segment_collinearity_by_basin_using_points (LSDFlowInfo &FlowInfo, bool only_use_mainstem_as_reference, int basin_key, vector< int > &reference_source, vector< int > &test_source, vector< float > &MLE_values, vector< float > &RMSE_values, float sigma, vector< float > chi_distances_to_test)
 This computes a collinearity metric for all combinations of channels for a given basin. This version uses specified points in chi space to compare against other channels rather than the entire channel It takes all the combinations of sources and gets the goodness of fit between each pair of sources. More...
 
float test_collinearity_by_basin_disorder (LSDFlowInfo &FlowInfo, int basin_key)
 This computes a the disorder metric of Hergarten et al 2016 by basin. More...
 
vector< float > test_collinearity_by_basin_disorder_with_uncert (LSDFlowInfo &FlowInfo, int basin_key)
 This computes a the disorder metric of Hergarten et al 2016 by basin. It uses a permutation algorithm to find all combinations of tributary channels and computes the disorder statistic of each of these. More...
 
void calculate_goodness_of_fit_collinearity_fxn_movern_using_median_residuals (LSDFlowInfo &FlowInfo, LSDJunctionNetwork &JN, float start_movern, float delta_movern, int n_movern, bool only_use_mainstem_as_reference, string file_prefix)
 This wraps the collinearity tester, looping through different m over n values and calculating goodness of fit statistics. This gets the median residual. The best fit will have a median residual closest to zero. More...
 
void calculate_goodness_of_fit_collinearity_fxn_movern (LSDFlowInfo &FlowInfo, LSDJunctionNetwork &JN, float start_movern, float delta_movern, int n_movern, bool only_use_mainstem_as_reference, string file_prefix, float sigma)
 This wraps the collinearity tester, looping through different m over n values and calculating goodness of fit statistics. More...
 
void calculate_goodness_of_fit_collinearity_fxn_movern_with_discharge (LSDFlowInfo &FlowInfo, LSDJunctionNetwork &JN, float start_movern, float delta_movern, int n_movern, bool only_use_mainstem_as_reference, string file_prefix, LSDRaster &Discharge, float sigma)
 This wraps the collinearity tester, looping through different m over n values and calculating goodness of fit statistics. Same as above but can use a discharge raster to calculate chi. More...
 
void calculate_goodness_of_fit_collinearity_fxn_movern_using_points (LSDFlowInfo &FlowInfo, LSDJunctionNetwork &JN, float start_movern, float delta_movern, int n_movern, bool only_use_mainstem_as_reference, string file_prefix, float sigma, vector< float > chi_distance_fractions)
 This wraps the collinearity tester, looping through different m over n values and calculating goodness of fit statistics. Uses discrete points rather than all the tributary data. More...
 
void calculate_goodness_of_fit_collinearity_fxn_movern_with_discharge_using_points (LSDFlowInfo &FlowInfo, LSDJunctionNetwork &JN, float start_movern, float delta_movern, int n_movern, bool only_use_mainstem_as_reference, string file_prefix, LSDRaster &Discharge, float sigma, vector< float > chi_distance_fractions)
 This wraps the collinearity tester, looping through different m over n values and calculating goodness of fit statistics. Same as above but can use a discharge raster to calculate chi Uses discrete points rather than all the tributary data. More...
 
void calculate_goodness_of_fit_collinearity_fxn_movern_using_points_MC (LSDFlowInfo &FlowInfo, LSDJunctionNetwork &JN, float start_movern, float delta_movern, int n_movern, bool only_use_mainstem_as_reference, string file_prefix, float sigma, int n_fracs, int MC_iterations, float max_frac)
 This wraps the collinearity tester, looping through different m over n values and calculating goodness of fit statistics. Uses discrete points rather than all the tributary data. It uses monte carlo sampling to get the points, so one can repeatedly sample the MLE values for a fixed number of points. More...
 
void calculate_goodness_of_fit_collinearity_fxn_movern_with_discharge_using_points_MC (LSDFlowInfo &FlowInfo, LSDJunctionNetwork &JN, float start_movern, float delta_movern, int n_movern, bool only_use_mainstem_as_reference, string file_prefix, float sigma, int n_fracs, int MC_iterations, float max_frac, LSDRaster &Discharge)
 This wraps the collinearity tester, looping through different m over n values and calculating goodness of fit statistics. This one uses discharge Uses discrete points rather than all the tributary data. It uses monte carlo sampling to get the points, so one can repeatedly sample the MLE values for a fixed number of points. More...
 
void calculate_goodness_of_fit_collinearity_fxn_movern_using_disorder (LSDFlowInfo &FlowInfo, LSDJunctionNetwork &JN, float start_movern, float delta_movern, int n_movern, string file_prefix, bool use_uncert)
 This wraps the disorder collinearity tester, looping through different concavity values and calculating disorder statistics. Uses the disorder metric of Hergarten et al ESURF 2016. More...
 
void calculate_goodness_of_fit_collinearity_fxn_movern_with_discharge_using_disorder (LSDFlowInfo &FlowInfo, LSDJunctionNetwork &JN, float start_movern, float delta_movern, int n_movern, string file_prefix, bool use_uncert, LSDRaster &Discharge)
 This wraps the disorder collinearity tester, looping through different concavity values and calculating disorder statistics. Uses the disorder metric of Hergarten et al ESURF 2016. Uses a discharge raster to calculate chi. More...
 
void MCMC_driver (LSDFlowInfo &FlowInfo, int minimum_contributing_pixels, float sigma, float movern_minimum, float movern_maximum, int N_chain_links, string OUT_DIR, string OUT_ID, bool use_points)
 This function drives a Monte Carlo-Markov chain model It wraps the dmovern tuning and the main chain. More...
 
float MCMC_for_movern_tune_dmovern (LSDFlowInfo &FlowInfo, int minimum_contributing_pixels, float sigma, float movern_minimum, float movern_maximum, int basin_key, bool use_points)
 This function drives a Monte Carlo-Markov chain model and tries to tune the dmovern_stddev value to get between 20-30% acceptance rate. More...
 
float MCMC_for_movern_tune_sigma (LSDFlowInfo &FlowInfo, int minimum_contributing_pixels, float dmovernstddev, float movern_minimum, float movern_maximum, int basin_key, bool use_points)
 This function drives a Monte Carlo-Markov chain model and tries to tune the sigma value to get between 20-30% acceptance rate. More...
 
float MCMC_for_movern (string ChainFname, bool printChain, LSDFlowInfo &FlowInfo, int minimum_contributing_pixels, int NIterations, float sigma, float dmovern_stddev, float movern_minimum, float movern_maximum, int basin_key, bool use_points)
 This function drives a Monte Carlo-Markov chain model for getting the confidence intervals on the m/n value. You can turn the chain file printing off at first to tune the dmovern_sigma so that it arrices at a 25% acceptance rate. More...
 
void print_profiles_as_fxn_movern (LSDFlowInfo &FlowInfo, string file_prefix, float start_movern, float delta_movern, int n_movern)
 This prints a series of chi profiles as a function of m over n for visualisation. More...
 
void print_profiles_as_fxn_movern_with_burned_raster (LSDFlowInfo &FlowInfo, string filename, float start_movern, float delta_movern, int n_movern, LSDRaster &BurnRaster, string column_name)
 This prints a series of chi profiles as a function of m over n for visualisation. It also burns a raster value to each of the nodes The raster burning is useful for adding information like geology or K values. More...
 
void print_profiles_as_fxn_movern_with_discharge (LSDFlowInfo &FlowInfo, string file_prefix, float start_movern, float delta_movern, int n_movern, LSDRaster &Discharge)
 This prints a series of chi profiles as a function of mover for visualisation. More...
 
void print_profiles_as_fxn_movern_with_discharge_and_burned_raster (LSDFlowInfo &FlowInfo, string filename, float start_movern, float delta_movern, int n_movern, LSDRaster &Discharge, LSDRaster &BurnRaster, string burned_column_name)
 This prints a series of chi profiles as a function of mover for visualisation. It also burns a raster value to each of the nodes The raster burning is useful for adding information like geology or K values. More...
 
map< int, int > get_outlet_node_from_basin_key_map ()
 This inverst the key_to_baselevel map so that the key is the baselevel key and the value is the node index of the outlet node. More...
 
int get_source_from_source_key (int source_key)
 This gets the node index (the reference into LSDFlowInfo) of a source based on a source key. More...
 
int get_starting_node_of_source (int source_key)
 This gets the index into the node_sequence vector of the first node in a channel identified by its source key. More...
 
int get_number_of_channels ()
 Gets the number of channels in the DEM. More...
 
void get_chi_elevation_data_of_channel (LSDFlowInfo &FlowInfo, int source_key, vector< float > &chi_data, vector< float > &elevation_data)
 This takes a source key and a flow info object and overwrites vectors containing chi and elevation data from a channel tagged by a source key. The idea is to use this in the MLE comparison between two channels to check for collinearity. More...
 
vector< float > project_data_onto_reference_channel (vector< float > &reference_chi, vector< float > &reference_elevation, vector< float > &trib_chi, vector< float > &trib_elevation)
 This takes the chi locations of a tributarry vector and then uses linear interpolation to determine the elevation on a reference channel at those chi values. More...
 
vector< float > project_points_onto_reference_channel (vector< float > &reference_chi, vector< float > &reference_elevation, vector< float > &trib_chi, vector< float > &trib_elevation, vector< float > chi_distances_to_test)
 This takes the chi locations of a tributarry vector and then uses linear interpolation to determine the elevation on a reference channel of points at a vector of fixed distances upstream the tributary channel. More...
 
void get_slope_area_data (LSDFlowInfo &FlowInfo, float vertical_interval, vector< int > &midpoint_nodes, vector< float > &slopes)
 This performs slope area analysis. It goes down through each source node and collects S-A data along these channels. It uses the suggested appraoch of Wobus et al. 2006 in that it uses a drop interval to measure slope. More...
 
void bootstrap_slope_area_data (LSDFlowInfo &FlowInfo, vector< int > &SA_midpoint_node, vector< float > &SA_slope, int N_iterations, float bootstrap_keep_data_prob, string filename)
 This function takes raw S-A data (generated by get_slope_area_data) and runs a bootstrapping procedure to find the confidence intervals of the regression coeffcients and the intercepts. More...
 
void bin_slope_area_data (LSDFlowInfo &FlowInfo, vector< int > &SA_midpoint_node, vector< float > &SA_slope, float log_bin_width, string filename)
 
void segment_binned_slope_area_data (LSDFlowInfo &FlowInfo, vector< int > &SA_midpoint_node, vector< float > &SA_slope, float log_bin_width, int minimum_segment_length, string filename)
 
void print_slope_area_data_to_csv (LSDFlowInfo &FlowInfo, vector< int > &SA_midpoint_node, vector< float > &SA_slope, string filename)
 This takes the midpoint node and slope vectors produced by the slope_area_analysis and prints them to a csv. More...
 
void chi_map_automator_chi_only (LSDFlowInfo &FlowInfo, vector< int > source_nodes, vector< int > outlet_nodes, vector< int > baselevel_node_of_each_basin, LSDRaster &Elevation, LSDRaster &FlowDistance, LSDRaster &DrainageArea, LSDRaster &chi_coordinate)
 This function burns the chi coordinate (and area, flow distance and elevation) onto the data maps in the chitools object. It does not do any segmentation. The purpose of this function is to get the chi coordinate without calculating m_chi or segmenting, and is used for m/n calculations. Can also be used for maps of chi coordinate. More...
 
void chi_map_automator (LSDFlowInfo &FlowInfo, vector< int > source_nodes, vector< int > outlet_nodes, vector< int > baselevel_node_of_each_basin, LSDRaster &Elevation, LSDRaster &FlowDistance, LSDRaster &DrainageArea, LSDRaster &chi_coordinate, int target_nodes, int n_iterations, int skip, int minimum_segment_length, float sigma)
 This function maps out the chi steepness and other channel metrics in chi space from all the sources supplied in the source_nodes vector. The source and outlet nodes vector is generated by LSDJunctionNetwork.get_overlapping_channels Takes vector so source and outlet nodes and performs the segment fitting routine on them. More...
 
void chi_map_automator_rudimentary (LSDFlowInfo &FlowInfo, vector< int > source_nodes, vector< int > outlet_nodes, vector< int > baselevel_node_of_each_basin, LSDRaster &Elevation, LSDRaster &FlowDistance, LSDRaster &DrainageArea, LSDRaster &chi_coordinate, int regression_nodes)
 This function maps out the chi steepness and other channel metrics in chi space from all the sources supplied in the source_nodes vector. The source and outlet nodes vector is generated by LSDJunctionNetwork.get_overlapping_channels This is simpler than the above function: it simply performs a linear regression ofve a fixed number of data points: no effort is made to segment the data. It is thus much closer to a k_sn plot. More...
 
LSDIndexRaster get_basin_raster (LSDFlowInfo &FlowInfo, LSDJunctionNetwork &JunctionNetwork, vector< int > Juntions)
 This returns an LSDIndexRaster with basins numbered by outlet junction. More...
 
map< int, map< int, int > > get_basin_lithocount (LSDFlowInfo &FlowInfo, LSDJunctionNetwork &JunctionNetwork, LSDIndexRaster &litho, vector< int > Junctions)
 This return a map with the basin ID as key, and map of the count of the different lithology as key/value. More...
 
void print_source_keys (LSDFlowInfo &FlowInfo, string filename)
 This prints a csv file that has the locations of the sources and their keys latitude,longitude,source_node, source_key. More...
 
void print_baselevel_keys (LSDFlowInfo &FlowInfo, LSDJunctionNetwork &JN, string filename)
 This prints a csv file that has the locations of the baselevels and their keys latitude,longitude,baselevel_junctione, baselevel_key. More...
 
void print_basins (LSDFlowInfo &FlowInfo, LSDJunctionNetwork &JunctionNetwork, vector< int > Juntions, string base_filename)
 This prints a basin LSDIndexRaster with basins numbered by outlet junction and a csv file that has the latitude and longitude of both the outlet and the centroid. More...
 
void print_chi_data_map_to_csv (LSDFlowInfo &FlowInfo, string filename)
 This prints a csv file with chi data from the data maps the columns are: latitude,longitude,chi,elevation,flow distance,drainage area,. More...
 
void print_chi_data_map_to_csv_for_single_basin (LSDFlowInfo &FlowInfo, string filename, int basin_key)
 This prints a csv file with chi data from the data maps for a specific basin the columns are: latitude,longitude,chi,elevation,flow distance,drainage area,. More...
 
void simple_litho_basin_to_csv (LSDFlowInfo &FlowInfo, string csv_slbc_fname, map< int, map< int, int > > map_slbc)
 Print a csv file with basin_key and the number of lithology pixels per lithology ID. You need the files from the rasterisation to decrypt it. More...
 
void extended_litho_basin_to_csv (LSDFlowInfo &FlowInfo, string csv_slbc_fname, map< int, map< int, int > > map_slbc)
 Print a csv file with basin_key and the number/percentages of lithology pixels per lithology ID. You need the files from the rasterisation to decrypt it. More...
 
void print_data_maps_to_file_full (LSDFlowInfo &FlowInfo, string filename)
 This prints a csv file with all the data from the data maps the columns are: latitude,longitude,chi,elevation,flow distance,drainage area,m_chi,b_chi. More...
 
void print_knickpoint_to_csv (LSDFlowInfo &FlowInfo, string filename)
 This prints a csv file with all the knickpoint data the columns are: latitude,longitude,elevation,flow distance,drainage area,ratio,diff,sign. More...
 
void print_knickzone_to_csv (LSDFlowInfo &FlowInfo, string filename)
 This prints a csv file with all the knickzones raw data the columns are: latitude,longitude,elevation,flow distance,drainage area,ratio,diff,sign. More...
 
void print_data_maps_to_file_full_knickpoints (LSDFlowInfo &FlowInfo, string filename)
 This prints a csv file with a subset of the data from the data maps the columns are: latitude,longitude,m_chi,b_chi. More...
 
void print_data_maps_to_file_basic (LSDFlowInfo &FlowInfo, string filename)
 This prints a csv file with a subset of the data from the data maps the columns are: latitude,longitude,m_chi,b_chi,knickpoint Development function. More...
 
void get_previous_mchi_for_all_sources (LSDFlowInfo &Flowinfo)
 fill maps containing information of receiving rivers More...
 
int get_ending_node_of_source (LSDFlowInfo &FlowInfo, int source_key)
 It should find the ending (aka downstair) node. More...
 
void print_intersources_mchi_map (string filename)
 print a csv file with the receiver of each source and the corresponding source with the m_chi That is barely understable, however I have a cold so I am tired as F. Just ask me if you need more info about that More...
 
void set_map_of_source_and_node (LSDFlowInfo &FlowInfo, int n_nodlump)
 set a map of each source_key with the corresponding vector fo node INCLUDING the first node of the receaving river if this abovementioned one does exist. More...
 
void ksn_knickpoint_automator (LSDFlowInfo &FlowInfo, string OUT_DIR, string OUT_ID, float MZS_th, float lambda_TVD, float lambda_TVD_b_chi, int stepped_combining_window, int window_stepped, float n_std_dev, int kp_node_search)
 Main function for the knickpoint analysis that control the call of other function to keep it clear and up to date. More...
 
void ksn_knickpoint_outlier_automator (LSDFlowInfo &FlowInfo, float MZS_th)
 
void ksn_knickpoints_combining (LSDFlowInfo &Flowinfo, int kp_node_search)
 Dealing with composite knickpoints. More...
 
void ksn_knickpoint_detection_new (LSDFlowInfo &FlowInfo)
 Detection of the knickpoints by looping through the source keys. More...
 
void ksn_knickpoint_raw_river (int SK, vector< int > vecnode)
 increment the knickpoints for one river More...
 
void print_raw_ksn_knickpoint (LSDFlowInfo &FlowInfo, string filename)
 write a file with the raw knickpoint informations More...
 
void ksn_kp_KDE ()
 Calculate KDE over the river system using the dksn/dchi map previously calculated through ksn_knickpoint_automator. More...
 
void KDE_vec_node_mchi (vector< int > vecnode, int SK)
 communicate with LSDStatTools to get the KDE oer river, also register the bandwidth automatically calculated More...
 
void print_bandwidth_ksn_knickpoint (string filename)
 write a file containing source key and bandwith calculated from the KDE More...
 
void compute_basic_matrics_per_source_keys (LSDFlowInfo &FlowInfo)
 compute basics metrics per source keys: flow length, chi length plus more to come probably More...
 
void lump_my_ksn (int n_nodlump)
 lump the m_chi to average the MC noise More...
 
void lump_this_vec (vector< int > this_vec, int n_nodlump)
 lump m_chi for a specific vector of node index More...
 
void TVD_on_my_ksn (const float lambda, float lambda_TVD_b_chi)
 Apply the TVD filter () L.Condat 2013 on the m_chi and b_chi signals. More...
 
vector< float > TVD_this_vec (vector< int > this_vec, const float lambda, float lambda_TVD_b_chi)
 
vector< double > correct_TVD_vec (vector< double > this_val)
 
float get_dksn_from_composite_kp (vector< int > vecnode)
 
float get_dseg_drop_from_composite_kp (vector< int > vecnode)
 
float get_kp_sharpness_length (vector< int > vecnode, LSDFlowInfo &Flowinfo)
 
int get_ksn_centroid_coordinates (LSDFlowInfo &Flowinfo, vector< int > vecnode, vector< int > vecnode_river, float total_dksn)
 
vector< vector< int > > group_local_kp (vector< int > vecnode_kp, vector< int > vecnode_river, LSDFlowInfo &Flowinfo, int kp_node_search)
 
vector< vector< int > > old_group_local_kp (vector< int > vecnode_kp, vector< int > vecnode_river, LSDFlowInfo &Flowinfo)
 
void derive_the_segmented_elevation ()
 
vector< int > get_vecnode_river_from_extent (int first_node, int last_node, vector< int > vecnode_river)
 
void print_final_ksn_knickpoint (LSDFlowInfo &FlowInfo, string filename)
 
void raw_stepped_knickpoint_detection (int SK, vector< int > vecnode)
 
void stepped_knickpoints_combining (LSDFlowInfo &Flowinfo, int kp_node_search)
 
void TVD_this_vec_v2 (vector< int > this_vec, float lambda, float lambda_TVD_b_chi, int max_node, string type)
 
void stepped_knickpoints_detection_v2 (LSDFlowInfo &Flowinfo, int window, float n_std_dev)
 
map< string, vector< float > > get_windowed_stats_for_knickpoints (vector< int > vecnode, int HW)
 

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.
 
int id_kp
 A general incrementer for knickpoints. It has to be global for some reason.
 
map< string, string > GeoReferencingStrings
 A map of strings for holding georeferencing information.
 
map< int, float > M_chi_data_map
 A map of the M_chi values. The indices are node numbers from FlowInfo.
 
map< int, float > b_chi_data_map
 A map of the M_chi values. The indices are node numbers from FlowInfo.
 
map< int, float > elev_data_map
 A map of the M_chi values. The indices are node numbers from FlowInfo.
 
map< int, float > chi_data_map
 A map of the M_chi values. The indices are node numbers from FlowInfo.
 
map< int, float > flow_distance_data_map
 A map of the M_chi values. The indices are node numbers from FlowInfo.
 
map< int, float > drainage_area_data_map
 A map of the M_chi values. The indices are node numbers from FlowInfo.
 
map< int, float > segmented_elevation_map
 A map that holds elevations regressed from fitted sections.
 
map< int, int > segment_counter_map
 
map< int, float > segment_counter_knickpoint_map
 A map that holds knickpoints information.
 
map< int, int > segment_knickpoint_sign_map
 A map that holds knickpoints signs.
 
map< int, int > segment_length_map
 A map that holds knickpoints signs.
 
map< int, float > ksn_ratio_knickpoint_map
 A map that holds knickpoints ratio.
 
map< int, float > ksn_diff_knickpoint_map
 A map that holds knickpoints difference_between_segments.
 
map< int, int > ksn_sign_knickpoint_map
 A map that holds knickpoints signs.
 
map< int, float > ksn_rad_knickpoint_map
 Map of the knickpoints value in radian.
 
map< int, float > ksn_cumul_knickpoint_map
 Map of the knickzone by cumulative variations.
 
map< int, float > rksn_cumul_knickpoint_map
 Map of the knickpoint by cumulative variations - ratio.
 
map< int, float > rad_cumul_knickpoint_map
 Map of the knickpoint by cumulative variations.
 
map< pair< int, int >, float > knickzone_raw_cumul_ksn
 map of nickzones for ksn variations
 
map< pair< int, int >, float > knickzone_raw_cumul_rksn
 map of nickzones for rksn variations
 
map< pair< int, int >, float > knickzone_raw_cumul_rad
 map of nickzones for rad variations
 
map< pair< int, int >, float > knickzone_WP_ksn
 map of nickzones for ksn variations WEIGHTED VERSION
 
map< pair< int, int >, float > knickzone_WP_rksn
 map of nickzones for rksn variations WEIGHTED VERSION
 
map< pair< int, int >, float > knickzone_WP_rad
 map of nickzones for rad variations WEIGHTED VERSION
 
map< pair< int, int >, int > knickzone_ID
 map of knickzone ID to identify all the knickzones from a same base one
 
map< int, int > map_source_key_receiver
 map of source_keys of receiving rivers<source_key_of_river,source_key_of_receiving_river>
 
map< int, float > map_source_key_receiver_mchi
 map of m_chi precedant the source_key <source_key_of_river,previous_m_chi>
 
map< int, vector< int > > map_node_source_key
 map of source key and associated vector of nodes
 
map< int, vector< int > > map_source_key_vecnode_of_receiver
 map of source key and associated vector of nodes
 
map< int, vector< int > > map_node_source_key_kp
 map of source key and associated vector of nodes containing knickpoints used for the ksnkp calculation
 
map< int, float > raw_ksn_kp_map
 map of raw changes in ksn, key is node and value is delta ksn from bottom to top
 
map< int, float > raw_dksndchi_kp_map
 map of raw derivative for the ksn value calculated per rivers. map[nodeindex] = dksn/dchi
 
map< int, float > raw_KDE_kp_map
 map of raw KDE, calculated using method/binning depending on the parameter file
 
map< int, float > KDE_bandwidth_per_source_key
 map of the automatically calculated bandwidth per source key
 
map< int, float > map_flow_length_source_key
 Map[source_key] = flow_length_of_river (from source to base junction, not baselevel)
 
map< int, float > map_chi_length_source_key
 Map[source_key] = chi_length_of_river (from source to base junction, not baselevel)
 
map< int, int > map_outlier_MZS_dksndchi
 
map< int, float > lumped_m_chi_map
 Map[node_index] = lumped m_chi.
 
map< int, float > TVD_m_chi_map
 Map[node_index] = TVDed m_chi.
 
map< int, float > TVD_b_chi_map
 Map[node_index] = TVDed m_chi.
 
map< int, float > TVD_m_chi_map_non_corrected
 Debugging map to check the TVD correctin (deprecated - I'll clean my code when I'll be sure I'll need it)
 
map< int, float > ksn_kp_map
 Grouped and processed knickpoints.
 
map< int, float > sharpness_ksn_length
 diffusion of a knickpoint, or sharpness of a knickpoint, I cannot decide which word I prefer
 
map< int, float > sharpness_stepped_length
 diffusion of a knickpoint, or sharpness of a stepped knickpoint, I cannot decide which word I prefer
 
map< int, pair< int, int > > ksn_extent
 cextent of composite knickpoints
 
map< int, pair< int, int > > stepped_extent
 
map< int, pair< float, float > > ksn_centroid
 contains the centroid of each knickpoints
 
map< int, pair< float, float > > stepped_centroid
 contains the centroid of each stepped knickpoints
 
map< int, int > ksn_kp_ID
 Unique ID for each knickpoints.
 
map< int, float > flow_distance_kp_centroid_map
 
map< int, float > flow_distance_stepped_kp_centroid_map
 
map< int, int > nearest_node_centroid_kp
 
map< int, int > nearest_node_centroid_kp_stepped
 
map< int, int > map_outlier_MZS_combined
 
map< int, float > kp_segdrop
 
map< int, float > raw_segchange
 
map< int, float > TVD_segelev_diff
 
map< int, float > segelev_diff
 
map< int, float > segelev_diff_second
 
map< int, float > raw_delta_segelev_from_TVDb_chi
 
map< int, vector< int > > map_node_source_key_kp_stepped
 
map< int, float > intermediate_TVD_m_chi
 Map of intermediate values for each node during TVD segmentation.
 
map< int, float > intermediate_TVD_b_chi
 
map< int, float > mean_for_kp
 
map< int, float > std_for_kp
 
vector< int > node_sequence
 
map< int, int > source_keys_map
 
map< int, int > baselevel_keys_map
 
map< int, int > key_to_source_map
 
map< int, int > key_to_baselevel_map
 
vector< int > ordered_source_nodes
 this is an ordered list of the source nodes (from first source to last)
 
vector< int > ordered_baselevel_nodes
 this is an ordered list of baselelvel nodes (from first source to last)
 
vector< int > source_nodes_ranked_by_basin
 
map< int, int > source_node_of_mainstem_map
 

Detailed Description

This object packages a number of tools for chi analysis.

Constructor & Destructor Documentation

LSDChiTools::LSDChiTools ( LSDRaster ThisRaster)
inline

Create an LSDChiTools from a raster.

Parameters
ThisRasterAn LSDRaster object
Author
SMM
Date
24/05/2016
LSDChiTools::LSDChiTools ( LSDIndexRaster ThisRaster)
inline

Create an LSDChiTools from a raster.

Parameters
ThisRasterAn LSDIndexRaster object
Author
SMM
Date
24/05/2016
LSDChiTools::LSDChiTools ( LSDFlowInfo ThisFI)
inline

Create an LSDChiTools from a LSDFlowInfo object.

Parameters
ThisFIAn LSDFlowInfo object
Author
SMM
Date
24/05/2016
LSDChiTools::LSDChiTools ( LSDJunctionNetwork ThisJN)
inline

Create an LSDChiTools from a LSDJunctionNetwork.

Parameters
ThisJNAn LSDJunctionNetwork object
Author
SMM
Date
24/05/2016

Member Function Documentation

void LSDChiTools::baselevel_and_source_splitter ( vector< int > &  n_sources_for_baselevel,
vector< int > &  index_into_sources_vec 
)

This splits all the sources from the baselevels so that individual baselevel catchemnts can be compared in sequence. It produces a map where the sources for each baselelvel are split into incremetally numberered (0,1,2) channels.

Parameters
n_sources_for_baselevelThe number of sources for each baselelvel node Replaced in function.
index_into_sources_vecThe index into the ordered sources vector that is the starting index for each baselevel. Replaced in function.
Author
SMM
Date
26/05/2017
void LSDChiTools::bin_slope_area_data ( LSDFlowInfo FlowInfo,
vector< int > &  SA_midpoint_node,
vector< float > &  SA_slope,
float  log_bin_width,
string  filename 
)

This takes slope area data and bins the data so that we can pretend horrible, noisy S-A data is adequate for understanding channel behaviour.

Parameters
FlowInfoan LSDFlowInfo object
vertical_intervalthe mean intervale over which slope is measured
midpoint_nodesThe node indices of the places where slope is calculated. This is replaced in the function.
Slopesthe slopes. This is replaced in the function.
log_bin_widthThe width of the bins (in log A)
filenameThe name of the output file (with path and extension)
Author
SMM
Date
31/05/2017
void LSDChiTools::bootstrap_slope_area_data ( LSDFlowInfo FlowInfo,
vector< int > &  SA_midpoint_node,
vector< float > &  SA_slope,
int  N_iterations,
float  bootstrap_keep_data_prob,
string  filename 
)

This function takes raw S-A data (generated by get_slope_area_data) and runs a bootstrapping procedure to find the confidence intervals of the regression coeffcients and the intercepts.

Note that it converts to log space before running the regression

Parameters
FlowInfoThe LSDFlowInfo object
SA_midpoint_nodeThe node index of the midpoints of all the data
SA_slopeThe slope of the data at the midpoints (the slope is) averaged over several pixels
N_iterationsThe number of bootstrap iterations.
keep_data_probThe probability that you will keep any given data point in the data set.
filenameThe name of file (with extension and directory) for printing
Author
SMM
Date
17/07/2017
void LSDChiTools::calculate_goodness_of_fit_collinearity_fxn_movern ( LSDFlowInfo FlowInfo,
LSDJunctionNetwork JN,
float  start_movern,
float  delta_movern,
int  n_movern,
bool  only_use_mainstem_as_reference,
string  file_prefix,
float  sigma 
)

This wraps the collinearity tester, looping through different m over n values and calculating goodness of fit statistics.

Parameters
FlowInfoan LSDFlowInfo object
JNan LSDJunctionNetwork object
start_movernthe starting m/n ratio
delta_movernthe change in m/n
n_novernthe number of m/n values to use
only_use_mainstem_as_referencea boolean, if true only compare channels to mainstem .
Thefile prefix for the data files
sigmaThe uncertainty for the MLE calculation. In practice this simply scales MLE If you have many nodes this number needs to be large
Author
SMM
Date
16/05/2017 MODIFIED FJC 17/06/17 to take a junction network as an argument - need to print out the outlet junction of each basin to match to the basin key for visualisation
void LSDChiTools::calculate_goodness_of_fit_collinearity_fxn_movern_using_disorder ( LSDFlowInfo FlowInfo,
LSDJunctionNetwork JN,
float  start_movern,
float  delta_movern,
int  n_movern,
string  file_prefix,
bool  use_uncert 
)

This wraps the disorder collinearity tester, looping through different concavity values and calculating disorder statistics. Uses the disorder metric of Hergarten et al ESURF 2016.

Parameters
FlowInfoan LSDFlowInfo object
start_movernthe starting m/n ratio
delta_movernthe change in m/n
n_novernthe number of m/n values to use
Thefile prefix for the data files
use_uncerta bool that if true triggers the uncertainty algorithms
Author
SMM
Date
24/03/2018
void LSDChiTools::calculate_goodness_of_fit_collinearity_fxn_movern_using_median_residuals ( LSDFlowInfo FlowInfo,
LSDJunctionNetwork JN,
float  start_movern,
float  delta_movern,
int  n_movern,
bool  only_use_mainstem_as_reference,
string  file_prefix 
)

This wraps the collinearity tester, looping through different m over n values and calculating goodness of fit statistics. This gets the median residual. The best fit will have a median residual closest to zero.

Parameters
FlowInfoan LSDFlowInfo object
JNan LSDJunctionNetwork object
start_movernthe starting m/n ratio
delta_movernthe change in m/n
n_novernthe number of m/n values to use
only_use_mainstem_as_referencea boolean, if true only compare channels to mainstem .
Thefile prefix for the data files
Author
SMM
Date
21/07/2017
void LSDChiTools::calculate_goodness_of_fit_collinearity_fxn_movern_using_points ( LSDFlowInfo FlowInfo,
LSDJunctionNetwork JN,
float  start_movern,
float  delta_movern,
int  n_movern,
bool  only_use_mainstem_as_reference,
string  file_prefix,
float  sigma,
vector< float >  chi_distance_fractions 
)

This wraps the collinearity tester, looping through different m over n values and calculating goodness of fit statistics. Uses discrete points rather than all the tributary data.

Parameters
FlowInfoan LSDFlowInfo object
JNan LSDJunctionNetwork object
start_movernthe starting m/n ratio
delta_movernthe change in m/n
n_novernthe number of m/n values to use
only_use_mainstem_as_referencea boolean, if true only compare channels to mainstem .
Thefile prefix for the data files
sigmaThe uncertainty for the MLE calculation. In practice this simply scales MLE.
chi_distance_fractionsThese are a vector of fractions of distance of the length of the mainstem that you want to sample the tributaries. For example if the mainstem is 10 m long in chi space and you have {0.1,0.2,0.3} as the fraction you sample the tributaries 1, 2 and 3 metres upstream of their confluence.
Author
SMM
Date
20/07/2017
void LSDChiTools::calculate_goodness_of_fit_collinearity_fxn_movern_using_points_MC ( LSDFlowInfo FlowInfo,
LSDJunctionNetwork JN,
float  start_movern,
float  delta_movern,
int  n_movern,
bool  only_use_mainstem_as_reference,
string  file_prefix,
float  sigma,
int  n_fracs,
int  MC_iterations,
float  max_frac 
)

This wraps the collinearity tester, looping through different m over n values and calculating goodness of fit statistics. Uses discrete points rather than all the tributary data. It uses monte carlo sampling to get the points, so one can repeatedly sample the MLE values for a fixed number of points.

Parameters
FlowInfoan LSDFlowInfo object
JNan LSDJunctionNetwork object
start_movernthe starting m/n ratio
delta_movernthe change in m/n
n_novernthe number of m/n values to use
only_use_mainstem_as_referencea boolean, if true only compare channels to mainstem .
Thefile prefix for the data files
sigmaThe uncertainty for the MLE calculation. In practice this simply scales MLE.
n_fracsthe number of chi distance fractions you want to use
MC_iterationThe number of iteration you want to use
max_fracthe maximum chi fraction you want to examine.
Author
SMM
Date
24/03/2017
void LSDChiTools::calculate_goodness_of_fit_collinearity_fxn_movern_with_discharge ( LSDFlowInfo FlowInfo,
LSDJunctionNetwork JN,
float  start_movern,
float  delta_movern,
int  n_movern,
bool  only_use_mainstem_as_reference,
string  file_prefix,
LSDRaster Discharge,
float  sigma 
)

This wraps the collinearity tester, looping through different m over n values and calculating goodness of fit statistics. Same as above but can use a discharge raster to calculate chi.

Parameters
FlowInfoan LSDFlowInfo object
JNan LSDJunctionNetwork object
start_movernthe starting m/n ratio
delta_movernthe change in m/n
n_novernthe number of m/n values to use
only_use_mainstem_as_referencea boolean, if true only compare channels to mainstem .
Thefile prefix for the data files
Dischargeand LSDRaster of discharge
sigmaThe uncertainty for the MLE calculation. In practice this simply scales MLE If you have many nodes this number needs to be large
Author
SMM
Date
16/05/2017
void LSDChiTools::calculate_goodness_of_fit_collinearity_fxn_movern_with_discharge_using_disorder ( LSDFlowInfo FlowInfo,
LSDJunctionNetwork JN,
float  start_movern,
float  delta_movern,
int  n_movern,
string  file_prefix,
bool  use_uncert,
LSDRaster Discharge 
)

This wraps the disorder collinearity tester, looping through different concavity values and calculating disorder statistics. Uses the disorder metric of Hergarten et al ESURF 2016. Uses a discharge raster to calculate chi.

Parameters
FlowInfoan LSDFlowInfo object
start_movernthe starting m/n ratio
delta_movernthe change in m/n
n_novernthe number of m/n values to use
Thefile prefix for the data files
use_uncerta bool that if true triggers the uncertainty algorithms
Dischargeand LSDRaster with the discharge.
Author
SMM
Date
27/04/2018
void LSDChiTools::calculate_goodness_of_fit_collinearity_fxn_movern_with_discharge_using_points ( LSDFlowInfo FlowInfo,
LSDJunctionNetwork JN,
float  start_movern,
float  delta_movern,
int  n_movern,
bool  only_use_mainstem_as_reference,
string  file_prefix,
LSDRaster Discharge,
float  sigma,
vector< float >  chi_distance_fractions 
)

This wraps the collinearity tester, looping through different m over n values and calculating goodness of fit statistics. Same as above but can use a discharge raster to calculate chi Uses discrete points rather than all the tributary data.

Parameters
FlowInfoan LSDFlowInfo object
JNan LSDJunctionNetwork object
start_movernthe starting m/n ratio
delta_movernthe change in m/n
n_novernthe number of m/n values to use
only_use_mainstem_as_referencea boolean, if true only compare channels to mainstem .
Thefile prefix for the data files
Dischargeand LSDRaster of discharge
sigmaThe uncertainty for the MLE calculation. In practice this simply scales MLE.
chi_distance_fractionsThese are a vector of fractions of distance of the length of the mainstem that you want to sample the tributaries. For example if the mainstem is 10 m long in chi space and you have {0.1,0.2,0.3} as the fraction you sample the tributaries 1, 2 and 3 metres upstream of their confluence.
Author
SMM
Date
20/07/2017
void LSDChiTools::calculate_goodness_of_fit_collinearity_fxn_movern_with_discharge_using_points_MC ( LSDFlowInfo FlowInfo,
LSDJunctionNetwork JN,
float  start_movern,
float  delta_movern,
int  n_movern,
bool  only_use_mainstem_as_reference,
string  file_prefix,
float  sigma,
int  n_fracs,
int  MC_iterations,
float  max_frac,
LSDRaster Discharge 
)

This wraps the collinearity tester, looping through different m over n values and calculating goodness of fit statistics. This one uses discharge Uses discrete points rather than all the tributary data. It uses monte carlo sampling to get the points, so one can repeatedly sample the MLE values for a fixed number of points.

Parameters
FlowInfoan LSDFlowInfo object
JNan LSDJunctionNetwork object
start_movernthe starting m/n ratio
delta_movernthe change in m/n
n_novernthe number of m/n values to use
only_use_mainstem_as_referencea boolean, if true only compare channels to mainstem .
Thefile prefix for the data files
sigmaThe uncertainty for the MLE calculation. In practice this simply scales MLE.
n_fracsthe number of chi distance fractions you want to use
MC_iterationThe number of iteration you want to use
max_fracthe maximum chi fraction you want to examine.
DischargeA discharge raster
Author
SMM
Date
27/04/2018
void LSDChiTools::calculate_segmented_elevation ( LSDFlowInfo FlowInfo)

Development function based on segment_counter to help knickpoint detection. More description will be added when it will be functional.

Parameters
FlowInfoan LSDFlowInfo object
floatthreshold_knickpoint the knickpoints detection threshold
Author
BG
Date
10/02/2017
void LSDChiTools::chi_map_automator ( LSDFlowInfo FlowInfo,
vector< int >  source_nodes,
vector< int >  outlet_nodes,
vector< int >  baselevel_node_of_each_basin,
LSDRaster Elevation,
LSDRaster FlowDistance,
LSDRaster DrainageArea,
LSDRaster chi_coordinate,
int  target_nodes,
int  n_iterations,
int  skip,
int  minimum_segment_length,
float  sigma 
)

This function maps out the chi steepness and other channel metrics in chi space from all the sources supplied in the source_nodes vector. The source and outlet nodes vector is generated by LSDJunctionNetwork.get_overlapping_channels Takes vector so source and outlet nodes and performs the segment fitting routine on them.

Parameters
FlowInfoan LSDFlowInfo object
source_nodesa vector containing the sorted sorce nodes (by flow distance)
outlet_nodesa vector continaing the outlet nodes
baselevel_node_of_each_basina vector continaing the baselelve node of the basin for each channel
Elevationan LSDRaster containing elevation info
DistanceFromOutletan LSDRaster with the flow distance
DrainageAreaan LSDRaster with the drainage area
target_nodesint the target number of nodes in a break
n_iterationsint the number of iterations
target_skipint the mean skipping value
minimum_segment_lengthHow many nodes the mimimum segment will have.
sigmaStandard deviation of error on elevation data
Author
SMM
Date
23/05/2016
void LSDChiTools::chi_map_automator_chi_only ( LSDFlowInfo FlowInfo,
vector< int >  source_nodes,
vector< int >  outlet_nodes,
vector< int >  baselevel_node_of_each_basin,
LSDRaster Elevation,
LSDRaster FlowDistance,
LSDRaster DrainageArea,
LSDRaster chi_coordinate 
)

This function burns the chi coordinate (and area, flow distance and elevation) onto the data maps in the chitools object. It does not do any segmentation. The purpose of this function is to get the chi coordinate without calculating m_chi or segmenting, and is used for m/n calculations. Can also be used for maps of chi coordinate.

Parameters
FlowInfoan LSDFlowInfo object
source_nodesa vector containing the sorted sorce nodes (by flow distance)
outlet_nodesa vector continaing the outlet nodes
baselevel_node_of_each_basina vector continaing the baselelve node of the basin for each channel
Elevationan LSDRaster containing elevation info
DistanceFromOutletan LSDRaster with the flow distance
DrainageAreaan LSDRaster with the drainage area
Author
SMM
Date
16/05/2017
void LSDChiTools::chi_map_automator_rudimentary ( LSDFlowInfo FlowInfo,
vector< int >  source_nodes,
vector< int >  outlet_nodes,
vector< int >  baselevel_node_of_each_basin,
LSDRaster Elevation,
LSDRaster FlowDistance,
LSDRaster DrainageArea,
LSDRaster chi_coordinate,
int  regression_nodes 
)

This function maps out the chi steepness and other channel metrics in chi space from all the sources supplied in the source_nodes vector. The source and outlet nodes vector is generated by LSDJunctionNetwork.get_overlapping_channels This is simpler than the above function: it simply performs a linear regression ofve a fixed number of data points: no effort is made to segment the data. It is thus much closer to a k_sn plot.

Parameters
FlowInfoan LSDFlowInfo object
source_nodesa vector continaing the sorted sorce nodes (by flow distance)
outlet_nodesa vector continaing the outlet nodes
baselevel_node_of_each_basina vector continaing the baselelve node of the basin for each channel
Elevationan LSDRaster containing elevation info
DistanceFromOutletan LSDRaster with the flow distance
DrainageAreaan LSDRaster with the drainage area
regression_nodesthe number of nodes in each segment over which to perform a linear regression. This number should be odd to it has a clear midpoint
Author
SMM
Date
02/06/2016
void LSDChiTools::chi_map_to_csv ( LSDFlowInfo FlowInfo,
string  filename,
float  A_0,
float  m_over_n,
float  area_threshold 
)

This function makes a chi map and prints to a csv file the lat and long coordinates in the csv are in WGS84.

Parameters
FlowInfoan LSDFlowInfo object
filenameThe string filename including path and extension
A_0the A_0 parameter
m_over_nthe m/n ratio
area_thresholdthe threshold over which to print chi
Author
SMM
Date
24/05/2016
void LSDChiTools::chi_map_to_csv ( LSDFlowInfo FlowInfo,
string  chi_map_fname,
LSDRaster chi_coord 
)

This function takes a raster prints to a csv file the lat and long coordinates in the csv are in WGS84.

Parameters
FlowInfoan LSDFlowInfo object
filenameThe string filename including path and extension
chi_coordthe raster of the chi coordinate (printed elsewhere)
Author
SMM
Date
03/06/2016
void LSDChiTools::chi_map_to_csv ( LSDFlowInfo FlowInfo,
string  chi_map_fname,
LSDRaster chi_coord,
LSDIndexRaster basin_raster 
)

This function takes a raster prints to a csv file. Includes the junction number in the file the lat and long coordinates in the csv are in WGS84.

Parameters
FlowInfoan LSDFlowInfo object
filenameThe string filename including path and extension
chi_coordthe raster of the chi coordinate (printed elsewhere)
basin_rasterA raster with the basin numbers (calculated elsewhere)
Author
SMM
Date
31/01/2017
void LSDChiTools::compute_basic_matrics_per_source_keys ( LSDFlowInfo FlowInfo)

compute basics metrics per source keys: flow length, chi length plus more to come probably

Parameters
FlowInfoa LSDFlowInfo Object
Author
BG
Date
08/01/2018
void LSDChiTools::extended_litho_basin_to_csv ( LSDFlowInfo FlowInfo,
string  csv_slbc_fname,
map< int, map< int, int > >  map_slbc 
)

Print a csv file with basin_key and the number/percentages of lithology pixels per lithology ID. You need the files from the rasterisation to decrypt it.

Parameters
FlowInfo
path+nameof the file
mapof map of litho obtain from a ChiTool.count_unique_values_from_litho_raster function for example
Author
BG
Date
15/09/2017
map< int, map< int, int > > LSDChiTools::get_basin_lithocount ( LSDFlowInfo FlowInfo,
LSDJunctionNetwork JunctionNetwork,
LSDIndexRaster litho,
vector< int >  Junctions 
)

This return a map with the basin ID as key, and map of the count of the different lithology as key/value.

Parameters
FlowInfo
JunctionNetwork
LSDIndexRasteras lithologic or geologic map vector of baselevel junctions
Author
BG
Date
15/09/2017
LSDIndexRaster LSDChiTools::get_basin_raster ( LSDFlowInfo FlowInfo,
LSDJunctionNetwork JunctionNetwork,
vector< int >  Juntions 
)

This returns an LSDIndexRaster with basins numbered by outlet junction.

Parameters
FlowInfoan LSDFlowInfo object
JNthe junction network object
JunctionsThe baselevel junctions to be printed
Returns
The basin raster
Author
SMM
Date
19/01/2017
void LSDChiTools::get_chi_elevation_data_of_channel ( LSDFlowInfo FlowInfo,
int  source_key,
vector< float > &  chi_data,
vector< float > &  elevation_data 
)

This takes a source key and a flow info object and overwrites vectors containing chi and elevation data from a channel tagged by a source key. The idea is to use this in the MLE comparison between two channels to check for collinearity.

Parameters
FlowInfoand LSDFlowInfo object
source_keyThe key of the source
chi_dataA vector holding chi data of the channel. Will be overwritten
elevation_dataA vector holding elevation data of the channel. Will be overwritten
Author
SMM
Date
06/05/2017
int LSDChiTools::get_ending_node_of_source ( LSDFlowInfo FlowInfo,
int  source_key 
)

It should find the ending (aka downstair) node.

Parameters
FlowInfoa FlowInfo object
Author
BG
Date
30/11/2017
void LSDChiTools::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
24/05/2015
void LSDChiTools::get_lat_and_long_locations_from_coordinate ( float  X,
float  Y,
double &  lat,
double &  longitude,
LSDCoordinateConverterLLandUTM  Converter 
)

a function to get the lat and long of a coordinate point in the raster Assumes WGS84 ellipsiod - does not correspond necessarly to a node

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
24/05/2015
int LSDChiTools::get_number_of_channels ( )

Gets the number of channels in the DEM.

Returns
number of channels
Author
SMM
Date
05/05/2017
map< int, int > LSDChiTools::get_outlet_node_from_basin_key_map ( )

This inverst the key_to_baselevel map so that the key is the baselevel key and the value is the node index of the outlet node.

Returns
An <int,int> map where key is baselevel key and value is node index of outlet node
Author
SMM
Date
14/07/2017
void LSDChiTools::get_previous_mchi_for_all_sources ( LSDFlowInfo Flowinfo)

fill maps containing information of receiving rivers

Parameters
FlowInfoa FlowInfo object
Author
BG
Date
30/11/2017
void LSDChiTools::get_slope_area_data ( LSDFlowInfo FlowInfo,
float  vertical_interval,
vector< int > &  midpoint_nodes,
vector< float > &  slopes 
)

This performs slope area analysis. It goes down through each source node and collects S-A data along these channels. It uses the suggested appraoch of Wobus et al. 2006 in that it uses a drop interval to measure slope.

Parameters
FlowInfoan LSDFlowInfo object
vertical_intervalthe mean intervale over which slope is measured
midpoint_nodesThe node indices of the places where slope is calculated. This is replaced in the function.
Slopesthe slopes. This is replaced in the function.
Author
SMM
Date
31/05/2017
int LSDChiTools::get_source_from_source_key ( int  source_key)

This gets the node index (the reference into LSDFlowInfo) of a source based on a source key.

Parameters
source_keythe source key of the reference channel
Returns
the node index of the source node
Author
SMM
Date
06/05/2017
int LSDChiTools::get_starting_node_of_source ( int  source_key)

This gets the index into the node_sequence vector of the first node in a channel identified by its source key.

Parameters
source_keythe source key of the reference channel
Returns
the index into the node_sequence vector of the source node of the channel with source_key
Author
SMM
Date
04/05/2017
void LSDChiTools::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 LSDChiTools::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 LSDChiTools::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
void LSDChiTools::KDE_vec_node_mchi ( vector< int >  vecnode,
int  SK 
)

communicate with LSDStatTools to get the KDE oer river, also register the bandwidth automatically calculated

Parameters
vecnodea vector of node index containing the data
SKsource key
Author
BG
Date
05/01/2018
void LSDChiTools::knickzone_weighting_completion ( map< pair< int, int >, vector< int > >  mapofnode)

This function extract the difference,ratio,sign between each segments of the M_segmented_chi analysis.

Parameters
FlowInfoan LSDFlowInfo object
Author
BG
Date
13/11/2017
void LSDChiTools::ksn_knickpoint_automator ( LSDFlowInfo FlowInfo,
string  OUT_DIR,
string  OUT_ID,
float  MZS_th,
float  lambda_TVD,
float  lambda_TVD_b_chi,
int  stepped_combining_window,
int  window_stepped,
float  n_std_dev,
int  kp_node_search 
)

Main function for the knickpoint analysis that control the call of other function to keep it clear and up to date.

Parameters
FlowiInfoa LSDFlowInfo object
OUT_DIRstring containing the output directory path
OUT_IDstring containing the output prefix
Author
BG
Date
05/01/2018
void LSDChiTools::ksn_knickpoint_detection ( LSDFlowInfo FlowInfo)

This function extract the difference,ratio,sign between each segments of the M_segmented_chi analysis.

Parameters
FlowInfoan LSDFlowInfo object
Author
BG
Date
4/02/2017
void LSDChiTools::ksn_knickpoint_detection_new ( LSDFlowInfo FlowInfo)

Detection of the knickpoints by looping through the source keys.

Parameters
FlowiInfoa LSDFlowInfo object
OUT_DIRstring containing the output directory path
OUT_IDstring containing the output prefix
Author
BG
Date
05/01/2018
void LSDChiTools::ksn_knickpoint_raw_river ( int  SK,
vector< int >  vecnode 
)

increment the knickpoints for one river

Parameters
SKthe source key
vecnodea vector of the rive nodes
Author
BG
Date
05/01/2018
void LSDChiTools::ksn_knickpoints_combining ( LSDFlowInfo Flowinfo,
int  kp_node_search 
)

Dealing with composite knickpoints.

Parameters
FlowiInfoa LSDFlowInfo object
Author
BG
Date
17/01/2018
void LSDChiTools::ksn_kp_KDE ( )

Calculate KDE over the river system using the dksn/dchi map previously calculated through ksn_knickpoint_automator.

Author
BG
Date
05/01/2018
void LSDChiTools::lump_my_ksn ( int  n_nodlump)

lump the m_chi to average the MC noise

Parameters
n_nodlumpthe lumping half_window (number of nodes)
Author
BG
Date
08/01/2018
void LSDChiTools::lump_this_vec ( vector< int >  this_vec,
int  n_nodlump 
)

lump m_chi for a specific vector of node index

Parameters
this_vecvector of int containing the node index
n_nodlumpthe lumping half_window (number of nodes)
Author
BG
Date
08/01/2018
void LSDChiTools::MCMC_driver ( LSDFlowInfo FlowInfo,
int  minimum_contributing_pixels,
float  sigma,
float  movern_minimum,
float  movern_maximum,
int  N_chain_links,
string  OUT_DIR,
string  OUT_ID,
bool  use_points 
)

This function drives a Monte Carlo-Markov chain model It wraps the dmovern tuning and the main chain.

Parameters
FlowInfoAn LSDFlowInfo object
minimum_contributing_pixelchi is only calculated if the contributing pixels are bigger than this
sigmaThe sigma value for checking the MLE of chi
movern_minimumThe minimum movern value to be tested
movern_maximumThe maximum movern value to be tested
N_chain_linksThe number of iterations in the chain you want
OUT_DIRthe output directory where you want the file
OUT_IDprefix of the output file
use_pointsa bool that if true means you use the point version of the collinearity test
Returns
No return but makes chaing files with extension _chain.csv
Author
SMM
Date
17/07/2017
float LSDChiTools::MCMC_for_movern ( string  ChainFname,
bool  printChain,
LSDFlowInfo FlowInfo,
int  minimum_contributing_pixels,
int  NIterations,
float  sigma,
float  dmovern_stddev,
float  movern_minimum,
float  movern_maximum,
int  basin_key,
bool  use_points 
)

This function drives a Monte Carlo-Markov chain model for getting the confidence intervals on the m/n value. You can turn the chain file printing off at first to tune the dmovern_sigma so that it arrices at a 25% acceptance rate.

Parameters
ChainFnameThe name of the chain file (with path)
printChainIf true, the chain file is printed
FlowInfoAn LSDFlowInfo object
minimum_contributing_pixelchi is only calculated if the contributing pixels are bigger than this
NIterationsThe number of iterations in the chain you want
sigmaThe sigma value for checking the MLE of chi
dmovernstddevThe standard deviation in the change in m/n test values. This needs to be tuned so the acceptance rate is ~25%
movern_minimumThe minimum movern value to be tested
movern_maximumThe maximum movern value to be tested
basinkey The key of the basin to be tested
use_pointsa bool that if true means you use the point version of the collinearity test
Returns
acceptanc probability.
Author
SMM
Date
13/07/2017
float LSDChiTools::MCMC_for_movern_tune_dmovern ( LSDFlowInfo FlowInfo,
int  minimum_contributing_pixels,
float  sigma,
float  movern_minimum,
float  movern_maximum,
int  basin_key,
bool  use_points 
)

This function drives a Monte Carlo-Markov chain model and tries to tune the dmovern_stddev value to get between 20-30% acceptance rate.

Parameters
FlowInfoAn LSDFlowInfo object
minimum_contributing_pixelchi is only calculated if the contributing pixels are bigger than this
NIterationsThe number of iterations in the chain you want
sigmaThe sigma value for checking the MLE of chi
movern_minimumThe minimum movern value to be tested
movern_maximumThe maximum movern value to be tested
basinkey The key of the basin to be tested
use_pointsa bool that if true means you use the point version of the collinearity test
Returns
The tuned dmovern_stddev.
Author
SMM
Date
13/07/2017
float LSDChiTools::MCMC_for_movern_tune_sigma ( LSDFlowInfo FlowInfo,
int  minimum_contributing_pixels,
float  dmovernstddev,
float  movern_minimum,
float  movern_maximum,
int  basin_key,
bool  use_points 
)

This function drives a Monte Carlo-Markov chain model and tries to tune the sigma value to get between 20-30% acceptance rate.

Parameters
FlowInfoAn LSDFlowInfo object
minimum_contributing_pixelchi is only calculated if the contributing pixels are bigger than this
dmovernstddevThe desired stddev of m/n changes
movern_minimumThe minimum movern value to be tested
movern_maximumThe maximum movern value to be tested
basinkey The key of the basin to be tested
use_pointsa bool that if true means you use the point version of the collinearity test
Returns
sigma The tuned sigma value for checking the MLE of chi
Author
SMM
Date
17/07/2017
void LSDChiTools::print_bandwidth_ksn_knickpoint ( string  filename)

write a file containing source key and bandwith calculated from the KDE

Parameters
vecnodea vector of node index containing the data
SKsource key
Author
BG
Date
05/01/2018
void LSDChiTools::print_baselevel_keys ( LSDFlowInfo FlowInfo,
LSDJunctionNetwork JN,
string  filename 
)

This prints a csv file that has the locations of the baselevels and their keys latitude,longitude,baselevel_junctione, baselevel_key.

Parameters
FlowInfoan LSDFlowInfo object
JNthe junction network object
filenameThe name of the filename to print to (should have full path and the extension .csv
Author
SMM
Date
16/01/2017
void LSDChiTools::print_basin_and_source_indexing_to_screen ( )

This prints all the indexing and keys to screen for bug checking.

Author
SMM
Date
28/05/2017
void LSDChiTools::print_basins ( LSDFlowInfo FlowInfo,
LSDJunctionNetwork JunctionNetwork,
vector< int >  Juntions,
string  base_filename 
)

This prints a basin LSDIndexRaster with basins numbered by outlet junction and a csv file that has the latitude and longitude of both the outlet and the centroid.

Parameters
FlowInfoan LSDFlowInfo object
JNthe junction network object
JunctionsThe baselevel junctions to be printed
base_filenameThe name of the filename to print to (should have full path but no extension. The "_AllBasins" will be added
Author
SMM
Date
19/01/2017
void LSDChiTools::print_chi_data_map_to_csv ( LSDFlowInfo FlowInfo,
string  filename 
)

This prints a csv file with chi data from the data maps the columns are: latitude,longitude,chi,elevation,flow distance,drainage area,.

Parameters
FlowInfoan LSDFlowInfo object
filenameThe name of the filename to print to (should have full path and the extension .csv
Author
SMM
Date
05/06/2017
void LSDChiTools::print_chi_data_map_to_csv_for_single_basin ( LSDFlowInfo FlowInfo,
string  filename,
int  basin_key 
)

This prints a csv file with chi data from the data maps for a specific basin the columns are: latitude,longitude,chi,elevation,flow distance,drainage area,.

Parameters
FlowInfoan LSDFlowInfo object
filenameThe name of the filename to print to (should have full path and the extension .csv
basin_keythe basin key.
Author
SMM
Date
14/07/2017
void LSDChiTools::print_data_maps_to_file_basic ( LSDFlowInfo FlowInfo,
string  filename 
)

This prints a csv file with a subset of the data from the data maps the columns are: latitude,longitude,m_chi,b_chi,knickpoint Development function.

Parameters
FlowInfoan LSDFlowInfo object
filenameThe name of the filename to print to (should have full path and the extension .csv
Author
SMM/BG
Date
02/06/2016
void LSDChiTools::print_data_maps_to_file_full ( LSDFlowInfo FlowInfo,
string  filename 
)

This prints a csv file with all the data from the data maps the columns are: latitude,longitude,chi,elevation,flow distance,drainage area,m_chi,b_chi.

Parameters
FlowInfoan LSDFlowInfo object
filenameThe name of the filename to print to (should have full path and the extension .csv
Author
SMM
Date
02/06/2016
void LSDChiTools::print_data_maps_to_file_full_knickpoints ( LSDFlowInfo FlowInfo,
string  filename 
)

This prints a csv file with a subset of the data from the data maps the columns are: latitude,longitude,m_chi,b_chi.

Parameters
FlowInfoan LSDFlowInfo object
filenameThe name of the filename to print to (should have full path and the extension .csv
Author
SMM
Date
02/06/2016
void LSDChiTools::print_intersources_mchi_map ( string  filename)

print a csv file with the receiver of each source and the corresponding source with the m_chi That is barely understable, however I have a cold so I am tired as F. Just ask me if you need more info about that

Parameters
stringfilename: the path/name.csv of your file
Author
BG
Date
30/11/2017
void LSDChiTools::print_knickpoint_to_csv ( LSDFlowInfo FlowInfo,
string  filename 
)

This prints a csv file with all the knickpoint data the columns are: latitude,longitude,elevation,flow distance,drainage area,ratio,diff,sign.

Parameters
FlowInfoan LSDFlowInfo object
filenameThe name of the filename to print to (should have full path and the extension .csv
Author
BG
Date
06/06/2017
void LSDChiTools::print_knickzone_to_csv ( LSDFlowInfo FlowInfo,
string  filename 
)

This prints a csv file with all the knickzones raw data the columns are: latitude,longitude,elevation,flow distance,drainage area,ratio,diff,sign.

Parameters
FlowInfoan LSDFlowInfo object
filenameThe name of the filename to print to (should have full path and the extension .csv
Author
BG
Date
06/06/2017
void LSDChiTools::print_mchisegmented_knickpoint_version ( LSDFlowInfo FlowInfo,
string  filename 
)

This function write a file similar to the MCHISegmented one slightly different to match with the knickpoint plotting requirements @ param LSDFlowInfo A LSDFlowInfo object

Parameters
stringfilename the path name and extension of hte required file
Author
BG
Date
05/12/2017
void LSDChiTools::print_profiles_as_fxn_movern ( LSDFlowInfo FlowInfo,
string  file_prefix,
float  start_movern,
float  delta_movern,
int  n_movern 
)

This prints a series of chi profiles as a function of m over n for visualisation.

Parameters
FlowInfoan LSDFlowInfo object
file_prefixTHe path and name of file without extension
start_movernthe starting m/n ratio
delta_movernthe change in m/n
n_novernthe number of m/n values to use
Author
SMM
Date
17/05/2017
void LSDChiTools::print_profiles_as_fxn_movern_with_burned_raster ( LSDFlowInfo FlowInfo,
string  filename,
float  start_movern,
float  delta_movern,
int  n_movern,
LSDRaster BurnRaster,
string  column_name 
)

This prints a series of chi profiles as a function of m over n for visualisation. It also burns a raster value to each of the nodes The raster burning is useful for adding information like geology or K values.

Parameters
FlowInfoan LSDFlowInfo object
file_prefixTHe path and name of file without extension
start_movernthe starting m/n ratio
delta_movernthe change in m/n
n_novernthe number of m/n values to use
BurnRasterthe raster to burn to the csv
column_namethe name of the column to which the data will be burned
Author
SMM
Date
07/09/2017
void LSDChiTools::print_profiles_as_fxn_movern_with_discharge ( LSDFlowInfo FlowInfo,
string  file_prefix,
float  start_movern,
float  delta_movern,
int  n_movern,
LSDRaster Discharge 
)

This prints a series of chi profiles as a function of mover for visualisation.

Parameters
FlowInfoan LSDFlowInfo object
file_prefixTHe path and name of file without extension
start_movernthe starting m/n ratio
delta_movernthe change in m/n
n_novernthe number of m/n values to use
Dischargean LSDRaster of discharge
Author
SMM
Date
17/05/2017
void LSDChiTools::print_profiles_as_fxn_movern_with_discharge_and_burned_raster ( LSDFlowInfo FlowInfo,
string  filename,
float  start_movern,
float  delta_movern,
int  n_movern,
LSDRaster Discharge,
LSDRaster BurnRaster,
string  burned_column_name 
)

This prints a series of chi profiles as a function of mover for visualisation. It also burns a raster value to each of the nodes The raster burning is useful for adding information like geology or K values.

Parameters
FlowInfoan LSDFlowInfo object
file_prefixTHe path and name of file without extension
start_movernthe starting m/n ratio
delta_movernthe change in m/n
n_novernthe number of m/n values to use
Dischargean LSDRaster of discharge
BurnRasterthe raster to burn to the csv
column_namethe name of the column to which the data will be burned
Author
SMM
Date
08/09/2017
void LSDChiTools::print_raw_ksn_knickpoint ( LSDFlowInfo FlowInfo,
string  filename 
)

write a file with the raw knickpoint informations

Parameters
FlowiInfoa LSDFlowInfo object
filenamestring with path+name+.csv
Author
BG
Date
05/01/2018
void LSDChiTools::print_slope_area_data_to_csv ( LSDFlowInfo FlowInfo,
vector< int > &  SA_midpoint_node,
vector< float > &  SA_slope,
string  filename 
)

This takes the midpoint node and slope vectors produced by the slope_area_analysis and prints them to a csv.

Parameters
SA_midpoint_nodethe node index of the midpoints used in to caluclate slope
SA_slopeThe slope data
filenameThe name (including path and extension) of the file for printing
Author
SMM
Date
31/05/2017
void LSDChiTools::print_source_keys ( LSDFlowInfo FlowInfo,
string  filename 
)

This prints a csv file that has the locations of the sources and their keys latitude,longitude,source_node, source_key.

Parameters
FlowInfoan LSDFlowInfo object
filenameThe name of the filename to print to (should have full path and the extension .csv
Author
SMM
Date
16/01/2017
vector< float > LSDChiTools::project_data_onto_reference_channel ( vector< float > &  reference_chi,
vector< float > &  reference_elevation,
vector< float > &  trib_chi,
vector< float > &  trib_elevation 
)

This takes the chi locations of a tributarry vector and then uses linear interpolation to determine the elevation on a reference channel at those chi values.

Parameters
reference_chithe chi coordiantes of the reference channel
reference_elevationthe elevations on the reference channel
trib_chithe chi coordiantes of the tributary channel
trib_elevationthe elevations on the tributary channel
Returns
A vector of the elevations on the chi locations of the tributary channel
Author
SMM
Date
07/05/2017
vector< float > LSDChiTools::project_points_onto_reference_channel ( vector< float > &  reference_chi,
vector< float > &  reference_elevation,
vector< float > &  trib_chi,
vector< float > &  trib_elevation,
vector< float >  chi_distances_to_test 
)

This takes the chi locations of a tributarry vector and then uses linear interpolation to determine the elevation on a reference channel of points at a vector of fixed distances upstream the tributary channel.

Parameters
reference_chithe chi coordiantes of the reference channel
reference_elevationthe elevations on the reference channel
trib_chithe chi coordiantes of the tributary channel
trib_elevationthe elevations on the tributary channel
chi_distances_to_testthe distances upstream of the confluence on the tributary channel to test the residuals
Returns
A vector of the elevations on the chi locations of the tributary channel
Author
SMM
Date
20/07/2017
void LSDChiTools::reset_data_maps ( )

This resets all the data maps.

Author
SMM :date 02/06/2016
vector< float > LSDChiTools::retrieve_all_residuals_by_basin ( LSDFlowInfo FlowInfo,
bool  only_use_mainstem_as_reference,
int  baselevel_key 
)

This takes a basin key and returns all the residuals of the channels.

Parameters
FlowInfoan LSDFlowInfo object
only_use_mainstem_as_referenceIf true, only use the mainstem as a reference channel
test_channelthe source key of the test channel
sigmaThe uncertainty for the MLE calculation. In practice this simply scales MLE If you have many nodes this number needs to be large
baselevel_keyThe key to the basin you want
Returns
A vector containing all the residuals
Author
SMM
Date
21/07/2017
void LSDChiTools::segment_binned_slope_area_data ( LSDFlowInfo FlowInfo,
vector< int > &  SA_midpoint_node,
vector< float > &  SA_slope,
float  log_bin_width,
int  minimum_segment_length,
string  filename 
)

This takes slope area data and bins the data so that we can pretend horrible, noisy S-A data is adequate for understanding channel behaviour. It then segments these horrible data using the segmentation algorithm. Happy 4th of July everyone!

Parameters
FlowInfoan LSDFlowInfo object
vertical_intervalthe mean intervale over which slope is measured
midpoint_nodesThe node indices of the places where slope is calculated. This is replaced in the function.
Slopesthe slopes. This is replaced in the function.
log_bin_widthThe width of the bins (in log A)
minimum_segment_lengthMinimum segment length for segmentation algorithm
filenameThe name of the output file (with path and extension)
Author
SMM
Date
04/07/2017
void LSDChiTools::segment_counter ( LSDFlowInfo FlowInfo,
float  maximum_segment_length 
)

This function is used to tag channels with a segment number It decides on segments if the M_Chi value has changed so should only be used with chi networks that have used a skip of 0 and a monte carlo itertions of 1 This data is used by other routines to look at the spatial distribution of hillslope-channel coupling. WARNING: ONLY use if you have segmented with skip 0 and iterations 1. Otherwise you will get a new segment for every channel pixel.

Parameters
FlowInfoan LSDFlowInfo object
maximum_segment_lengthis the longest a segment is allowed to be before a new segment is created
Author
SMM
Date
4/02/2017
void LSDChiTools::segment_counter_knickpoint ( LSDFlowInfo FlowInfo,
float  threshold_knickpoint,
float  threshold_knickpoint_length 
)

This function calculates the fitted elevations: It uses m_chi and b_chi data to get the fitted elevation of the channel points.

Parameters
FlowInfoan LSDFlowInfo object
Author
SMM
Date
4/02/2017
LSDIndexRaster LSDChiTools::segment_mapping ( LSDFlowInfo FlowInfo,
float  maximum_segment_length 
)

This function is used to tag channels with a segment number It decides on segments if the M_Chi value has changed so should only be used with chi networks that have used a skip of 0 and a monte carlo itertions of 1 This data is used by other routines to look at the spatial distribution of hillslope-channel coupling. WARNING: ONLY use if you have segmented with skip 0 and iterations 1. Otherwise you will get a new segment for every channel pixel.

Parameters
FlowInfoan LSDFlowInfo object
maximum_segment_lengthis the longest a segment is allowed to be before a new segment is created
Returns
LSDIndexRaster showing stream network indexed by segment ID
Author
MDH
Date
15/06/2017
void LSDChiTools::set_map_of_source_and_node ( LSDFlowInfo FlowInfo,
int  n_nodlump 
)

set a map of each source_key with the corresponding vector fo node INCLUDING the first node of the receaving river if this abovementioned one does exist.

Parameters
Flowinfo,aLSDFlowInfo object
intn_nodlump, the half lumping window
Author
BG
Date
05/01/2018
void LSDChiTools::simple_litho_basin_to_csv ( LSDFlowInfo FlowInfo,
string  csv_slbc_fname,
map< int, map< int, int > >  map_slbc 
)

Print a csv file with basin_key and the number of lithology pixels per lithology ID. You need the files from the rasterisation to decrypt it.

Parameters
FlowInfo
path+nameof the file
mapof map of litho obtain from a ChiTool.count_unique_values_from_litho_raster function for example
Author
BG
Date
15/09/2017
float LSDChiTools::test_all_segment_collinearity_by_basin ( LSDFlowInfo FlowInfo,
bool  only_use_mainstem_as_reference,
int  basin_key,
vector< int > &  reference_source,
vector< int > &  test_source,
vector< float > &  MLE_values,
vector< float > &  RMSE_values,
float  sigma 
)

This computes a collinearity metric for all combinations of channels for a given basin It takes all the combinations of sources and gets the goodness of fit between each pair of sources.

Parameters
FlowInfoan LSDFlowInfo object
only_use_mainstem_as_referenceTrue if you only want to use the mainstem
basin_keyThe key into the basin you want to test all collinearity of.
reference_sourceinteger vector replaced in function that has the reference vector for each comparison
test_sourceinteger vector replaced in function that has the test vector for each comparison
MLE_valuesthe MLE for each comparison. Replaced in function.
RMSE_valuesthe RMSE for each comparison (i.e. between source 0 1, 0 2, 0 3, etc.). Replaced in function.
sigmaThe uncertainty for the MLE calculation. In practice this simply scales MLE If you have many nodes this number needs to be large
Author
SMM
Date
08/05/2017
float LSDChiTools::test_all_segment_collinearity_by_basin_using_points ( LSDFlowInfo FlowInfo,
bool  only_use_mainstem_as_reference,
int  basin_key,
vector< int > &  reference_source,
vector< int > &  test_source,
vector< float > &  MLE_values,
vector< float > &  RMSE_values,
float  sigma,
vector< float >  chi_distances_to_test 
)

This computes a collinearity metric for all combinations of channels for a given basin. This version uses specified points in chi space to compare against other channels rather than the entire channel It takes all the combinations of sources and gets the goodness of fit between each pair of sources.

Parameters
FlowInfoan LSDFlowInfo object
only_use_mainstem_as_referenceTrue if you only want to use the mainstem
basin_keyThe key into the basin you want to test all collinearity of.
reference_sourceinteger vector replaced in function that has the reference vector for each comparison
test_sourceinteger vector replaced in function that has the test vector for each comparison
MLE_valuesthe MLE for each comparison. Replaced in function.
RMSE_valuesthe RMSE for each comparison (i.e. between source 0 1, 0 2, 0 3, etc.). Replaced in function.
sigmaThe uncertainty for the MLE calculation. In practice this simply scales MLE
chi_distances_to_testThe distances in chi space to test
Author
SMM
Date
20/07/2017
float LSDChiTools::test_collinearity_by_basin_disorder ( LSDFlowInfo FlowInfo,
int  basin_key 
)

This computes a the disorder metric of Hergarten et al 2016 by basin.

Parameters
FlowInfoan LSDFlowInfo object
basin_keyThe key into the basin you want to test all collinearity of.
Author
SMM
Date
24/03/2018
vector< float > LSDChiTools::test_collinearity_by_basin_disorder_with_uncert ( LSDFlowInfo FlowInfo,
int  basin_key 
)

This computes a the disorder metric of Hergarten et al 2016 by basin. It uses a permutation algorithm to find all combinations of tributary channels and computes the disorder statistic of each of these.

Parameters
FlowInfoan LSDFlowInfo object
basin_keyThe key into the basin you want to test all collinearity of.
Author
SMM
Date
13/04/2018
float LSDChiTools::test_segment_collinearity ( LSDFlowInfo FlowInfo,
int  reference_channel,
int  test_channel,
float  sigma 
)

This returns an maximum liklihood estiamtor by comparing a channel (with a particular source number) against a reference channel.

Parameters
FlowInfoan LSDFlowInfo object
reference_channelthe source key of the reference channel
test_channelthe source key of the test channel
sigmaThe uncertainty for the MLE calculation. In practice this simply scales MLE If you have many nodes this number needs to be large
Returns
The maximum likelihood estimator
Author
SMM
Date
04/05/2017
float LSDChiTools::test_segment_collinearity_using_points ( LSDFlowInfo FlowInfo,
int  reference_channel,
int  test_channel,
float  sigma,
vector< float >  chi_distances_to_test 
)

This returns an maximum liklihood estiamtor by comparing a channel (with a particular source number) against a reference channel, using specific points on the test channel.

Parameters
FlowInfoan LSDFlowInfo object
reference_channelthe source key of the reference channel
test_channelthe source key of the test channel
sigmaThe uncertainty for the MLE calculation. In practice this simply scales MLE If you have many nodes this number needs to be large
chi_distances_to_testThe distances in chi space to test
Returns
The maximum likelihood estimator
Author
SMM
Date
20/07/2017
void LSDChiTools::TVD_on_my_ksn ( const float  lambda,
float  lambda_TVD_b_chi 
)

Apply the TVD filter () L.Condat 2013 on the m_chi and b_chi signals.

Parameters
this_vecvector of int containing the node index
n_nodlumpthe lumping half_window (number of nodes)
Author
BG
Date
08/01/2018
void LSDChiTools::update_chi_data_map ( LSDFlowInfo FlowInfo,
LSDRaster Chi_coord 
)

This takes a chi raster and updates the chi data map. WARNING you must use a raster derived from the topography raster that was used to make the FlowInfo object. This function does not check the dimensions of the raster.

Parameters
FlowInfoAn LSDFlowInfo object
Chi_coordinateLSDRaster of the chi coordinate
Author
SMM
Date
17/05/2017
void LSDChiTools::update_chi_data_map ( LSDFlowInfo FlowInfo,
float  A_0,
float  movern 
)

This takes a chi raster and updates the chi data map. Overloaded from the previous function: this one calculates chi directly from the FlowInfo so you have no problems with raster size WARNING you must use a raster derived from the topography raster that was used to make the FlowInfo object. This function does not check the dimensions of the raster.

Parameters
FlowInfoAn LSDFlowInfo object
A_0the A_0 parameter: in metres^2 suggested value is 1
m_over_nthe m/n ratio
Author
SMM
Date
17/05/2017
void LSDChiTools::update_chi_data_map_for_single_basin ( LSDFlowInfo FlowInfo,
float  A_0,
float  movern,
int  minimum_contributing_pixels,
int  basin_key,
map< int, int >  outlet_node_from_basin_key_map 
)

This recalcualtes chi for a single basin. Built for speed and is used by the MCMC routines.

Parameters
FlowInfoAn LSDFlowInfo object
A_0the A_0 parameter: in metres^2 suggested value is 1
m_over_nthe m/n ratio
mimum_contributing_pixelsThis minimum number of contributing pixels needed before chi is calculated
basin_keythe key to the basin you want
outlet_node_from_basin_key_mapa map where the key is the basin key and the value is the node index of the outlet. you generate this map by calling get_outlet_node_from_basin_key_map()
Returns
No return, but the chi values FOR THIS BASIN ONLY are updated.
Author
SMM
Date
14/07/2017
void LSDChiTools::update_chi_data_map_for_single_basin ( LSDFlowInfo FlowInfo,
float  A_0,
float  movern,
int  minimum_contributing_pixels,
int  basin_key,
map< int, int >  outlet_node_from_basin_key_map,
LSDRaster Discharge 
)

This recalcualtes chi for a single basin. Built for speed and is used by the MCMC routines. This version uses a discharge raster.

Parameters
FlowInfoAn LSDFlowInfo object
A_0the A_0 parameter: in metres^2 suggested value is 1
m_over_nthe m/n ratio
mimum_contributing_pixelsThis minimum number of contributing pixels needed before chi is calculated
basin_keythe key to the basin you want
outlet_node_from_basin_key_mapa map where the key is the basin key and the value is the node index of the outlet. you generate this map by calling get_outlet_node_from_basin_key_map()
Dischargean LSDRaster of discharge
Returns
No return, but the chi values FOR THIS BASIN ONLY are updated.
Author
SMM
Date
14/07/2017

Member Data Documentation

map<int,int> LSDChiTools::baselevel_keys_map
protected

This has all the nodes. The key (in the map) is the node index, and the value is the baselevel key. Again used for visualisation

map<int,int> LSDChiTools::key_to_baselevel_map
protected

This has as many elements as there are baselelvels. The key is the node index and the value is the baselevel key.

map<int,int> LSDChiTools::key_to_source_map
protected

This has as many elements as there are sources. The key in the map is the node index of the source, and the value is the source key.

vector<int> LSDChiTools::node_sequence
protected

A vector to hold the order of the nodes. Starts from longest channel and then works through sources in descending order of channel lenght

map<int,int> LSDChiTools::segment_counter_map
protected

A map that holds segment numbers: used with skip = 0. Can be used to map distinct segments

map<int,int> LSDChiTools::source_keys_map
protected

vectors to hold the source nodes and the outlet nodes The source keys are indicies into the source_to_key_map. In big DEMs the node numbers become huge so for printing efficiency we run a key that starts at 0 This map contains all the nodes. The key is the node index and the value is the source key (sorry I know this is confusing). It means if you have the node index you can look up the source key. Used for visualisation.

map<int,int> LSDChiTools::source_node_of_mainstem_map
protected

In this map the key is the basin key and the value is the node of the baselevel source

vector<int> LSDChiTools::source_nodes_ranked_by_basin
protected

This vector contains the rank of each source node in each basin, so the main stem in each basin is 0, the second is 1, the 3rd is 2, etc. Counting starts again when a new baselevel node starts.


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