This object inherets from LSDIndexChannel and is used for chi analysis. More...
#include <LSDChannel.hpp>
Public Member Functions | |
LSDChannel () | |
Defualt constructor. Just makes an empty channel. More... | |
LSDChannel (LSDIndexChannel &InChann) | |
Creates an LSDChannel by copying from an IndexChannel. More... | |
LSDChannel (int StartNode, int EndNode, LSDFlowInfo &FlowInfo) | |
Creates an index channel with just the node index of the starting and ending nodes. More... | |
LSDChannel (int StartJunction, int StartNode, int EndJunction, int EndNode, LSDFlowInfo &FlowInfo) | |
Creates an index channel with just the node index of the starting and ending nodes also includes junction information. More... | |
LSDChannel (int StartNode, int EndNode, float downslope_chi, float m_over_n, float A_0, LSDFlowInfo &FlowInfo, LSDRaster &Elevation_Raster) | |
This calculates all the channel areas, elevations and chi parameters based on for a starting node index and ending node index. More... | |
LSDChannel (int StartNode, int EndNode, float downslope_chi, float m_over_n, float A_0, LSDFlowInfo &FlowInfo, LSDRaster &Elevation_Raster, LSDRaster &DA) | |
This calculates all the channel areas, elevations and chi parameters based on for a starting node index and ending node index. More... | |
LSDChannel (float downslope_chi, float m_over_n, float A_0, LSDIndexChannel &InChann, LSDFlowInfo &FlowInfo, LSDRaster &Elevation_Raster) | |
This calculates all the channel areas, elevations and chi parameters based on for a given LSDChannelIndex. More... | |
LSDIndexRaster | print_channel_to_IndexRaster (LSDFlowInfo &FlowInfo) |
This function prints the channel to an LSDIndexRaster. More... | |
vector< float > | get_Chi () |
vector< float > | get_Elevation () |
void | calculate_chi (float downslope_chi, float m_over_n, float A_0, LSDFlowInfo &FlowInfo) |
This function uses a flow info object to calculate the chi values in the channel. More... | |
void | calculate_chi (float downslope_chi, float m_over_n, float A_0, LSDRaster &FlowAccum, LSDFlowInfo &FlowInfo) |
This function uses a flow info as well as a flow accumulation object. More... | |
float | retrieve_chi_at_channel_node (int ch_node) |
Get chi value at channel node. More... | |
void | retrieve_node_information (int ch_node, float &elev, float &chi, float &drainarea) |
Get node chi value, elevation and drainage area. More... | |
void | find_most_likeley_segments (int minimum_segment_length, float sigma, int target_nodes, vector< float > &b_vec, vector< float > &m_vec, vector< float > &r2_vec, vector< float > &DW_vec, vector< float > &thinned_chi, vector< float > &thinned_elev, vector< float > &fitted_elev, vector< int > &node_ref_thinned, vector< int > &these_segment_lengths, float &this_MLE, int &this_n_segments, int &n_data_nodes, float &this_AIC, float &this_AICc) |
This function looks for the most likeley segments. More... | |
void | find_best_fit_m_over_n_with_segments (int n_movern, float d_movern, float start_movern, float downslope_chi, float A_0, LSDFlowInfo &FlowInfo, int minimum_segment_length, float sigma, float target_nodes) |
This function looks for the best fit of a channel for a range of m_over_n values where the channel has segments. More... | |
void | find_best_fit_m_over_n_with_segments () |
This function loops through m_over_n looking for best fit segments. | |
int | calculate_channel_heads (int min_seg_length_for_channel_heads, float A_0, float m_over_n, LSDFlowInfo &FlowInfo) |
This functions calculates channel heads based on chi segment fitting. More... | |
void | write_channel_to_csv (string path, string filename, LSDRaster &flow_dist) |
This function writes the channel to a csv file. More... | |
Public Member Functions inherited from LSDIndexChannel | |
LSDIndexChannel () | |
The create function. This is default and throws an error. | |
LSDIndexChannel (int StartNode, int EndNode, LSDFlowInfo &FlowInfo) | |
Create LSDIndexChannel object between a start and end node. More... | |
LSDIndexChannel (int StartJunction, int StartNode, int EndJunction, int EndNode, LSDFlowInfo &FlowInfo) | |
Create LSDIndexChannel object between starting junction and node and ending junction and node. More... | |
LSDIndexChannel (vector< float > &X_coords, vector< float > &Y_coords, LSDFlowInfo &FlowInfo, float threshold_area, float threshold_distance) | |
int | get_StartJunction () const |
int | get_EndJunction () const |
int | get_StartNode () const |
int | get_EndNode () const |
int | get_NRows () const |
int | get_NCols () const |
float | get_XMinimum () const |
float | get_YMinimum () const |
float | get_DataResolution () const |
int | get_NoDataValue () const |
map< string, string > | get_GeoReferencingStrings () const |
vector< int > | get_RowSequence () const |
vector< int > | get_ColSequence () const |
vector< int > | get_NodeSequence () const |
int | get_n_nodes_in_channel () const |
void | get_row_column_of_end_node (LSDFlowInfo &FlowInfo, int &row, int &col) |
gets the row and column of the end node More... | |
int | get_node_in_channel (int n_node) |
This gets the node index at a given node in the index channel. More... | |
void | truncate_final_node () |
This removes the final node in a channel. More... | |
int | get_contributing_pixels_at_node (int n_node, LSDFlowInfo &FlowInfo) |
Get the number of contributing pixels at a given node in the channel. More... | |
void | get_node_row_col_in_channel (int n_node, int &node, int &row, int &col) |
This gets the node, row, and column index. More... | |
int | get_contributing_pixels_at_outlet (LSDFlowInfo &FlowInfo) |
This gets the contriubting pixels at the outlet of the channel. More... | |
int | get_contributing_pixels_at_penultimate_node (LSDFlowInfo &FlowInfo) |
Gets the pixels at the penultimate node. More... | |
LSDIndexRaster | print_index_channel_to_index_raster () |
void | append_index_channel_to_index_raster (LSDIndexRaster &old_raster) |
This function appends a channel onto an existing LSDIndexRaster. More... | |
void | get_coordinates_of_channel_nodes (vector< double > &X_coordinates, vector< double > &Y_coordinates, LSDFlowInfo &FlowInfo) |
Function to get vectors with the X and Y coordinates of nodes in the channel. More... | |
void | get_coordinates_of_channel_nodes (vector< float > &X_coordinates, vector< float > &Y_coordinates) |
Function to get vectors with the X and Y coordinates of nodes in the channel. More... | |
void | write_channel_to_csv (string path, string filename) |
Function to get write index channel to csv. More... | |
void | write_channel_to_csv (string path, string filename, LSDFlowInfo &FlowInfo, LSDRaster &FlowDistance, LSDRaster &Elevation) |
Function to get write index channel to csv Similar to above but mimics code in other objects to ensure you get the same channels. More... | |
Protected Attributes | |
vector< float > | Elevation |
Elevation vector. | |
vector< float > | Chi |
Chi vector. | |
vector< float > | DrainageArea |
Drainage area vector. | |
Protected Attributes inherited from LSDIndexChannel | |
int | NRows |
Number of rows. | |
int | NCols |
Number of columns. | |
float | XMinimum |
Minimum X coordinate. | |
float | YMinimum |
Minimum Y coordinate. | |
float | DataResolution |
Data resolution. | |
int | NoDataValue |
No data value. | |
map< string, string > | GeoReferencingStrings |
A map of strings for holding georeferencing information. | |
int | StartJunction |
The starting junction (numbered within LSDJunctionNetwork object). | |
int | StartNode |
The node index of the starting Junction (numbered in the FlowInfo object). | |
int | EndJunction |
The ending junction (numbered within LSDJunctionNetwork object). | |
int | EndNode |
The node index of the ending Junction (numbered in the FlowInfo object). | |
vector< int > | RowSequence |
Vector of row indices. | |
vector< int > | ColSequence |
Vector of column indices. | |
vector< int > | NodeSequence |
Vector of node indices. | |
This object inherets from LSDIndexChannel and is used for chi analysis.
|
inline |
Defualt constructor. Just makes an empty channel.
|
inline |
Creates an LSDChannel by copying from an IndexChannel.
The starting node is upstream and the ending node is downstream. In this create function the junction indices are left blank (this can describe a channel between two arbitraty points.
InChann | LSDIndexChannel object. |
|
inline |
Creates an index channel with just the node index of the starting and ending nodes.
The starting node is upstream and the ending node is downstream. In this create function the junction indices are left blank (this can describe a channel between two arbitraty points.
StartNode | Starting node. |
EndNode | Ending node. |
FlowInfo | LSDFlowInfo object. |
|
inline |
Creates an index channel with just the node index of the starting and ending nodes also includes junction information.
The starting node is upstream and the ending node is downstream. In this create function the junction indices are left blank (this can describe a channel between two arbitraty points.
StartJunction | Starting junction. |
StartNode | Starting node. |
EndJunction | Ending junction. |
EndNode | Ending node. |
FlowInfo | LSDFlowInfo object. |
|
inline |
This calculates all the channel areas, elevations and chi parameters based on for a starting node index and ending node index.
StartNode | Starting node. |
EndNode | Ending node. |
downslope_chi | Downslope Chi value. |
m_over_n | m over n ratio. |
A_0 | A_0 value. |
FlowInfo | LSDFlowInfo object. |
Elevation_Raster | Elevation LSDRaster object. |
|
inline |
This calculates all the channel areas, elevations and chi parameters based on for a starting node index and ending node index.
StartNode | Starting node. |
EndNode | Ending node. |
downslope_chi | Downslope Chi value. |
m_over_n | m over n ratio. |
A_0 | A_0 value. |
FlowInfo | LSDFlowInfo object. |
Elevation_Raster | Elevation LSDRaster object. |
DA_raster | Drainage area raster LSDRaster object |
|
inline |
This calculates all the channel areas, elevations and chi parameters based on for a given LSDChannelIndex.
downslope_chi | Downslope Chi value. |
m_over_n | m over n ratio. |
A_0 | A_0 value. |
InChann | LSDIndexChannel object. |
FlowInfo | LSDFlowInfo object. |
Elevation_Raster | Elevation LSDRaster object. |
int LSDChannel::calculate_channel_heads | ( | int | min_seg_length_for_channel_heads, |
float | A_0, | ||
float | m_over_n, | ||
LSDFlowInfo & | FlowInfo | ||
) |
This functions calculates channel heads based on chi segment fitting.
min_seg_length_for_channel_heads | |
A_0 | |
m_over_n | |
FlowInfo |
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Calculate channel head locations using chi segment fitting.
Fitting segments to the chi-elevation data of the main stem. We assume that the profile is made up of 2 segments in chi-space: a linear channel segment and a non-linear hillslope segment. We loop through the possible combinations of segment lengths, performing a linear regression to calculate the r^2 and DW of each segment length. We then calculate a test value: r^2 of the channel segment - ((DW of the hillslope segment - 2)/2). This value will vary between 0 and 1. The maximum test_value will give the best fit channel and hillslope segments. Need to get the best fit m_over_n value first. Parameters: min_seg_length_for_channel_heads (length used for fitting segments to the chi- elevation profile, a value of 10 is suggested), A_0, m over n, FlowInfo. Return value: integer with the node index of the channel head location. FC 25/09/2013
void LSDChannel::calculate_chi | ( | float | downslope_chi, |
float | m_over_n, | ||
float | A_0, | ||
LSDFlowInfo & | FlowInfo | ||
) |
This function uses a flow info object to calculate the chi values in the channel.
downslope_chi | Downslope Chi value. |
m_over_n | m over n ratio. |
A_0 | A_0 value. |
FlowInfo | LSDFlowInfo object. |
void LSDChannel::calculate_chi | ( | float | downslope_chi, |
float | m_over_n, | ||
float | A_0, | ||
LSDRaster & | FlowAccum, | ||
LSDFlowInfo & | FlowInfo | ||
) |
This function uses a flow info as well as a flow accumulation object.
to calculate the chi values in the channel.
downslope_chi | Downslope Chi value. |
m_over_n | m over n ratio. |
A_0 | A_0 value. |
FlowAccum | a raster of flow acucmulation. Usually this will be a drainage area but in some cases it will be discharge so orographic effects can be determined |
FlowInfo | LSDFlowInfo object. |
void LSDChannel::find_best_fit_m_over_n_with_segments | ( | int | n_movern, |
float | d_movern, | ||
float | start_movern, | ||
float | downslope_chi, | ||
float | A_0, | ||
LSDFlowInfo & | FlowInfo, | ||
int | minimum_segment_length, | ||
float | sigma, | ||
float | target_nodes | ||
) |
This function looks for the best fit of a channel for a range of m_over_n values where the channel has segments.
n_movern | |
d_movern | |
start_movern | |
downslope_chi | Downslope Chi value. |
A_0 | A_0 value. |
FlowInfo | LSDFlowInfo object. |
minimum_segment_length | |
sigma | Sigma value. |
target_nodes |
void LSDChannel::find_most_likeley_segments | ( | int | minimum_segment_length, |
float | sigma, | ||
int | target_nodes, | ||
vector< float > & | b_vec, | ||
vector< float > & | m_vec, | ||
vector< float > & | r2_vec, | ||
vector< float > & | DW_vec, | ||
vector< float > & | thinned_chi, | ||
vector< float > & | thinned_elev, | ||
vector< float > & | fitted_elev, | ||
vector< int > & | node_ref_thinned, | ||
vector< int > & | these_segment_lengths, | ||
float & | this_MLE, | ||
int & | this_n_segments, | ||
int & | n_data_nodes, | ||
float & | this_AIC, | ||
float & | this_AICc | ||
) |
This function looks for the most likeley segments.
minimum_segment_length | |
sigma | Sigma value. |
target_nodes | |
b_vec | Vector of b values. |
m_vec | Vector of m values. |
r2_vec | Vector of r-squared values. |
DW_vec | Vector of Durbin-Watson values. |
thinned_chi | |
thinned_elev | |
fitted_elev | |
node_ref_thinned | |
these_segment_lengths | |
this_MLE | |
this_n_segments | |
n_data_nodes | |
this_AIC | |
this_AICc |
|
inline |
|
inline |
LSDIndexRaster LSDChannel::print_channel_to_IndexRaster | ( | LSDFlowInfo & | FlowInfo | ) |
This function prints the channel to an LSDIndexRaster.
|
inline |
Get chi value at channel node.
ch_node | Integer node index. |
|
inline |
Get node chi value, elevation and drainage area.
ch_node | Integer node index. |
elev | Elevation data. |
chi | Chi Value |
drainarea | Drainage area. |
void LSDChannel::write_channel_to_csv | ( | string | path, |
string | filename, | ||
LSDRaster & | flow_dist | ||
) |
This function writes the channel to a csv file.
filename | the filename of the channel (whithout the .csv) |