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

This code houses the LSDSwath object, used to make swath profiles. More...

#include <LSDSwathProfile.hpp>

Public Member Functions

 LSDSwath (PointData &ProfilePoints, LSDRaster &RasterTemplate, float HalfWidth)
 create an LSDSwath using a raster as a template. More...
 
 LSDSwath (vector< float > &Y_X_points, LSDRaster &RasterTemplate, float &HalfWidth, float d_space)
 create an LSDSwath using a raster as a template. More...
 
void get_transverse_swath_profile (LSDRaster &Raster, vector< float > desired_percentiles, float BinWidth, vector< float > &mid_points, vector< float > &mean_profile, vector< float > &sd_profile, vector< vector< float > > &output_percentile_profiles, int NormaliseToBaseline)
 This moves perpendicular to the swath and gets statisics from bins of distance from the swath you can tell it what widths you want and returns a series of swaths at the mean and then percentiles you want. More...
 
void get_longitudinal_swath_profile (LSDRaster &Raster, vector< float > desired_percentiles, float BinWidth, vector< float > &mid_points, vector< float > &mean_profile, vector< float > &sd_profile, vector< vector< float > > &output_percentile_profiles, int NormaliseToBaseline)
 This moves along the swath and gets statisics from bins of distance along the swath you can tell it what widths you want and returns a series of swaths at the mean and then percentiles you want. More...
 
LSDRaster get_raster_from_swath_profile (LSDRaster &Raster, int NormaliseToBaseline)
 create a raster in the shape of the swath profile More...
 
LSDRaster fill_in_channels_swath (LSDRaster &Raster)
 fill in the baseline raster value with the average value of the pixels along the transverse swath profile More...
 
vector< vector< float > > get_connected_components_along_swath (LSDIndexRaster &ConnectedComponents, LSDRaster &RasterTemplate, int NormaliseToBaseline)
 Get information about connected components along the swath profile. More...
 
vector< vector< float > > get_RasterValues_along_swath (LSDRaster &RasterTemplate, int NormaliseToBaseline)
 This function takes in a raster and returns the mean, min and max values of the raster at each point along the swath vector of vectors has the format: 0 = distance along swath 1 = mean value along swath 2 = min value along swath 3 = max value along swath if NormaliseToBaseline == 1 then the values will be normalised to the baseline. More...
 
void write_RasterValues_along_swath_to_csv (LSDRaster &RasterTemplate, int NormaliseToBaseline, string csv_filename)
 Wrapper to write raster values along swath to csv. More...
 
Array2D< float > get_BaselineDist_ConnectedComponents (LSDIndexRaster &ConnectedComponents)
 This function takes in a connected components raster and returns an array. More...
 
Array2D< float > get_DistanceToBaseline_ConnectedComponents (LSDIndexRaster &ConnectedComponents)
 This function takes in a connected components raster and returns an array of the distance to the baseline for each pixl in the raster. More...
 
vector< float > get_widths_along_swath (LSDIndexRaster &RasterForAnalysis)
 This function takes in a raster for analysis and gets the width of pixels in that raster. More...
 
void write_transverse_profile_to_file (LSDRaster &Raster, vector< float > desired_percentiles, float BinWidth, string prefix, int NormaliseToBaseline)
 
void write_longitudinal_profile_to_file (LSDRaster &Raster, vector< float > desired_percentiles, float BinWidth, string prefix, int NormaliseToBaseline)
 
void print_baseline_to_csv (LSDRaster &ElevationRaster, string csv_filename, LSDFlowInfo &FlowInfo, LSDRaster &DistanceFromOutlet)
 This prints the baseline to a csv file. More...
 
void get_locations_of_points_along_baseline (vector< float > distance_along_baseline)
 This finds locations of points along a baseline. More...
 
LSDRaster get_raster_DistanceToBaselineArray (LSDRaster &Raster)
 This prints the DistanceToBaselineArray to a raster. More...
 
LSDRaster get_raster_DistanceAlongBaselineArray (LSDRaster &Raster)
 This prints the DistanceAlongBaselineArray to a raster. More...
 
LSDRaster get_raster_BaselineValueArray (LSDRaster &Raster)
 This prints the BaselineValueArray to a raster. More...
 
int get_NPtsInProfile () const
 
Array2D< float > get_DistanceToBaselineArray () const
 
Array2D< float > get_DistanceAlongBaselineArray () const
 
Array2D< float > get_BaselineValueArray () const
 
vector< float > get_DistanceAlongBaseline () const
 
float get_XMax () const
 
float get_YMax () const
 
float get_XMin () const
 
float get_YMin () const
 
float get_ProfileHalfWidth () const
 
vector< int > get_BaselineCols () const
 
vector< int > get_BaselineRows () const
 
vector< float > get_BaselineValue () const
 

Protected Attributes

vector< float > DistanceAlongBaseline
 
vector< float > BaselineValue
 
vector< int > BaselineRows
 
vector< int > BaselineCols
 
Array2D< float > DistanceToBaselineArray
 
Array2D< float > DistanceAlongBaselineArray
 
Array2D< float > BaselineValueArray
 
int NPtsInProfile
 
float ProfileHalfWidth
 
float NoDataValue
 
int NRows
 
int NCols
 
float XMax
 
float XMin
 
float YMax
 
float YMin
 

Detailed Description

This code houses the LSDSwath object, used to make swath profiles.

Author
DTM
Date
17/02/14

Constructor & Destructor Documentation

LSDSwath::LSDSwath ( PointData ProfilePoints,
LSDRaster RasterTemplate,
float  HalfWidth 
)
inline

create an LSDSwath using a raster as a template.

Parameters
PointDataProfilePoints -> coordinates of points forming the baseline of the profile.
LSDRasterRasterTemplate -> a raster dataset that is used as a template for the swath profile i.e. any rasters that you wish to generate the profile for should have the same characteristics/spatial extent as the original template.
floatProfileHalfWidth
Author
DTM
Date
11/04/2014
LSDSwath::LSDSwath ( vector< float > &  Y_X_points,
LSDRaster RasterTemplate,
float &  HalfWidth,
float  d_space 
)
inline

create an LSDSwath using a raster as a template.

Parameters
vector<vector<float>>& Y_X_points -> coordinates of points forming the extremities of the baseline of the profile.
LSDRasterRasterTemplate -> a raster dataset that is used as a template for the swath profile i.e. any rasters that you wish to generate the profile for should have the same characteristics/spatial extent as the original template.
floatProfileHalfWidth
Author
DTM
Date
28/02/2017

Member Function Documentation

LSDRaster LSDSwath::fill_in_channels_swath ( LSDRaster Raster)

fill in the baseline raster value with the average value of the pixels along the transverse swath profile

Parameters
RasterRaster template
Returns
LSDRaster with filled in values along the baseline
Author
FJC
Date
16/01/17
Array2D< float > LSDSwath::get_BaselineDist_ConnectedComponents ( LSDIndexRaster ConnectedComponents)

This function takes in a connected components raster and returns an array.

Parameters
ConnectedComponentsconnected components raster
Returns
array with baseline components
Author
FJC
Date
28/09/17
vector< vector< float > > LSDSwath::get_connected_components_along_swath ( LSDIndexRaster ConnectedComponents,
LSDRaster RasterTemplate,
int  NormaliseToBaseline 
)

Get information about connected components along the swath profile.

This function takes in a connected components raster and returns the average value of another chosen raster and distance along the baseline of each connected components patch. The user can choose whether to normalise the second raster to the baseline value. vector of vectors has the format: 0 = patch ID 1 = mean raster value for the patch id 2 = mean distance along the baseline

Returns
vector of vector with patch ids, mean values, and distance along baseline
Author
FJC
Date
24/01/17
Array2D< float > LSDSwath::get_DistanceToBaseline_ConnectedComponents ( LSDIndexRaster ConnectedComponents)

This function takes in a connected components raster and returns an array of the distance to the baseline for each pixl in the raster.

Parameters
ConnectedComponentsconnected components raster
Returns
array with baseline components
Author
FJC
Date
12/10/17
void LSDSwath::get_locations_of_points_along_baseline ( vector< float >  distance_along_baseline)

This finds locations of points along a baseline.

Parameters
Avector of distances along the baseline
Author
SMM
Date
16/02/2018
void LSDSwath::get_longitudinal_swath_profile ( LSDRaster Raster,
vector< float >  desired_percentiles,
float  BinWidth,
vector< float > &  mid_points,
vector< float > &  mean_profile,
vector< float > &  sd_profile,
vector< vector< float > > &  output_percentile_profiles,
int  NormaliseToBaseline 
)

This moves along the swath and gets statisics from bins of distance along the swath you can tell it what widths you want and returns a series of swaths at the mean and then percentiles you want.

Parameters
RasterThe raster from which you extract data
desired_percentilesA float vector that contains the percentiles of the data you want to calculate for your output profiles
BinWidthThe width of each bin
mid_pointsA vector of the mid points, in terms of distance along, of the bins. This is overwritten during computation.
mean_profileA vector with the mean profile values. This is overwritten during computation.
sd_profileA vector with the standard deviation values. This is overwritten during computation.
output_percentile_profilesA vec vector where each vector is the profile at the precentile determined in the desired_percentiles vector. This is overwritten during computation.
NormaliseToBaseline0 if you want the raw data, 1 if you want the data normalised to the value at the baseline. In general 1 is used to see the value along the baseline relative to that baseline so good for looking at things like terraces along a river.
Author
DTM
Date
01/01/2015
LSDRaster LSDSwath::get_raster_BaselineValueArray ( LSDRaster Raster)

This prints the BaselineValueArray to a raster.

Parameters
Rastera raster to which the values will be printed to its geometry
Author
SMM
Date
16/02/2018
LSDRaster LSDSwath::get_raster_DistanceAlongBaselineArray ( LSDRaster Raster)

This prints the DistanceAlongBaselineArray to a raster.

Parameters
Rastera raster to which the values will be printed to its geometry
Author
SMM
Date
16/02/2018
LSDRaster LSDSwath::get_raster_DistanceToBaselineArray ( LSDRaster Raster)

This prints the DistanceToBaselineArray to a raster.

Parameters
Rastera raster to which the values will be printed to its geometry
Author
SMM
Date
16/02/2018
LSDRaster LSDSwath::get_raster_from_swath_profile ( LSDRaster Raster,
int  NormaliseToBaseline 
)

create a raster in the shape of the swath profile

Parameters
RasterLSDRaster of interest
NormaliseToBaselineif 0 –> raster values; if 1 –> raster values normalised to baseline value
Returns
raster in shape of swath profile
Author
FJC
Date
16/10/15
vector< vector< float > > LSDSwath::get_RasterValues_along_swath ( LSDRaster RasterTemplate,
int  NormaliseToBaseline 
)

This function takes in a raster and returns the mean, min and max values of the raster at each point along the swath vector of vectors has the format: 0 = distance along swath 1 = mean value along swath 2 = min value along swath 3 = max value along swath if NormaliseToBaseline == 1 then the values will be normalised to the baseline.

Returns
vector of vectors
Author
FJC
Date
15/02/17
void LSDSwath::get_transverse_swath_profile ( LSDRaster Raster,
vector< float >  desired_percentiles,
float  BinWidth,
vector< float > &  mid_points,
vector< float > &  mean_profile,
vector< float > &  sd_profile,
vector< vector< float > > &  output_percentile_profiles,
int  NormaliseToBaseline 
)

This moves perpendicular to the swath and gets statisics from bins of distance from the swath you can tell it what widths you want and returns a series of swaths at the mean and then percentiles you want.

Parameters
RasterThe raster from which you extract data
desired_percentilesA float vector that contains the percentiles of the data you want to calculate for your output profiles
BinWidthThe width of each bin
mid_pointsA vector of the mid points, in terms of distance along, of the bins. This is overwritten during computation.
mean_profileA vector with the mean profile values. This is overwritten during computation.
sd_profileA vector with the standard deviation values. This is overwritten during computation.
output_percentile_profilesA vec vector where each vector is the profile at the precentile determined in the desired_percentiles vector. This is overwritten during computation.
NormaliseToBaseline0 if you want the raw data, 1 if you want the data normalised to the value at the baseline.
Author
DTM
Date
01/01/2015
vector< float > LSDSwath::get_widths_along_swath ( LSDIndexRaster RasterForAnalysis)

This function takes in a raster for analysis and gets the width of pixels in that raster.

Parameters
RasterForAnalysisanalysis index raster
Returns
vector with widths along baseline
Author
FJC
Date
21/11/17
void LSDSwath::print_baseline_to_csv ( LSDRaster ElevationRaster,
string  csv_filename,
LSDFlowInfo FlowInfo,
LSDRaster DistanceFromOutlet 
)

This prints the baseline to a csv file.

Parameters
ElevationRasterthe raster
csv_filenameThe name of the file out
Author
FJC
Date
12/10/17
void LSDSwath::write_RasterValues_along_swath_to_csv ( LSDRaster RasterTemplate,
int  NormaliseToBaseline,
string  csv_filename 
)

Wrapper to write raster values along swath to csv.

Parameters
RasterTemplateraster of values to write
NormaliseToBaselineint, if 1 then will be noramlised to the baseline value. if 0 then you just get the raw underlying data
csv_filenamefile name of output csv
Author
FJC
Date
20/11/17

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