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 |
This object packages a number of tools for chi analysis.
|
inline |
|
inline |
|
inline |
Create an LSDChiTools from a LSDFlowInfo object.
ThisFI | An LSDFlowInfo object |
|
inline |
Create an LSDChiTools from a LSDJunctionNetwork.
ThisJN | An LSDJunctionNetwork object |
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.
n_sources_for_baselevel | The number of sources for each baselelvel node Replaced in function. |
index_into_sources_vec | The index into the ordered sources vector that is the starting index for each baselevel. Replaced in function. |
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.
FlowInfo | an LSDFlowInfo object |
vertical_interval | the mean intervale over which slope is measured |
midpoint_nodes | The node indices of the places where slope is calculated. This is replaced in the function. |
Slopes | the slopes. This is replaced in the function. |
log_bin_width | The width of the bins (in log A) |
filename | The name of the output file (with path and extension) |
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
FlowInfo | The LSDFlowInfo object |
SA_midpoint_node | The node index of the midpoints of all the data |
SA_slope | The slope of the data at the midpoints (the slope is) averaged over several pixels |
N_iterations | The number of bootstrap iterations. |
keep_data_prob | The probability that you will keep any given data point in the data set. |
filename | The name of file (with extension and directory) for printing |
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.
FlowInfo | an LSDFlowInfo object |
JN | an LSDJunctionNetwork object |
start_movern | the starting m/n ratio |
delta_movern | the change in m/n |
n_novern | the number of m/n values to use |
only_use_mainstem_as_reference | a boolean, if true only compare channels to mainstem . |
The | file prefix for the data files |
sigma | The uncertainty for the MLE calculation. In practice this simply scales MLE If you have many nodes this number needs to be large |
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.
FlowInfo | an LSDFlowInfo object |
start_movern | the starting m/n ratio |
delta_movern | the change in m/n |
n_novern | the number of m/n values to use |
The | file prefix for the data files |
use_uncert | a bool that if true triggers the uncertainty algorithms |
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.
FlowInfo | an LSDFlowInfo object |
JN | an LSDJunctionNetwork object |
start_movern | the starting m/n ratio |
delta_movern | the change in m/n |
n_novern | the number of m/n values to use |
only_use_mainstem_as_reference | a boolean, if true only compare channels to mainstem . |
The | file prefix for the data files |
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.
FlowInfo | an LSDFlowInfo object |
JN | an LSDJunctionNetwork object |
start_movern | the starting m/n ratio |
delta_movern | the change in m/n |
n_novern | the number of m/n values to use |
only_use_mainstem_as_reference | a boolean, if true only compare channels to mainstem . |
The | file prefix for the data files |
sigma | The uncertainty for the MLE calculation. In practice this simply scales MLE. |
chi_distance_fractions | These 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. |
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.
FlowInfo | an LSDFlowInfo object |
JN | an LSDJunctionNetwork object |
start_movern | the starting m/n ratio |
delta_movern | the change in m/n |
n_novern | the number of m/n values to use |
only_use_mainstem_as_reference | a boolean, if true only compare channels to mainstem . |
The | file prefix for the data files |
sigma | The uncertainty for the MLE calculation. In practice this simply scales MLE. |
n_fracs | the number of chi distance fractions you want to use |
MC_iteration | The number of iteration you want to use |
max_frac | the maximum chi fraction you want to examine. |
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.
FlowInfo | an LSDFlowInfo object |
JN | an LSDJunctionNetwork object |
start_movern | the starting m/n ratio |
delta_movern | the change in m/n |
n_novern | the number of m/n values to use |
only_use_mainstem_as_reference | a boolean, if true only compare channels to mainstem . |
The | file prefix for the data files |
Discharge | and LSDRaster of discharge |
sigma | The uncertainty for the MLE calculation. In practice this simply scales MLE If you have many nodes this number needs to be large |
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.
FlowInfo | an LSDFlowInfo object |
start_movern | the starting m/n ratio |
delta_movern | the change in m/n |
n_novern | the number of m/n values to use |
The | file prefix for the data files |
use_uncert | a bool that if true triggers the uncertainty algorithms |
Discharge | and LSDRaster with the discharge. |
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.
FlowInfo | an LSDFlowInfo object |
JN | an LSDJunctionNetwork object |
start_movern | the starting m/n ratio |
delta_movern | the change in m/n |
n_novern | the number of m/n values to use |
only_use_mainstem_as_reference | a boolean, if true only compare channels to mainstem . |
The | file prefix for the data files |
Discharge | and LSDRaster of discharge |
sigma | The uncertainty for the MLE calculation. In practice this simply scales MLE. |
chi_distance_fractions | These 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. |
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.
FlowInfo | an LSDFlowInfo object |
JN | an LSDJunctionNetwork object |
start_movern | the starting m/n ratio |
delta_movern | the change in m/n |
n_novern | the number of m/n values to use |
only_use_mainstem_as_reference | a boolean, if true only compare channels to mainstem . |
The | file prefix for the data files |
sigma | The uncertainty for the MLE calculation. In practice this simply scales MLE. |
n_fracs | the number of chi distance fractions you want to use |
MC_iteration | The number of iteration you want to use |
max_frac | the maximum chi fraction you want to examine. |
Discharge | A discharge raster |
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.
FlowInfo | an LSDFlowInfo object |
float | threshold_knickpoint the knickpoints detection threshold |
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.
FlowInfo | an LSDFlowInfo object |
source_nodes | a vector containing the sorted sorce nodes (by flow distance) |
outlet_nodes | a vector continaing the outlet nodes |
baselevel_node_of_each_basin | a vector continaing the baselelve node of the basin for each channel |
Elevation | an LSDRaster containing elevation info |
DistanceFromOutlet | an LSDRaster with the flow distance |
DrainageArea | an LSDRaster with the drainage area |
target_nodes | int the target number of nodes in a break |
n_iterations | int the number of iterations |
target_skip | int the mean skipping value |
minimum_segment_length | How many nodes the mimimum segment will have. |
sigma | Standard deviation of error on elevation data |
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.
FlowInfo | an LSDFlowInfo object |
source_nodes | a vector containing the sorted sorce nodes (by flow distance) |
outlet_nodes | a vector continaing the outlet nodes |
baselevel_node_of_each_basin | a vector continaing the baselelve node of the basin for each channel |
Elevation | an LSDRaster containing elevation info |
DistanceFromOutlet | an LSDRaster with the flow distance |
DrainageArea | an LSDRaster with the drainage area |
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.
FlowInfo | an LSDFlowInfo object |
source_nodes | a vector continaing the sorted sorce nodes (by flow distance) |
outlet_nodes | a vector continaing the outlet nodes |
baselevel_node_of_each_basin | a vector continaing the baselelve node of the basin for each channel |
Elevation | an LSDRaster containing elevation info |
DistanceFromOutlet | an LSDRaster with the flow distance |
DrainageArea | an LSDRaster with the drainage area |
regression_nodes | the number of nodes in each segment over which to perform a linear regression. This number should be odd to it has a clear midpoint |
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.
FlowInfo | an LSDFlowInfo object |
filename | The string filename including path and extension |
A_0 | the A_0 parameter |
m_over_n | the m/n ratio |
area_threshold | the threshold over which to print chi |
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.
FlowInfo | an LSDFlowInfo object |
filename | The string filename including path and extension |
chi_coord | the raster of the chi coordinate (printed elsewhere) |
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.
FlowInfo | an LSDFlowInfo object |
filename | The string filename including path and extension |
chi_coord | the raster of the chi coordinate (printed elsewhere) |
basin_raster | A raster with the basin numbers (calculated elsewhere) |
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
FlowInfo | a LSDFlowInfo Object |
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.
FlowInfo | |
path+name | of the file |
map | of map of litho obtain from a ChiTool.count_unique_values_from_litho_raster function for example |
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.
FlowInfo | |
JunctionNetwork | |
LSDIndexRaster | as lithologic or geologic map vector of baselevel junctions |
LSDIndexRaster LSDChiTools::get_basin_raster | ( | LSDFlowInfo & | FlowInfo, |
LSDJunctionNetwork & | JunctionNetwork, | ||
vector< int > | Juntions | ||
) |
This returns an LSDIndexRaster with basins numbered by outlet junction.
FlowInfo | an LSDFlowInfo object |
JN | the junction network object |
Junctions | The baselevel junctions to be printed |
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.
FlowInfo | and LSDFlowInfo object |
source_key | The key of the source |
chi_data | A vector holding chi data of the channel. Will be overwritten |
elevation_data | A vector holding elevation data of the channel. Will be overwritten |
int LSDChiTools::get_ending_node_of_source | ( | LSDFlowInfo & | FlowInfo, |
int | source_key | ||
) |
It should find the ending (aka downstair) node.
FlowInfo | a FlowInfo object |
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
row | the row of the node |
col | the col of the node |
lat | the 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) |
long | the 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) |
Converter | a converter object (from LSDShapeTools) |
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
row | the row of the node |
col | the col of the node |
lat | the 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) |
long | the 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) |
Converter | a converter object (from LSDShapeTools) |
int LSDChiTools::get_number_of_channels | ( | ) |
Gets the number of channels in the DEM.
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.
void LSDChiTools::get_previous_mchi_for_all_sources | ( | LSDFlowInfo & | Flowinfo | ) |
fill maps containing information of receiving rivers
FlowInfo | a FlowInfo object |
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.
FlowInfo | an LSDFlowInfo object |
vertical_interval | the mean intervale over which slope is measured |
midpoint_nodes | The node indices of the places where slope is calculated. This is replaced in the function. |
Slopes | the slopes. This is replaced in the function. |
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.
source_key | the source key of the reference channel |
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.
source_key | the source key of the reference channel |
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
UTM_zone | the UTM zone. Replaced in function. |
is_North | a boolean that is true if the DEM is in the northern hemisphere. replaced in function |
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
row | the row of the node |
col | the column of the node |
x_loc | the x location (Northing) of the node |
y_loc | the y location (Easting) of the node |
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
row | the row of the node |
col | the column of the node |
x_loc | the x location (Northing) of the node |
y_loc | the y location (Easting) of the node |
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
vecnode | a vector of node index containing the data |
SK | source key |
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.
FlowInfo | an LSDFlowInfo object |
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.
FlowiInfo | a LSDFlowInfo object |
OUT_DIR | string containing the output directory path |
OUT_ID | string containing the output prefix |
void LSDChiTools::ksn_knickpoint_detection | ( | LSDFlowInfo & | FlowInfo | ) |
This function extract the difference,ratio,sign between each segments of the M_segmented_chi analysis.
FlowInfo | an LSDFlowInfo object |
void LSDChiTools::ksn_knickpoint_detection_new | ( | LSDFlowInfo & | FlowInfo | ) |
Detection of the knickpoints by looping through the source keys.
FlowiInfo | a LSDFlowInfo object |
OUT_DIR | string containing the output directory path |
OUT_ID | string containing the output prefix |
void LSDChiTools::ksn_knickpoint_raw_river | ( | int | SK, |
vector< int > | vecnode | ||
) |
increment the knickpoints for one river
SK | the source key |
vecnode | a vector of the rive nodes |
void LSDChiTools::ksn_knickpoints_combining | ( | LSDFlowInfo & | Flowinfo, |
int | kp_node_search | ||
) |
void LSDChiTools::ksn_kp_KDE | ( | ) |
Calculate KDE over the river system using the dksn/dchi map previously calculated through ksn_knickpoint_automator.
void LSDChiTools::lump_my_ksn | ( | int | n_nodlump | ) |
lump the m_chi to average the MC noise
n_nodlump | the lumping half_window (number of nodes) |
void LSDChiTools::lump_this_vec | ( | vector< int > | this_vec, |
int | n_nodlump | ||
) |
lump m_chi for a specific vector of node index
this_vec | vector of int containing the node index |
n_nodlump | the lumping half_window (number of nodes) |
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.
FlowInfo | An LSDFlowInfo object |
minimum_contributing_pixel | chi is only calculated if the contributing pixels are bigger than this |
sigma | The sigma value for checking the MLE of chi |
movern_minimum | The minimum movern value to be tested |
movern_maximum | The maximum movern value to be tested |
N_chain_links | The number of iterations in the chain you want |
OUT_DIR | the output directory where you want the file |
OUT_ID | prefix of the output file |
use_points | a bool that if true means you use the point version of the collinearity test |
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.
ChainFname | The name of the chain file (with path) |
printChain | If true, the chain file is printed |
FlowInfo | An LSDFlowInfo object |
minimum_contributing_pixel | chi is only calculated if the contributing pixels are bigger than this |
NIterations | The number of iterations in the chain you want |
sigma | The sigma value for checking the MLE of chi |
dmovernstddev | The standard deviation in the change in m/n test values. This needs to be tuned so the acceptance rate is ~25% |
movern_minimum | The minimum movern value to be tested |
movern_maximum | The maximum movern value to be tested |
basin | key The key of the basin to be tested |
use_points | a bool that if true means you use the point version of the collinearity test |
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.
FlowInfo | An LSDFlowInfo object |
minimum_contributing_pixel | chi is only calculated if the contributing pixels are bigger than this |
NIterations | The number of iterations in the chain you want |
sigma | The sigma value for checking the MLE of chi |
movern_minimum | The minimum movern value to be tested |
movern_maximum | The maximum movern value to be tested |
basin | key The key of the basin to be tested |
use_points | a bool that if true means you use the point version of the collinearity test |
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.
FlowInfo | An LSDFlowInfo object |
minimum_contributing_pixel | chi is only calculated if the contributing pixels are bigger than this |
dmovernstddev | The desired stddev of m/n changes |
movern_minimum | The minimum movern value to be tested |
movern_maximum | The maximum movern value to be tested |
basin | key The key of the basin to be tested |
use_points | a bool that if true means you use the point version of the collinearity test |
void LSDChiTools::print_bandwidth_ksn_knickpoint | ( | string | filename | ) |
write a file containing source key and bandwith calculated from the KDE
vecnode | a vector of node index containing the data |
SK | source key |
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.
FlowInfo | an LSDFlowInfo object |
JN | the junction network object |
filename | The name of the filename to print to (should have full path and the extension .csv |
void LSDChiTools::print_basin_and_source_indexing_to_screen | ( | ) |
This prints all the indexing and keys to screen for bug checking.
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.
FlowInfo | an LSDFlowInfo object |
JN | the junction network object |
Junctions | The baselevel junctions to be printed |
base_filename | The name of the filename to print to (should have full path but no extension. The "_AllBasins" will be added |
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,.
FlowInfo | an LSDFlowInfo object |
filename | The name of the filename to print to (should have full path and the extension .csv |
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,.
FlowInfo | an LSDFlowInfo object |
filename | The name of the filename to print to (should have full path and the extension .csv |
basin_key | the basin key. |
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.
FlowInfo | an LSDFlowInfo object |
filename | The name of the filename to print to (should have full path and the extension .csv |
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.
FlowInfo | an LSDFlowInfo object |
filename | The name of the filename to print to (should have full path and the extension .csv |
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.
FlowInfo | an LSDFlowInfo object |
filename | The name of the filename to print to (should have full path and the extension .csv |
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
string | filename: the path/name.csv of your file |
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.
FlowInfo | an LSDFlowInfo object |
filename | The name of the filename to print to (should have full path and the extension .csv |
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.
FlowInfo | an LSDFlowInfo object |
filename | The name of the filename to print to (should have full path and the extension .csv |
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
string | filename the path name and extension of hte required file |
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.
FlowInfo | an LSDFlowInfo object |
file_prefix | THe path and name of file without extension |
start_movern | the starting m/n ratio |
delta_movern | the change in m/n |
n_novern | the number of m/n values to use |
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.
FlowInfo | an LSDFlowInfo object |
file_prefix | THe path and name of file without extension |
start_movern | the starting m/n ratio |
delta_movern | the change in m/n |
n_novern | the number of m/n values to use |
BurnRaster | the raster to burn to the csv |
column_name | the name of the column to which the data will be burned |
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.
FlowInfo | an LSDFlowInfo object |
file_prefix | THe path and name of file without extension |
start_movern | the starting m/n ratio |
delta_movern | the change in m/n |
n_novern | the number of m/n values to use |
Discharge | an LSDRaster of discharge |
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.
FlowInfo | an LSDFlowInfo object |
file_prefix | THe path and name of file without extension |
start_movern | the starting m/n ratio |
delta_movern | the change in m/n |
n_novern | the number of m/n values to use |
Discharge | an LSDRaster of discharge |
BurnRaster | the raster to burn to the csv |
column_name | the name of the column to which the data will be burned |
void LSDChiTools::print_raw_ksn_knickpoint | ( | LSDFlowInfo & | FlowInfo, |
string | filename | ||
) |
write a file with the raw knickpoint informations
FlowiInfo | a LSDFlowInfo object |
filename | string with path+name+.csv |
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.
SA_midpoint_node | the node index of the midpoints used in to caluclate slope |
SA_slope | The slope data |
filename | The name (including path and extension) of the file for printing |
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.
FlowInfo | an LSDFlowInfo object |
filename | The name of the filename to print to (should have full path and the extension .csv |
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.
reference_chi | the chi coordiantes of the reference channel |
reference_elevation | the elevations on the reference channel |
trib_chi | the chi coordiantes of the tributary channel |
trib_elevation | the elevations on the tributary channel |
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.
reference_chi | the chi coordiantes of the reference channel |
reference_elevation | the elevations on the reference channel |
trib_chi | the chi coordiantes of the tributary channel |
trib_elevation | the elevations on the tributary channel |
chi_distances_to_test | the distances upstream of the confluence on the tributary channel to test the residuals |
void LSDChiTools::reset_data_maps | ( | ) |
This resets all the data maps.
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.
FlowInfo | an LSDFlowInfo object |
only_use_mainstem_as_reference | If true, only use the mainstem as a reference channel |
test_channel | the source key of the test channel |
sigma | The uncertainty for the MLE calculation. In practice this simply scales MLE If you have many nodes this number needs to be large |
baselevel_key | The key to the basin you want |
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!
FlowInfo | an LSDFlowInfo object |
vertical_interval | the mean intervale over which slope is measured |
midpoint_nodes | The node indices of the places where slope is calculated. This is replaced in the function. |
Slopes | the slopes. This is replaced in the function. |
log_bin_width | The width of the bins (in log A) |
minimum_segment_length | Minimum segment length for segmentation algorithm |
filename | The name of the output file (with path and extension) |
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.
FlowInfo | an LSDFlowInfo object |
maximum_segment_length | is the longest a segment is allowed to be before a new segment is created |
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.
FlowInfo | an LSDFlowInfo object |
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.
FlowInfo | an LSDFlowInfo object |
maximum_segment_length | is the longest a segment is allowed to be before a new segment is created |
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.
Flowinfo,a | LSDFlowInfo object |
int | n_nodlump, the half lumping window |
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.
FlowInfo | |
path+name | of the file |
map | of map of litho obtain from a ChiTool.count_unique_values_from_litho_raster function for example |
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.
FlowInfo | an LSDFlowInfo object |
only_use_mainstem_as_reference | True if you only want to use the mainstem |
basin_key | The key into the basin you want to test all collinearity of. |
reference_source | integer vector replaced in function that has the reference vector for each comparison |
test_source | integer vector replaced in function that has the test vector for each comparison |
MLE_values | the MLE for each comparison. Replaced in function. |
RMSE_values | the RMSE for each comparison (i.e. between source 0 1, 0 2, 0 3, etc.). Replaced in function. |
sigma | The uncertainty for the MLE calculation. In practice this simply scales MLE If you have many nodes this number needs to be large |
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.
FlowInfo | an LSDFlowInfo object |
only_use_mainstem_as_reference | True if you only want to use the mainstem |
basin_key | The key into the basin you want to test all collinearity of. |
reference_source | integer vector replaced in function that has the reference vector for each comparison |
test_source | integer vector replaced in function that has the test vector for each comparison |
MLE_values | the MLE for each comparison. Replaced in function. |
RMSE_values | the RMSE for each comparison (i.e. between source 0 1, 0 2, 0 3, etc.). Replaced in function. |
sigma | The uncertainty for the MLE calculation. In practice this simply scales MLE |
chi_distances_to_test | The distances in chi space to test |
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.
FlowInfo | an LSDFlowInfo object |
basin_key | The key into the basin you want to test all collinearity of. |
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.
FlowInfo | an LSDFlowInfo object |
basin_key | The key into the basin you want to test all collinearity of. |
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.
FlowInfo | an LSDFlowInfo object |
reference_channel | the source key of the reference channel |
test_channel | the source key of the test channel |
sigma | The uncertainty for the MLE calculation. In practice this simply scales MLE If you have many nodes this number needs to be large |
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.
FlowInfo | an LSDFlowInfo object |
reference_channel | the source key of the reference channel |
test_channel | the source key of the test channel |
sigma | The 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_test | The distances in chi space to test |
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.
this_vec | vector of int containing the node index |
n_nodlump | the lumping half_window (number of nodes) |
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.
FlowInfo | An LSDFlowInfo object |
Chi_coordinate | LSDRaster of the chi coordinate |
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.
FlowInfo | An LSDFlowInfo object |
A_0 | the A_0 parameter: in metres^2 suggested value is 1 |
m_over_n | the m/n ratio |
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.
FlowInfo | An LSDFlowInfo object |
A_0 | the A_0 parameter: in metres^2 suggested value is 1 |
m_over_n | the m/n ratio |
mimum_contributing_pixels | This minimum number of contributing pixels needed before chi is calculated |
basin_key | the key to the basin you want |
outlet_node_from_basin_key_map | a 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() |
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.
FlowInfo | An LSDFlowInfo object |
A_0 | the A_0 parameter: in metres^2 suggested value is 1 |
m_over_n | the m/n ratio |
mimum_contributing_pixels | This minimum number of contributing pixels needed before chi is calculated |
basin_key | the key to the basin you want |
outlet_node_from_basin_key_map | a 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() |
Discharge | an LSDRaster of discharge |
|
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
|
protected |
This has as many elements as there are baselelvels. The key is the node index and the value is the baselevel key.
|
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.
|
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
|
protected |
A map that holds segment numbers: used with skip = 0. Can be used to map distinct segments
|
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.
|
protected |
In this map the key is the basin key and the value is the node of the baselevel source
|
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.