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

This object inherets from LSDIndexChannel and is used for chi analysis. More...

#include <LSDChannel.hpp>

Inheritance diagram for LSDChannel:
LSDIndexChannel

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.
 

Detailed Description

This object inherets from LSDIndexChannel and is used for chi analysis.

Constructor & Destructor Documentation

LSDChannel::LSDChannel ( )
inline

Defualt constructor. Just makes an empty channel.

Author
SMM
Date
24/09/14
LSDChannel::LSDChannel ( LSDIndexChannel InChann)
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.

Parameters
InChannLSDIndexChannel object.
Author
SMM
Date
01/01/12
LSDChannel::LSDChannel ( int  StartNode,
int  EndNode,
LSDFlowInfo FlowInfo 
)
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.

Parameters
StartNodeStarting node.
EndNodeEnding node.
FlowInfoLSDFlowInfo object.
Author
SMM
Date
01/01/12
LSDChannel::LSDChannel ( int  StartJunction,
int  StartNode,
int  EndJunction,
int  EndNode,
LSDFlowInfo FlowInfo 
)
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.

Parameters
StartJunctionStarting junction.
StartNodeStarting node.
EndJunctionEnding junction.
EndNodeEnding node.
FlowInfoLSDFlowInfo object.
Author
SMM
Date
01/01/12
LSDChannel::LSDChannel ( int  StartNode,
int  EndNode,
float  downslope_chi,
float  m_over_n,
float  A_0,
LSDFlowInfo FlowInfo,
LSDRaster Elevation_Raster 
)
inline

This calculates all the channel areas, elevations and chi parameters based on for a starting node index and ending node index.

Parameters
StartNodeStarting node.
EndNodeEnding node.
downslope_chiDownslope Chi value.
m_over_nm over n ratio.
A_0A_0 value.
FlowInfoLSDFlowInfo object.
Elevation_RasterElevation LSDRaster object.
Author
SMM
Date
01/01/12
LSDChannel::LSDChannel ( int  StartNode,
int  EndNode,
float  downslope_chi,
float  m_over_n,
float  A_0,
LSDFlowInfo FlowInfo,
LSDRaster Elevation_Raster,
LSDRaster DA 
)
inline

This calculates all the channel areas, elevations and chi parameters based on for a starting node index and ending node index.

Parameters
StartNodeStarting node.
EndNodeEnding node.
downslope_chiDownslope Chi value.
m_over_nm over n ratio.
A_0A_0 value.
FlowInfoLSDFlowInfo object.
Elevation_RasterElevation LSDRaster object.
DA_rasterDrainage area raster LSDRaster object
Author
SMM
Date
01/01/12
LSDChannel::LSDChannel ( float  downslope_chi,
float  m_over_n,
float  A_0,
LSDIndexChannel InChann,
LSDFlowInfo FlowInfo,
LSDRaster Elevation_Raster 
)
inline

This calculates all the channel areas, elevations and chi parameters based on for a given LSDChannelIndex.

Parameters
downslope_chiDownslope Chi value.
m_over_nm over n ratio.
A_0A_0 value.
InChannLSDIndexChannel object.
FlowInfoLSDFlowInfo object.
Elevation_RasterElevation LSDRaster object.
Author
SMM
Date
01/01/12

Member Function Documentation

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.

Parameters
min_seg_length_for_channel_heads
A_0
m_over_n
FlowInfo
Author
FC
Date
25/09/13

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= 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.

Parameters
downslope_chiDownslope Chi value.
m_over_nm over n ratio.
A_0A_0 value.
FlowInfoLSDFlowInfo object.
Author
SMM
Date
01/01/12
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.

Parameters
downslope_chiDownslope Chi value.
m_over_nm over n ratio.
A_0A_0 value.
FlowAccuma 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
FlowInfoLSDFlowInfo object.
Author
SMM
Date
24/09/14
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.

Parameters
n_movern
d_movern
start_movern
downslope_chiDownslope Chi value.
A_0A_0 value.
FlowInfoLSDFlowInfo object.
minimum_segment_length
sigmaSigma value.
target_nodes
Author
SMM
Date
01/01/13
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.

Parameters
minimum_segment_length
sigmaSigma value.
target_nodes
b_vecVector of b values.
m_vecVector of m values.
r2_vecVector of r-squared values.
DW_vecVector 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
Author
SMM
Date
01/01/13
vector<float> LSDChannel::get_Chi ( )
inline
Returns
Vector of chi values.
vector<float> LSDChannel::get_Elevation ( )
inline
Returns
Vector of elevation values.
LSDIndexRaster LSDChannel::print_channel_to_IndexRaster ( LSDFlowInfo FlowInfo)

This function prints the channel to an LSDIndexRaster.

Returns
Index raster of channel nodes
Author
FJC
Date
21/08/15
float LSDChannel::retrieve_chi_at_channel_node ( int  ch_node)
inline

Get chi value at channel node.

Parameters
ch_nodeInteger node index.
Returns
chi value at channel node.
Author
SMM
Date
01/01/12
void LSDChannel::retrieve_node_information ( int  ch_node,
float &  elev,
float &  chi,
float &  drainarea 
)
inline

Get node chi value, elevation and drainage area.

Parameters
ch_nodeInteger node index.
elevElevation data.
chiChi Value
drainareaDrainage area.
Author
SMM
Date
01/01/12
void LSDChannel::write_channel_to_csv ( string  path,
string  filename,
LSDRaster flow_dist 
)

This function writes the channel to a csv file.

Parameters
filenamethe filename of the channel (whithout the .csv)
Author
SMM
Date
24/09/14

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