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

Create model objects to use LSDRaster methods on synthetic landscapes. More...

#include <LSDRasterModel.hpp>

Inheritance diagram for LSDRasterModel:
LSDRasterSpectral LSDRaster LSDModelDriver

Public Member Functions

 LSDRasterModel ()
 Constructor. Create a deafult LSDRasterModel (100x100) More...
 
 LSDRasterModel (string master_param)
 Constructor. Create a LSDRasterModel from a parameter file. More...
 
 LSDRasterModel (string filename, string extension)
 Constructor. Create an LSDRasterModel from a file. Uses a filename and file extension. More...
 
 LSDRasterModel (int nrows, int ncols, float xmin, float ymin, float cellsize, float ndv, Array2D< float > data)
 Constructor. Create an LSDRasterModel from memory. More...
 
 LSDRasterModel (LSDRaster &An_LSDRaster)
 Constructor. Create an LSDRasterModel from an LSDRaster. More...
 
 LSDRasterModel (int NRows, int NCols)
 Constructor. Create a blank raster nodel. More...
 
 ~LSDRasterModel (void)
 Class destructor.
 
LSDRasterModeloperator= (const LSDRasterModel &LSDR)
 operator assignment
 
LSDRaster return_as_raster ()
 This just returns the raster model object data as a raster. More...
 
void initialize_model (string &parameter_file, string &run_name, float &dt, float &EndTime, float &PrintInterval, float &k_w, float &b, float &m, float &n, float &K, float &ErosionThreshold, float &K_nl, float &S_c, float &UpliftRate, float &PrecipitationRate, float &NorthBoundaryElevation, float &SouthBoundaryElevation, Array2D< float > &PrecipitationFlux, Array2D< float > &SlopesBetweenRows, Array2D< float > &SlopesBetweenColumns, Array2D< float > &ErosionRate)
 this initialises the model by directly #ting the data members
 
void initialize_model (string parameter_file)
 This module initialises the model runs, calling the required function from the initial topography and loads the parameters from the parameter file. More...
 
void initialise_model ()
 This module initialises the model using the maps that have been read in from the parameter file via the param file parser function. More...
 
void append_run_name (string append_name)
 this appends a string to the run name can be used to append parameters to run names More...
 
void random_surface_noise (float min, float max)
 Adds random noise to each pixel in range [min, max]. More...
 
void random_surface_noise ()
 Adds random noise to each pixel using the noise data member. More...
 
void initialise_parabolic_surface (float peak_elev, float edge_offset)
 This resets the RasterData array to have a parabolic shape, with 0 elevation at the N and S boundaries. It also adds some random noise to the topography. The amplitude of this noise is set by the data member 'noise'. The default noise is 1mm. More...
 
void superimpose_parabolic_surface (float peak_elev)
 Adds a parabolic surface to the DEM. Used to try and avoid ;arge areas of fill from the fractal initiation steps. More...
 
void intialise_fourier_fractal_surface (float fractal_D)
 This initialises the raster model to a square model domain with a fractal surface using the algorithm from Saupe (1987d) More...
 
void intialise_fourier_fractal_surface_v2 (float beta, float desired_relief)
 This initialises the raster model to a square model domain with a fractal surface using the algorithm from the LSDRasterModel. More...
 
void intialise_diamond_square_fractal_surface (int feature_order, float desired_relief)
 This initialises the raster model to a fractal surface using the diamond square algorithm. More...
 
void initialise_taper_edges_and_raise_raster (int rows_to_taper)
 This takes a raster and tapers the edges to zero elevation. Its purpose is to remove edge artefacts. More...
 
void raise_and_fill_raster ()
 this raises the raster so the lowest point is zero and also fills the raster More...
 
void initialise_nonlinear_SS (float U)
 This initialises a surface with a hillslope that is the solution to the nonlinear sediment flux equation. It overwrites RasterData. More...
 
void resize_and_reset (int new_rows, int new_cols)
 This resizes the LSDRasterModel, resetting some flags in the process, as well as setting many of the Array2D data members to be empty arrays The raster data in the end is a random surface (determined by the noise data member) More...
 
void resize_and_reset (int new_rows, int new_cols, float new_resolution)
 This resizes the LSDRasterModel, resetting some flags in the process, as well as setting many of the Array2D data members to be empty arrays The raster data in the end is a random surface (determined by the noise data member) This overloaded version also changes the data resolution. More...
 
void add_path_to_names (string pathname)
 this ads a pathname to the default names More...
 
void check_steady_state (void)
 This function checks to see if the model has achieved steady state. The nature of steady state checked is set by the cycle_steady_check flag If this is false, it checks if there is simple steady state (the surface elevations do not change in time) If the cycle_steady_check is true, it check if steady state has been achieved from one cycle to another. More...
 
void check_recording (void)
 This function checks to see if the model should record results If initial steady state has not been reached, recording is set to false: that is, the model does not record information on the build up to steady state. More...
 
bool check_end_condition (void)
 This checks on the ending condition of the model run endTime_mode: 1 == The end time is just some fixed time after initial steady state 2 == The end time is after a fixed number of cycles 3 == The time is after steady state, but waits for a fixed number of cycles before ending. More...
 
void check_periodicity_switch (void)
 This function checks to see if this is a periodic run. If it is, it sets the times to align with the period Note this only realy comes into play if period mode == 2 or 4 period_mode means 1 (default) one periodicity used without 2 Two periodicities that switch at a given interval 3 Two periodicities used as a compound sin wave 4 Same as three, but weightings switch at a given interval (as in 2) More...
 
bool check_if_hung (void)
 If the periodic model cycles over 100 times this returns true. More...
 
void reset_model (void)
 Reset model - reset erosion values to 0 after a complete model run. More...
 
LSDRasterModel create_buffered_surf (int b_type)
 This first function is used as a simple way to implement boundary conditions, particularly no flux and periodic boundary conditions. The buffered surface has NRows+2 rows and NCols+2 columns. The integer b_type sets the type of boundary conditions, but currently there is only one implementation: no flux across N and S; periodic for E and W. More...
 
LSDRasterModel create_buffered_surf (float South_boundary_elevation, float North_boundary_elevation)
 This second version has periodic boundaries at E and W boundaries, and Neumann boundary conditions (prescribed elevations) at the N and S boundaries. More...
 
bool is_base_level (int i, int j)
 Check whether current node is a base level node. More...
 
void interpret_boundary (short &dimension, bool &periodic, int &size)
 not sure what this does yet (SMM)
 
float find_max_boundary (int boundary_number)
 Gets the maxium elevation along a boundary. More...
 
Array2D< float > calculate_erosion_rates (void)
 Simple function that creates an array with the erosion rates for a given timestep. It doesn't do anything with NoData cells, and for cells with data it calls the get_erosion_at_cell member function updated to catch instances when zeta_old has not been calculated. More...
 
float get_erosion_at_cell (int row, int col)
 This calculates the erosion rate for individual cells. Currently it assumes that the zeta_old data member is from the previous timestep. More...
 
float get_total_erosion_rate_over_timestep ()
 this calcualtes the total erosion over a timester More...
 
Array2D< float > precip_array_from_precip_rate (float precip_rate)
 
void get_slopes (Array2D< float > &SlopesBetweenRows, Array2D< float > &SlopesBetweenCols)
 
Array2D< float > get_topographic_divergence ()
 
float calculate_channel_width_wolman (float Q_w, float k_w, float b)
 
Array2D< float > array_channel_width_wolman (Array2D< float > &Q_w, float &k_w, float &b)
 
Array2D< float > calculate_fluvial_erosion_rate (Array2D< float > ChannelWidth, Array2D< float > Q_w, Array2D< float > TopoDivergence, float K, float n, float m, float eros_thresh)
 
void calculate_k_values_for_assembly_matrix (int NRows, int NCols, vector< int > &k_value_i_j, vector< int > &k_value_ip1_j, vector< int > &k_value_im1_j, vector< int > &k_value_i_jp1, vector< int > &k_value_i_jm1)
 
void mtl_initiate_assembler_matrix (int &problem_dimension, float &inv_dx_S_c_squared, float &inv_dy_S_c_squared, float &dx_front_term, float &dy_front_term, vector< int > &vec_k_value_i_j, vector< int > &vec_k_value_ip1_j, vector< int > &vec_k_value_im1_j, vector< int > &vec_k_value_i_jp1, vector< int > &vec_k_value_i_jm1)
 mtl_initiate_assembler_matrix
 
void mtl_assemble_matrix (Array2D< float > &zeta_last_iter, Array2D< float > &zeta_last_timestep, Array2D< float > &zeta_this_iter, Array2D< float > &uplift_rate, Array2D< float > &fluvial_erosion_rate, mtl::compressed2D< float > &mtl_Assembly_matrix, mtl::dense_vector< float > &mtl_b_vector, float dt, int problem_dimension, float inv_dx_S_c_squared, float inv_dy_S_c_squared, float dx_front_term, float dy_front_term, float South_boundary_elevation, float North_boundary_elevation, vector< int > &vec_k_value_i_j, vector< int > &vec_k_value_ip1_j, vector< int > &vec_k_value_im1_j, vector< int > &vec_k_value_i_jp1, vector< int > &vec_k_value_i_jm1)
 
void mtl_solve_assembler_matrix (Array2D< float > &zeta_last_iter, Array2D< float > &zeta_last_timestep, Array2D< float > &zeta_this_iter, Array2D< float > &uplift_rate, Array2D< float > &fluvial_erosion_rate, float dt, int problem_dimension, float inv_dx_S_c_squared, float inv_dy_S_c_squared, float dx_front_term, float dy_front_term, vector< int > &vec_k_value_i_j, vector< int > &vec_k_value_ip1_j, vector< int > &vec_k_value_im1_j, vector< int > &vec_k_value_i_jp1, std::vector< int > &vec_k_value_i_jm1, float South_boundary_elevation, float North_boundary_elevation)
 
void nonlinear_creep_timestep (Array2D< float > &fluvial_erosion_rate, float iteration_tolerance, int problem_dimension, float inv_dx_S_c_squared, float inv_dy_S_c_squared, float dx_front_term, float dy_front_term, vector< int > &vec_k_value_i_j, vector< int > &vec_k_value_ip1_j, vector< int > &vec_k_value_im1_j, vector< int > &vec_k_value_i_jp1, vector< int > &vec_k_value_i_jm1, float South_boundary_elevation, float North_boundary_elevation)
 
void soil_diffusion_fv (void)
 
mtl::compressed2D< float > generate_fd_matrix (int dimension, int size, bool periodic)
 
mtl::dense_vector< float > build_fd_vector (int dimension, int size)
 
mtl::compressed2D< float > generate_fv_matrix (int dimension, int size, bool periodic)
 
mtl::dense_vector< float > build_fv_vector (int dimension, int size)
 
void repack_vector (mtl::dense_vector< float > &data_vector, int dimension)
 
void soil_diffusion_fd_linear (void)
 
void soil_diffusion_fv_nonlinear (void)
 
LSDRasterModel run_model_implicit_hillslope_and_fluvial (string param_file)
 
void run_model (void)
 This wrapper just calls the run_components method. Parameters used are those stored as data members. More...
 
void run_model_from_steady_state (void)
 This loads a steady state raster from the data members so that a model can be run repeatedly from the same steady state condition. More...
 
void run_components (void)
 This wrapper just calls the run_components method. Parameters used are those stored as data members. This one actually calls the erosion laws. More...
 
void run_components_combined (void)
 This is a wrapper similar to run_components but sends the fluvial and uplfit fields to the nonlinear solver. More...
 
void run_components_combined (LSDRaster &URaster, LSDRaster &KRaster, bool use_adaptive_timestep)
 This is a wrapper similar to run_components but sends the fluvial and uplfit fields to the nonlinear solver. Variable U and K rasters can be used. More...
 
void run_components_combined_cell_tracker (vector< LSDParticleColumn > &CRNColumns, vector< LSDParticleColumn > &eroded_cells, int startType, double startDepth, double particle_spacing, LSDCRNParameters &CRNParam)
 This is a wrapper that runs the model but includes CRN columns fluvial and uplfit fields to the nonlinear solver. More...
 
vector< LSDParticleColumninitiate_steady_CRN_columns (int column_spacing, vector< int > &CRNcol_rows, vector< int > &CRNcol_cols, double rho_r, double this_U, int startType, double startDepth, double particle_spacing, LSDCRNParameters &CRNParam)
 This initiates a vector of CRN columns that sit under the model. More...
 
void reach_steady_state (void)
 This method forces the landscape into its steady state profile, by using periodic forcing. This is much more efficient than using static forcing (as in run model), but doesn't give a nice animation of an evolving landscape Swings and roundabouts. More...
 
void fluvial_snap_to_steady_state (float U)
 This method creates a steady landscape that assumes everywhere obeys the stream power law. It is based on equation 4a from Mudd et al 2014 JGR-ES There is no return but the underlying raster data will reflect the analytical steady topography for the uplift rate. More...
 
float fluvial_snap_to_steady_state_tune_K_for_relief (float U, float desired_relief)
 This method creates a steady landscape that assumes everywhere obeys the stream power law. It is based on equation 4a from Mudd et al 2014 JGR-ES. The function is given a target relief and the K value is adjusted to match this target relief at the maximum chi value. In addition to the return, the underlying raster data will reflect the analytical steady topography for the uplift rate. More...
 
float fluvial_calculate_K_for_steady_state_relief (float U, float desired_relief)
 This method calcualtes the fluvial K required to generate the desired relief at steady state for the farthest upstream chi. It is based on equation 4a from Mudd et al 2014 JGR-ES. This does not update aything in the model, but simply returns the desired K. More...
 
void fluvial_incision (void)
 Fastscape, implicit finite difference solver for stream power equations O(n) Method takes its paramaters from the model data members and solves the stream power equation at a future timestep in linear time. More...
 
void fluvial_incision_with_uplift (void)
 Fastscape, implicit finite difference solver for stream power equations O(n) Method takes its paramaters from the model data members and solves the stream power equation at a future timestep in linear time This version includes the current uplift, so you do not need to call uplift after this has finished. More...
 
void fluvial_incision_with_uplift_and_variable_K (LSDRaster &K_raster)
 Fastscape, implicit finite difference solver for stream power equations O(n) Method takes the K value from a raster fed to it and solves the stream power equation at a future timestep in linear time This version includes the current uplift, so you do not need to call uplift after this has finished. More...
 
void fluvial_incision_with_variable_uplift_and_variable_K (LSDRaster &Uplift_rate, LSDRaster &K_raster)
 Fastscape, implicit finite difference solver for stream power equations O(n) Method takes the K value from a raster fed to it and also take a raster of the uplift rates and solves the stream power equation at a future timestep in linear time This version includes the current uplift, so you do not need to call uplift after this has finished. More...
 
void fluvial_incision_with_variable_uplift_and_variable_K_adaptive_timestep (LSDRaster &Uplift_rate, LSDRaster &K_raster)
 Fastscape, implicit finite difference solver for stream power equations O(n) Method takes the K value from a raster fed to it and also take a raster of the uplift rates and solves the stream power equation at a future timestep in linear time This version includes the current uplift, so you do not need to call uplift after this has finished. Uses an adaptive timestep. More...
 
LSDRaster fluvial_erosion_rate (float timestep, float K, float m, float n, vector< string > boundary)
 This function is more or less identical to fluvial_incision above, but it Returns a raster with the erosion rate and takes arguments rather than reading from data members. More...
 
Array2D< float > fluvial_erosion_rate (void)
 This function is more or less identical to fluvial_incision above, but it Returns an array and takes arguments rather reads from data members. More...
 
void wash_out (void)
 This assumes that all sediment transported from rivers into channels is removed. It checks the raster to see where the channels are which at this point is determined by a threshold drainage area, and then removes all the sediment to those pixels. More...
 
Array2D< float > generate_uplift_field (int mode, float max_uplift)
 Creates uplift field from a set of templates. More...
 
Array2D< float > generate_uplift_field (void)
 Creates uplift field from a set of templates, parameters are taken from data members. More...
 
float get_uplift_at_cell (int i, int j)
 Gets the uplift value at a given cell this method is implemented as a memory saving measure, rather than storing the uplift field in memory Some methods still implemented still use this uplift field It's advisable this is changed, otherwise the size of rasters that can be modelled will be severely reduced. More...
 
float get_uplift_rate_at_cell (int i, int j)
 Gets the uplift rate at a given cell this method is implemented as a memory saving measure, rather than storing the uplift field in memory Some methods still implemented still use this uplift field It's advisable this is changed, otherwise the size of rasters that can be modelled will be severely reduced. More...
 
void check_and_correct_uplift_field ()
 This checks to see if the uplift field is consistent with the raster dimensions. If not it corrects the dimensions of the uplift field. More...
 
float get_average_upflit_rate_last_timestep ()
 this calcualtes the average uplfit rate over the entire model domain, excluding the N and S boundaries More...
 
LSDRasterModel uplift_surface (float UpliftRate, float dt)
 Apply uplift field to the raster. Overloaded function so that the first simply considers uniform uplift, the second allows user to use a prescribed uplift fields of greater complexity, for example taking account of fault geometry. More...
 
LSDRasterModel uplift_surface (Array2D< float > UpliftRate, float dt)
 Uplift surface using specified uplift field uplift field should be specified as an array with the same dimensions as the elevation raster, permitting non-uniform uplift fields to be applied in the model. More...
 
void uplift_surface (void)
 Intrinsic method of uplifting the Raster Uplift field attribute is incremented onto RasterData itself There are no parameters, but rather it simply passes upflift to the get upflift at cell function. More...
 
float get_max_uplift (void)
 This just returns the max_uplift data member NOTE; while this is currently a very trivial, and arguably unecessary method, it should be used and developed if someone wants to integrate some sort of changing uplift field. More...
 
void set_uplift_field_to_block_uplift (float uplift_rate)
 This function sets the uplift_field data member as bolck uplift with a rate of uplift_rate. More...
 
LSDRasterModel run_isostatic_correction (void)
 
void Airy_isostasy (void)
 
void flexural_isostasy (float alpha)
 
void flexural_isostasy_alt (void)
 
void write_root (string name, string ext)
 
Array2D< float > calculate_root (void)
 
Array2D< float > calculate_airy (void)
 
void set_boundary_conditions (vector< string > bc)
 this sets the boundary conditions
 
void print_boundary_conditions_to_screen ()
 
void set_timeStep (float dt)
 set the time step
 
void set_maxtimeStep (float max_dt)
 set the maximum time step
 
void set_endTime (float time)
 set the ending time
 
void set_num_runs (int num)
 set the number of runs. Used for running multiple simulations from the same starting conditions
 
void set_uplift_mode (int new_uplift_mode)
 sets the uplift mode
 
void set_uplift (Array2D< float > uplift)
 overloaded function, set the array of uplift
 
void set_uplift (int mode, float max_rate)
 overloaded function, set the array of uplift, but using the uplift mode More...
 
void set_periodic_uplift (double uplift_amplitude_fraction)
 This adjusts the uplift mode.
 
void set_uplift_amplitude (double uplift_amplitude_fraction)
 This sets the uplift amplitude as a fraction of the uplift.
 
void set_baseline_uplift (float new_rate)
 this sets the baseline uplift rate for the tilt block
 
void set_steady_state_tolerance (float tol)
 set the tolerance for determining steady state
 
void set_noise (float noise_amp)
 set the amplitude of random noise
 
void set_K (float K)
 sets fluvial erodibility
 
void set_D (float D)
 sets the hillslope diffusivity
 
void set_rigidity (float D)
 set the flexural rigidity
 
void set_m (float m)
 sets the Area exponent in the SPIM
 
void set_n (float n)
 sets the slope exponent in the SPIM
 
void set_threshold_drainage (float area)
 sets the critical drainage area for channels
 
void set_S_c (float Sc_new)
 Sets the critical slope.
 
void set_periodicity (float time)
 Sets the periodicity in years.
 
void set_periodicity_2 (float time)
 Sets the 2nd periodicity in years.
 
void snap_periodicity (void)
 this snaps the periodicity to the timestep to ensure the max and min values of a varying parameter are reached
 
void set_print_interval (int num_steps)
 set the print interval
 
void set_float_print_interval (float float_dt_print)
 set the float print interval
 
void set_next_printing_time (float next_float_dt_print)
 set the float print interval
 
void set_K_mode (short mode)
 this sets the K mode More...
 
void set_D_mode (short mode)
 this sets the D mode More...
 
void set_period_mode (short mode)
 This sets the way the periodicity is calculated. More...
 
void set_name (string name)
 set the name of the model run
 
void set_report_name (string name)
 set the name of the report
 
void set_current_frame (int new_frame)
 set current frame, this is used for printing
 
void force_initial_steady_state ()
 this just sets the initial steady state to true so that the periodic functions can be run from a starting DEM It also forces the time delay ans switch delay so periodic functions start straight away
 
void set_fluvial (bool on_status)
 set the fluvial switch More...
 
void set_hillslope (bool on_status)
 set the hillslop switch More...
 
void set_nonlinear (bool on_status)
 set the hillslop linear or nonlinear switch More...
 
void set_isostasy (bool on_status)
 set the isostacy switch More...
 
void set_flexure (bool on_status)
 set the flexure switch More...
 
void set_quiet (bool on_status)
 set the quiet switch More...
 
void set_print_elevation (bool do_I_print_elevation)
 Sets the print elevation. More...
 
void set_print_hillshade (bool do_I_print_hillshade)
 Sets the print hillshade. More...
 
void set_print_erosion (bool do_I_print_erosion)
 Sets the print erosion. More...
 
string get_name (void)
 gets the name of the model run from the data members More...
 
float get_K (void)
 This function gets the fluvial erodability. It has a number of switches that determine how K is calcualted. K_mode == 1 sine wave K_mode == 2 square wave K_mode == 3 read from file K_mode: default is constant value. More...
 
float get_D (void)
 This function gets the soil transport coefficient erodability. It has a number of switches that determine how D is calculated. D_mode == 1 sine wave D_mode == 2 square wave D_mode == 3 read from file D_mode: default is constant value. More...
 
float get_m (void)
 Gets the area exponent. More...
 
float get_n (void)
 Gets the slope exponent. More...
 
float get_current_time (void)
 this gets the current_time
 
float get_endTime (void)
 this gets the endTime
 
float get_timeStep (void)
 Gets the timestep.
 
float get_maxtimeStep (void)
 Gets the maximum timestep.
 
int get_current_frame (void)
 this gets the current frame for printing
 
int get_uplift_mode (void)
 gets the uplift mode
 
void write_report (void)
 This method calculates some features of the landscape at set times. The frequency of the reports are set by the data member report_delay One of the things it does is calculates erosion rates, and stores this as a data member. More...
 
void print_parameters (void)
 this prints parameters to screen More...
 
void cycle_report (float, float, float)
 this prints a file about what has happened over a cycle More...
 
void final_report (void)
 this prints a final report (SMML not sure what is in the final report) More...
 
void print_rasters (int frame_num)
 This function prints a series of rasters. The rasters printed depend on the switches print_elevation, print_erosion, print_erosion_cycle, print_hillshade; and print_slope_area The filename inculdes the frame_num. More...
 
void print_rasters_and_csv (int frame)
 This function prints a series of rasters. The rasters printed depend on the switches print_elevation, print_erosion, print_erosion_cycle, print_hillshade; and print_slope_area The filename inculdes the frame_num It also prints a csv of the model info which can be ingested by pandas for visualisation. More...
 
void print_average_erosion_and_apparent_erosion (int frame, vector< LSDParticleColumn > &CRNColumns, LSDCRNParameters &CRNParams)
 This function prints the apparent cosmogenic rates from a collection of LSDParticle Columns This function opens a file if none exists. More...
 
void print_column_erosion_and_apparent_erosion (int frame, vector< LSDParticleColumn > &CRNColumns, LSDCRNParameters &CRNParams)
 This function prints the apparent cosmogenic rates from individual LSDParticle Columns This function opens a file if none exists. More...
 
void close_static_outfiles ()
 This function closes some static outfiles used for printing. More...
 
void slope_area_data (string name)
 Print slope area data Probably fits better into LSDRaster, but requires LSDFlowInfo. More...
 
void slope_area_data (string name, int slope_flag, int area_flag)
 Print slope area data This is an overloaded function that calcualtes slope area data based on flags. There are two flag, one for the slope calculation and one for the area calculation. More...
 
void make_template_param_file (string filename)
 Produce a template of a parameter file to be supplied to the model. More...
 
void MuddPILE_initiate_assembler_matrix (void)
 this initiates some parameters for the assembler matrix it is required before running any further calculations for the nonlinear solver More...
 
void MuddPILE_calculate_k_values_for_assembly_matrix (void)
 this initiates some parameters for the assembler matrix it is required before running any further calculations for the nonlinear solver More...
 
void MuddPILE_assemble_matrix (Array2D< float > &uplift_rate, Array2D< float > &fluvial_erosion_rate, mtl::compressed2D< float > &mtl_Assembly_matrix, mtl::dense_vector< float > &mtl_b_vector)
 this assembles the sparse matrix that must then be solved to get the next iteration of the hillslope elevations More...
 
void MuddPILE_solve_assembler_matrix (Array2D< float > &uplift_rate, Array2D< float > &fluvial_erosion_rate)
 this function solves the assembled matrix for the nonlinear hillslope sediment flux law. The implementation calls MuddPILE_assemble_matrix. More...
 
void MuddPILE_nonlinear_creep_timestep (Array2D< float > &uplift_rate, Array2D< float > &fluvial_erosion_rate, float iteration_tolerance)
 This runs one timestep of the nonlinear sediment flux law It replaces the data in RasterData. More...
 
void MuddPILE_nl_soil_diffusion_nouplift ()
 This version of the MuddPILE nonlinear solver does not include uplift and uses a default iteration tolerance of 1e-7. It is built to integrate with JAJ's 'run_components' module. More...
 
- Public Member Functions inherited from LSDRasterSpectral
 LSDRasterSpectral (string filename, string extension)
 Create an LSDRasterSpectral from a file. Uses a filename and file extension. More...
 
 LSDRasterSpectral (int nrows, int ncols, float xmin, float ymin, float cellsize, float ndv, Array2D< float > data)
 Create an LSDRasterSpectral from memory. More...
 
 LSDRasterSpectral (LSDRaster &An_LSDRaster)
 Create an LSDRasterSpectral from an LSDRaster object. More...
 
 LSDRasterSpectral (int raster_order, float cellsize, float ndv)
 Create an LSDRasterSpectral object that has dimensions 2^raster_order. More...
 
LSDRasterSpectraloperator= (const LSDRasterSpectral &LSDR)
 Assignment operator.
 
vector< float > get_row_direction_frequencies_unshifted ()
 This returns the frequency values of an UNSHIFTED DFT along the rows. More...
 
vector< float > get_col_direction_frequencies_unshifted ()
 This returns the frequency values of an UNSHIFTED DFT along the columns. More...
 
Array2D< float > get_frequency_scaling_array (float beta)
 This calucaltes a scaling array for scaling an unshifted DFT by the factor 1/f^beta. More...
 
void generate_fractal_surface_spectral_method (float beta)
 This creates a fractal surface using the spectral method. More...
 
void generate_fractal_surface_spectral_method (float beta, float desired_relief)
 This creates a fractal surface using the spectral method. More...
 
void find_rollover_frequency (float &rollover_frequency, float &rollover_beta, float &sub_rollover_beta, float log_bin_width)
 FINDS ROLLOVER FREQUENCY. More...
 
void calculate_background_spectrum (float rollover_frequency, float beta, float log_bin_width, int N_iterations, int window_option=0)
 CALCULATE BACKGROUND SPECTRUM. More...
 
void dfftw2D_fwd (Array2D< float > &InputArray, Array2D< float > &OutputArrayReal, Array2D< float > &OutputArrayImaginary, int transform_direction)
 Computes the forward fast fourier transform of a 2D discrete dataset. More...
 
void dfftw2D_inv (Array2D< float > &InputArrayReal, Array2D< float > &InputArrayImaginary, Array2D< float > &OutputArray, int transform_direction)
 Computes the inverse fast fourier transform of a 2D discrete dataset. More...
 
void dfftw2D_inv_complex (Array2D< complex< float > > &InputArrayComplex, Array2D< float > &OutputArray, int transform_direction)
 Computes the inverse fast fourier transform of a 2D discrete dataset. More...
 
void detrend2D (Array2D< float > &zeta, Array2D< float > &zeta_detrend, Array2D< float > &trend_plane)
 Detrend Data. More...
 
void window_data_Hann2D (Array2D< float > &zeta_detrend, Array2D< float > &zeta_Hann2D, Array2D< float > &Hann2D)
 Hann Window Module. More...
 
void window_data_Hamming2D (Array2D< float > &zeta_detrend, Array2D< float > &zeta_Hamming2D, Array2D< float > &Hamming2D)
 Hamming Window Module. More...
 
void window_data (Array2D< float > &input, Array2D< float > &output, Array2D< float > &window, int window_option=0)
 -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=REDUNDANT=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- More...
 
void shift_spectrum (Array2D< float > &spectrum_real, Array2D< float > &spectrum_imaginary, Array2D< float > &spectrum_real_shift, Array2D< float > &spectrum_imaginary_shift)
 SHIFT ORIGIN OF SPECTRUM IN FOURIER DOMAIN. More...
 
void shift_spectrum (Array2D< float > &spectrum_real, Array2D< float > &spectrum_imaginary)
 SHIFT ORIGIN OF SPECTRUM IN FOURIER DOMAIN. More...
 
void shift_spectrum_inv (Array2D< float > &FilteredSpectrumReal, Array2D< float > &FilteredSpectrumImaginary, Array2D< float > &FilteredSpectrumReal_deshift, Array2D< float > &FilteredSpectrumImaginary_deshift)
 DE-SHIFT ORIGIN OF SPECTRUM. More...
 
void shift_spectrum_inv (Array2D< float > &spectrum_real, Array2D< float > &spectrum_imaginary)
 DE-SHIFT ORIGIN OF SPECTRUM. More...
 
void calculate_2D_PSD (Array2D< float > &spectrum_real_shift, Array2D< float > &spectrum_imaginary_shift)
 CALCULATE THE DFT PERIODOGRAM. More...
 
void scale_spectrum (Array2D< float > SpectrumReal, Array2D< float > SpectrumIm, float beta)
 SCALE SPECTRUM. More...
 
void calculate_radial_PSD ()
 GET RADIAL POWER SPECTRUM. More...
 
void fftw2D_spectral_analysis (char *file_id, float LogBinWidth)
 COMPUTE DISCRETE FAST FOURIER TRANSFORM OF A REAL, 2-DIMENSIONAL DATASET. More...
 
void full_spectral_analysis (float log_bin_width, int N_iterations, int window_option=0)
 FULL SPECTRAL ANALYSIS. More...
 
void bandpass_filter (Array2D< float > &RawSpectrumReal, Array2D< float > &RawSpectrumImaginary, Array2D< float > &FilteredSpectrumReal, Array2D< float > &FilteredSpectrumImaginary, float f1, float f2)
 BANDPASS FILTER. More...
 
void lowpass_filter (Array2D< float > &RawSpectrumReal, Array2D< float > &RawSpectrumImaginary, Array2D< float > &FilteredSpectrumReal, Array2D< float > &FilteredSpectrumImaginary, float f1, float f2)
 LOWPASS FILTER. More...
 
void lowpass_filter_remainder (Array2D< float > &RawSpectrumReal, Array2D< float > &RawSpectrumImaginary, Array2D< float > &FilteredSpectrumReal, Array2D< float > &FilteredSpectrumImaginary, float f1, float f2)
 LOWPASS FILTER REMAINDER. More...
 
void highpass_filter (Array2D< float > &RawSpectrumReal, Array2D< float > &RawSpectrumImaginary, Array2D< float > &FilteredSpectrumReal, Array2D< float > &FilteredSpectrumImaginary, float f1, float f2)
 HIGHPASS FILTER. More...
 
void highpass_filter_remainder (Array2D< float > &RawSpectrumReal, Array2D< float > &RawSpectrumImaginary, Array2D< float > &FilteredSpectrumReal, Array2D< float > &FilteredSpectrumImaginary, float f1, float f2)
 HIGHPASS FILTER REMAINDER. More...
 
void wiener_filter (Array2D< float > &RawSpectrumReal, Array2D< float > &RawSpectrumImaginary, Array2D< float > &FilteredSpectrumReal, Array2D< float > &FilteredSpectrumImaginary)
 WIENER FILTER. More...
 
LSDRaster fftw2D_filter (int FilterType, float FLow, float FHigh)
 FAST FOURIER TRANSFORM FILTER FOR A REAL, 2-DIMENSIONAL DATASET. More...
 
LSDRaster fftw2D_wiener ()
 WIENER FILTER FOR A REAL, 2-DIMENSIONAL DATASET. More...
 
void print_radial_spectrum (string file_id)
 
void print_binned_spectrum (string output_id, float log_bin_width)
 
LSDIndexRaster IsolateChannelsWienerQQ (float area_threshold, float window_radius, string q_q_filename)
 method to locate channel pixels adapted from Pelletier (2013). More...
 
LSDIndexRaster IsolateChannelsWienerQQAdaptive (float area_threshold, float window_radius, string q_q_filename)
 
- Public Member Functions inherited from LSDRaster
 LSDRaster ()
 The create function. This is default and throws an error.
 
 LSDRaster (string filename, string extension)
 Create an LSDRaster from a file. Uses a filename and file extension. More...
 
 LSDRaster (int nrows, int ncols, float xmin, float ymin, float cellsize, float ndv, Array2D< float > data)
 Create an LSDRaster from memory. More...
 
 LSDRaster (int nrows, int ncols, double xmin, double ymin, double cellsize, double ndv, Array2D< double > data)
 Create an LSDRaster from memory, with the elvation data stored as double precision floats. More...
 
 LSDRaster (int nrows, int ncols, float xmin, float ymin, float cellsize, float ndv, Array2D< float > data, map< string, string > temp_GRS)
 Create an LSDRaster from memory, includes georeferencing. More...
 
int get_NRows () const
 
int get_NCols () const
 
float get_XMinimum () const
 
float get_YMinimum () const
 
float get_DataResolution () const
 
int get_NoDataValue () const
 
Array2D< float > get_RasterData () const
 
Array2D< double > get_RasterData_dbl () const
 Get the raw raster data, double format. More...
 
Array2D< int > get_RasterData_int () const
 Get the raw raster data, integer format. More...
 
map< string, string > get_GeoReferencingStrings () const
 
float get_data_element (int row, int column)
 Get the raster data at a specified location. More...
 
void set_data_element (int row, int column, float value)
 Sets the raster data at a specified location. More...
 
LSDRasteroperator= (const LSDRaster &LSDR)
 Assignment operator.
 
void read_raster (string filename, string extension)
 Read a raster into memory from a file. More...
 
TNT::Array2D< double > get_ascii_raster (string FILENAME)
 Reads a raster from an ascii file for use in LSDCatchmentModel. More...
 
void read_ascii_raster (string FILENAME)
 
void read_ascii_raster_integers (string FILENAME)
 Reads a raster of integers and populates LSDRaster integer array member data. More...
 
void write_raster (string filename, string extension)
 Read a raster from memory to a file. More...
 
void write_double_raster (string filename, string extension)
 This calls raster write functions, writing from Arrays of type <double> to raster format. More...
 
void write_double_asc_raster (string string_filename)
 Writes out a double array to an ascii.
 
void write_double_flt_raster (string filename, string string_filename)
 Writes out a double array to a binary flt file.
 
void write_double_bil_raster (string filename, string string_filename)
 Writes out a double array to a ENVI bil file (untested!) More...
 
bool does_raster_have_same_dimensions (LSDRaster &Compare_raster)
 Checks to see if two rasters have the same dimensions Does NOT check georeferencing. More...
 
bool does_raster_have_same_dimensions (LSDIndexRaster &Compare_raster)
 Checks to see if two rasters have the same dimensions Does NOT check georeferencing. More...
 
bool does_raster_have_same_dimensions_and_georeferencing (LSDRaster &Compare_raster)
 Checks to see if two rasters have the same georeferencing. More...
 
bool does_raster_have_same_dimensions_and_georeferencing (LSDIndexRaster &Compare_raster)
 Checks to see if two rasters have the same georeferencing. More...
 
map< string, string > Update_GeoReferencingStrings (float NewXmin, float NewYmax)
 Method which takes a new xmin and ymax value and modifys the GeoReferencingStrings map_info line to contain these new values. More...
 
void Update_GeoReferencingStrings ()
 Method which updates the map info element of the georeferencing strings based on information within the datamembers of the raster. More...
 
void impose_georeferencing_UTM (int zone, string NorS)
 This method imposes georefereing strings assuming the coordinate system is UTM. More...
 
int Find_UTM_central_meridian (int UTM_zone)
 This method looks up the central meridian given a UTM zone. 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 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 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_easting_and_northing_vectors (vector< float > &Eastings, vector< float > &Northings)
 This returns vectors of all the easting and northing points in the raster Used for interpolations. More...
 
vector< float > interpolate_points_bilinear (vector< float > UTMEvec, vector< float > UTMNvec)
 This interpolates a vector of points onto the raster. Uses bilinear interpolation. More...
 
LSDRaster fill_with_interpolated_data (vector< int > rows_of_nodes, vector< int > cols_of_nodes, vector< float > interpolated_data)
 This fills a raster with precalculated interpolated data. More...
 
float get_value_of_point (float UTME, float UTMN)
 This gets the value at a point in UTM coordinates. More...
 
bool check_if_point_is_in_raster (float X_coordinate, float Y_coordinate)
 this check to see if a point is within the raster More...
 
void get_row_and_col_of_a_point (float X_coordinate, float Y_coordinate, int &row, int &col)
 Gets the row and column of a point in the raster. More...
 
vector< float > get_XY_MinMax ()
 This function returns a vector with the X adn Y minimum and max values. More...
 
vector< float > get_RasterData_vector ()
 This function returns the raster data as a vector. More...
 
vector< float > get_RasterData_vector_No_NDVs ()
 This function returns the raster data as a vector, ignoring NDVs. More...
 
void write_RasterData_to_text_file (string filename)
 This function returns the raster data as text file. More...
 
void rewrite_with_random_values (float range)
 rewrite all the data array values with random numbers (with a uniform distribution). More...
 
LSDRaster create_raster_nodata ()
 Create a raster in of the same number of rows and cols with nodata. More...
 
LSDRaster RasterTrimmer ()
 Calculate the minimum bounding rectangle for an LSDRaster Object and crop out all the surrounding NoDataValues to reduce the size and load times of output rasters. More...
 
LSDRaster RasterTrimmerPadded (int padded_pixels)
 Calculate the minimum bounding rectangle for an LSDRaster Object and crop out all the surrounding NoDataValues to reduce the size and load times of output rasters. Similar to RasterTrimmer but has a pixel buffer. Useful for CRN data since sometimes the channel in the DEM does not correspond exactly with the data point. More...
 
LSDRaster RasterTrimmerSpiral ()
 Takes a raster and trims nodata from around the edges to result in a rectangular LSDRaster. More...
 
LSDRaster clip_to_smaller_raster (LSDRaster &smaller_raster)
 This returns a clipped raster that has the same dimensions as the smaller raster. More...
 
LSDRaster clip_to_smaller_raster (LSDIndexRaster &smaller_raster)
 This returns a clipped raster that has the same dimensions as the smaller raster. More...
 
LSDRaster LSDRasterTemplate (Array2D< float > InputData)
 Make LSDRaster object using a 'template' raster and an Array2D of data. More...
 
void strip_raster_padding ()
 Strips the edge rows/columns of a LSDRaster on each side of the array. More...
 
LSDRaster BufferRasterData (float window_radius)
 Buffers a raster using a circular kernel of a user-defined radius (m) More...
 
LSDRaster calculate_relief (float kernelWidth, int kernelType)
 Calculates a relief raster. More...
 
float mean_elevation (void)
 Calculates mean elevation of a raster. More...
 
float max_elevation (void)
 Calculates max elevation of a raster. More...
 
float mean_relief (float kernelsize)
 Calculates mean relief of a raster, it defaults to a circular kernal. More...
 
float difference_rasters (LSDRaster &compare_raster)
 Calculates the mean difference between two rasters. More...
 
void raster_multiplier (float multiplier)
 This multiplies the raster data by a multiplier Note that values are replaced. More...
 
LSDRaster MapAlgebra_multiply (LSDRaster &M_raster)
 This multiplies two rasters, elementwise Simple elementwise multiplictation. More...
 
LSDRaster MapAlgebra_divide (LSDRaster &M_raster)
 This divides two rasters, elementwise Simple elementwise division. More...
 
LSDRaster MapAlgebra_add (LSDRaster &M_raster)
 This add two rasters, elementwise Simple elementwise addition. More...
 
LSDRaster MapAlgebra_subtract (LSDRaster &M_raster)
 This subtracts two rasters, elementwise Simple elementwise subtraction. More...
 
float WrapSample (int row, int col)
 This returns a value from the array data element but wraps around the array dimensions so that row > NRows (for example) returns a value. More...
 
void SetWrapSample (int row, int col, float value)
 This sets a value in the data array withthe added feature that it wraps beyond NRows and NCols. More...
 
void DSSetFeatureCorners (int featuresize, float scale)
 This sets the corners of features as the first step in the diamond square algorithm. More...
 
void DSSampleSquare (int row, int col, int size, float value)
 This is the square sampling step of the diamond square algorithm: it takes the average of the four corners and adds a random number to set the centrepoint of a square. More...
 
void DSSampleDiamond (int row, int col, int size, float value)
 This is the diamond sampling step of the diamond square algorithm: it takes the average of the four corners and adds a random number to set the centrepoint of a diamond. More...
 
void DiamondSquare_SampleStep (int stepsize, float scale)
 This is the sampling function for the diamond square algorithm: it runs both a diamond and a square sampling for each step. More...
 
LSDRaster DiamondSquare (int feature_order, float scale)
 This is the driving function for the diamond square algorithm. More...
 
LSDRaster hillshade ()
 This function generates a hillshade raster. More...
 
LSDRaster hillshade (float altitude, float azimuth, float z_factor)
 
Array2D< float > Shadow (int theta, int phi)
 This function generates a hillshade derivative raster using the algorithm outlined in Codilean (2006). More...
 
LSDRaster CastShadows (int Azimuth, int ZenithAngle)
 Function to determine areas of a DEM that are in shadow from a given radiation source defined by an Azimuth and Zenith following Codilean (2006). More...
 
Array2D< float > Shadows (int Azimuth, int ZenithAngle)
 Function to determine areas of a DEM that are in shadow from a given radiation source defined by an Azimuth and Zenith following Codilean (2006). More...
 
LSDRaster TopographicShielding (int theta_step, int phi_step)
 This function generates a topographic shielding raster using the algorithm outlined in Codilean (2006). More...
 
LSDRaster TopographicShielding ()
 
vector< LSDRastercalculate_polyfit_surface_metrics (float window_radius, vector< int > raster_selection)
 Surface polynomial fitting and extraction of topographic metrics. More...
 
vector< LSDRastercalculate_polyfit_roughness_metrics (float window_radius1, float window_radius2, vector< int > raster_selection)
 Surface polynomial fitting and extraction of roughness metrics. More...
 
void calculate_polyfit_coefficient_matrices (float window_radius, Array2D< float > &a, Array2D< float > &b, Array2D< float > &c, Array2D< float > &d, Array2D< float > &e, Array2D< float > &f)
 This function calculates 6 coefficient matrices that allow the user to then calcualte slope, curvature, aspect, a classification for finding saddles and peaks and other metrics. More...
 
LSDRaster calculate_polyfit_elevation (Array2D< float > &f)
 This function calculates the elevation based on a polynomial fit. More...
 
LSDRaster calculate_polyfit_slope (Array2D< float > &d, Array2D< float > &e)
 This function calculates the slope based on a polynomial fit. More...
 
LSDRaster calculate_polyfit_aspect (Array2D< float > &d, Array2D< float > &e)
 This function calculates the aspect based on a polynomial fit. More...
 
LSDRaster calculate_polyfit_curvature (Array2D< float > &a, Array2D< float > &b)
 This function calculates the curvature based on a polynomial fit. More...
 
LSDRaster calculate_polyfit_planform_curvature (Array2D< float > &a, Array2D< float > &b, Array2D< float > &c, Array2D< float > &d, Array2D< float > &e)
 This function calculates the planform curvature based on a polynomial fit. More...
 
LSDRaster calculate_polyfit_profile_curvature (Array2D< float > &a, Array2D< float > &b, Array2D< float > &c, Array2D< float > &d, Array2D< float > &e)
 This function calculates the profile curvature based on a polynomial fit. More...
 
LSDRaster calculate_polyfit_tangential_curvature (Array2D< float > &a, Array2D< float > &b, Array2D< float > &c, Array2D< float > &d, Array2D< float > &e)
 This function calculates the tangential curvature based on a polynomial fit. More...
 
LSDIndexRaster calculate_polyfit_classification (Array2D< float > &a, Array2D< float > &b, Array2D< float > &c, Array2D< float > &d, Array2D< float > &e)
 This function identifies approximate position of stationary points within discrete surface using a threshold slope. More...
 
LSDRaster get_hilltop_curvature (LSDRaster &curvature, LSDRaster &Hilltops)
 Gets the hilltop curvature raster. More...
 
LSDRaster remove_positive_hilltop_curvature (LSDRaster &hilltop_curvature)
 Removes positive hilltop curvature values. More...
 
void remove_positive_values ()
 Removes positive values from a raster. More...
 
float get_percentage_bedrock_ridgetops (LSDRaster &roughness, LSDRaster &hilltop_curvature, float threshold)
 Gets the percentage of bedrock ridges. More...
 
LSDRaster calculate_slope_angles ()
 Calculates slope angle in radians. Needs the slope raster. More...
 
LSDRaster calculate_water_supply_rate_for_saturation (float soil_thick, float K, LSDRaster &ContributingArea, LSDRaster &SlopeAngle)
 Calculates the water supply rate required for saturation of the hillslope soil. More...
 
LSDRaster calculate_factor_of_safety_at_saturation (float C_r, float rho_s, float soil_thick, float tan_phi, LSDRaster &SlopeAngle)
 This calculates the factor of safety if the soil is completely saturated. More...
 
void calculate_polyfit_directional_cosines (Array2D< float > &d, Array2D< float > &e, Array2D< float > &l, Array2D< float > &m, Array2D< float > &n)
 Algorithm that assesses surface roughness based on a polynomial fit. More...
 
void calculate_orientation_matrix_eigenvalues (float window_radius, Array2D< float > &l, Array2D< float > &m, Array2D< float > &n, Array2D< float > &s1, Array2D< float > &s2, Array2D< float > &s3)
 Find eigenvalues for orientation matrix. More...
 
void calculate_plane_coefficient_matrices (float window_radius, Array2D< float > &a_plane, Array2D< float > &b_plane, Array2D< float > &c_plane)
 This function is a wrapper to get the three roughness eigenvalues s1, s2 and s3. More...
 
LSDRaster calculate_REI (Array2D< float > &a_plane, Array2D< float > &b_plane, float CriticalSlope)
 Create the REI raster. More...
 
LSDRaster calculate_REI (float window_radius, float CriticalSlope)
 Create the REI raster (imporoved wrapper) Rock exposure index defined as areas with local slope exceeding some critical slope as defined by DiBiase et al. (2012) More...
 
void calculate_and_print_polyfit_rasters (float window_radius, string file_prefix, vector< int > file_list)
 this function takes the polyfit functions and requires a window radius and a vector telling the function which rasters to print to file. More...
 
void calculate_and_print_polyfit_and_roughness_rasters (float window_radius, float roughness_radius, string file_prefix, vector< int > file_list)
 This function takes the combines the polyfit functions and the roughness function in one package. More...
 
void calculate_roughness_rasters (float window_radius, float roughness_radius, string file_prefix, vector< int > file_code)
 This function takes the combines the roughness functions in one package. More...
 
void remove_seas ()
 This function changes any elevation <= 0 to NoDataValue. More...
 
void mask_to_nodata_below_threshold (float threshold)
 This function changes any elevation <= threshold to NoDataValue. More...
 
LSDRaster mask_to_nodata_using_threshold (float threshold, bool belowthresholdisnodata)
 This function changes any data point either above or below threshold to NoDataValue. More...
 
LSDRaster mask_to_nodata_using_threshold_using_other_raster (float threshold, bool belowthresholdisnodata, LSDRaster &MaskingRaster)
 This function changes any data point either above or below threshold to NoDataValue The threshold is determined by a second raster. More...
 
LSDIndexRaster mask_to_indexraster_using_threshold (float threshold, bool belowthresholdisnodata)
 This function creats an LSDIndexRaster mask (with true == 1 and otherwise nodata) from an LSDRaster. Can mask either above or below a threshold. More...
 
LSDRaster mask_to_nodata_with_mask_raster (LSDIndexRaster &Mask_raster, int mask_value)
 This function masks a raster to nodata based on a mask value and a mask raster. More...
 
LSDRaster fill ()
 This function fills pits/sinks in a DEM by incrementing elevations for cells with no downslope neighbour. The process is repeated adnausium until no cells require incrementing. More...
 
void fill_iterator (Array2D< float > &fill_data, int i, int j)
 This is a recursive algorithm that is called by the fill function. More...
 
LSDRaster fill (float &MinSlope)
 This function fills pits/sinks in a DEM by checking for pits from lowest to highest elevation, starting at the DEM boundary (raster edge or adjacent to NDVs). More...
 
LSDRaster MDFlow (vector< string > BoundaryConditions)
 Generate a flow area raster using a multi direction algorithm. More...
 
LSDRaster FreemanMDFlow ()
 Generate a flow area raster using a multi direction algorithm. More...
 
LSDRaster FreemanMDFlow_SingleSource (int i_source, int j_source)
 Route flow from one source pixel using FreemanMDFlow. Adapted from SWDG's code above. More...
 
LSDRaster FMDChannelsFromChannelHeads (vector< int > &channel_heads_rows, vector< int > &channel_heads_cols, float R_threshold)
 Extracts a multi-pixel channel network, as opposed to a single thread channel, using method outlined in Pelletier, 2013, WRR; A robust, two-parameter method for the extraction of drainage networks from high-resolution digital elevation models (DEMs): Evaluation using synthetic and real-world DEMs. More...
 
LSDRaster QuinnMDFlow ()
 Generate a flow area raster using a multi direction algorithm. More...
 
LSDRaster M2DFlow ()
 Generate a flow area raster using a multi 2-direction algorithm. More...
 
LSDRaster RidgeSample (Array2D< float > &Ridges)
 Module to sample LSDRaster values running along a ridgetop network. More...
 
LSDRaster RidgeSmoother (int WindowRadius)
 Pass a smoothing window over a ridge LSDRaster object to calculate an average value running along the ridgetop. More...
 
LSDRaster RidgeBuffer (int BufferRadius)
 Pass a buffer over a ridge LSDRaster object to increase sampling area. More...
 
LSDRaster BasinAverager (LSDIndexRaster &Basins)
 Module assigns an average LSDRaster value to each basin. More...
 
float SingleBasinAverager (LSDIndexRaster &Basin)
 Module calculates an average value to each for a given raster from within a basin. More...
 
LSDRaster BasinArea (LSDIndexRaster Basins)
 Write the area(in spatial units) of each basin to the basin's pixels. More...
 
void GetBasinVector (LSDIndexRaster Basins, int BasinOfInterest)
 Convert a basin, given by a basin ID, into a chain of xy coordinates for fast plotting of vector basin outlines. More...
 
vector< LSDRasterBasinPuncher (vector< int > basin_ids, LSDIndexRaster BasinArray)
 Punch basins out of an LSDRaster to create DEMs of a single catchment. More...
 
LSDRaster CookieCutRaster (LSDRaster Cutter)
 Cookie cut a raster using a smaller raster. More...
 
void CollectBasinMetrics (LSDIndexRaster &Basins, LSDRaster &Slope, LSDRaster &Elevation, LSDRaster &Aspect, LSDRaster &Area, LSDRaster &DrainageDensity, LSDRaster &Cht, LSDRaster &HillslopeLength, LSDRaster &MeanSlope, LSDRaster &Relief, LSDRaster &MeanAspect, LSDRaster &LH_drainage_density, Array2D< float > LH_Data, float CriticalSlope, string RasterFilename)
 Collect all basin average metrics into a single file. More...
 
void raster_statistics_by_index (LSDIndexRaster &IndexRaster, vector< float > &mean_vector, vector< float > &sd_vector, vector< float > &serr_vector, vector< int > &Npts_vector)
 Takes a raster and a corresponding index raster, and calculates the mean, sd and standard error by index. Returns four vectors: mean, st.dev., st.err and Number of points for each category. More...
 
pair< float, float > Boomerang (LSDRaster &Slope, LSDRaster &D_inf, string RasterFilename, float log_bin_width=0.1, int SplineResolution=200, float bin_threshold=0.05)
 Generate data in two text files to create a boomerang plot as in Roering et al [2007]. More...
 
LSDRaster DrainageDensity (LSDIndexRaster &StreamNetwork, LSDIndexRaster &Basins, Array2D< int > FlowDir)
 Calculate drainage density of a set of input basins. More...
 
float get_drainage_density_of_raster (LSDIndexRaster &StreamNetwork, Array2D< int > FlowDir)
 Calculate drainage density of a DEM. More...
 
LSDRaster HillslopeLengthFromDrainageDensity (LSDIndexRaster &StreamNetwork, LSDIndexRaster &Basins, Array2D< int > FlowDir)
 Simple method to calculate drainage density for each basin and then convert these values into a hillslope length raster. More...
 
void GetVectors (LSDRaster Magnitude, LSDRaster Direction, string output_file, int step)
 Method to export thinned vector field data to a text file. More...
 
LSDRaster NonLocalMeansFilter (int WindowRadius=2, int SimilarityRadius=2, int DegreeFiltering=2, float Sigma=1.25)
 Perform Non-local means filtering on a DEM following Baude et al [2005]. More...
 
void PadRasterSymmetric (Array2D< float > &PaddedRasterData, int &SimilarityRadius)
 Creates a buffer around an array (of size SimilarityRadius) and gives the new border mirror symmetric values of the original array reflected across the boundary. More...
 
void MakeGaussianKernel (Array2D< float > &Kernel, float sigma, int SimilarityRadius)
 Generate gaussian weighted kernel. More...
 
LSDRaster GaussianFilter (float sigma, int kr=0)
 Filters the raster using a square 2D Gaussian filter. The filter is applied using a moving kernel of gaussian weights with a radius of 3*sigma. More...
 
LSDRaster PeronaMalikFilter (int timesteps, float percentile_for_lambda, float dt)
 Filters the raster using a Perona-Malik non-linear diffusion filter. More...
 
Array2D< float > D_inf_FlowDir ()
 D-infinity flow direction algorithm after Tarboton (1997). More...
 
LSDRaster D_inf_FlowArea (Array2D< float > FlowDir_array)
 Main function for generating a D-infinity flow area raster after Tarboton (1997). More...
 
void D_infAccum (int i, int j, Array2D< float > CountGrid, Array2D< float > Flowarea_Raster, Array2D< float > FlowDir_array)
 Recursive function to calculate accumulating area for a given pixel. More...
 
LSDRaster D_inf ()
 Wrapper Function to create a D-infinity flow area raster with one function call. More...
 
LSDRaster D_inf_units ()
 Wrapper Function to create a D-infinity flow area raster, in spatial units, with one function call. More...
 
LSDRaster D_inf_ConvertFlowToArea ()
 Wrapper Function to convert a D-infinity flow raster into spatial units. More...
 
LSDRaster write_dinf_flowdir_to_LSDRaster (Array2D< float > dinflow)
 Function to write the D-infinity flow directions to an LSDRaster. More...
 
LSDIndexRaster D_inf_watershed (LSDRaster D_inf_FlowDir, int PourRow, int PourCol)
 Function to generate upslope contributing area extent from the D-infinity flow directions to an LSDRaster. More...
 
LSDRaster calculate_topographic_index (LSDRaster &AccumulationArea, LSDRaster &Slope)
 Function to calculate the topographic index, a moisture distribution indicator. More...
 
LSDIndexRaster PointShapefileToRaster (string FileName)
 Method to turn a point shapefile into an LSDIndexRaster. More...
 
LSDIndexRaster PolylineShapefileToRaster (string FileName)
 Method to turn a polyline shapefile into an LSDIndexRaster. More...
 
LSDRaster Resample (float OutputResolution)
 Method to resample an LSDRaster to a lower resolution. More...
 
Array2D< int > create_mask (float window_radius, int neighbourhood_switch)
 creates a circular mask for neighbourhood statistics More...
 
LSDRaster neighbourhood_statistics_spatial_average (float window_radius, int neighbourhood_switch)
 gets mean value for specified circular neighbourhood More...
 
vector< LSDRasterneighbourhood_statistics_spatial_average_and_SD (float window_radius, int neighbourhood_switch)
 gets mean & standard deviation value specified circular neighbourhood More...
 
LSDRaster neighbourhood_statistics_local_relief (float window_radius, int neighbourhood_switch)
 gets relief within value specified circular neighbourhood More...
 
LSDRaster neighbourhood_statistics_fraction_condition (float window_radius, int neighbourhood_switch, int condition_switch, float test_value)
 tests neighbourhood for the fraction of values for which the specified condition is met. More...
 
LSDRaster border_with_nodata (int border_width, int irregular_switch=0)
 Function to change border pixels to nodata. More...
 
LSDIndexRaster find_cells_bordered_by_nodata ()
 This function creates a mask that has the value of 1 for cells that are either on the edge or bordered by nodata (from their 9 neighbors) More...
 
void check_isolated_nodata ()
 This looks for isolated instances of no data. More...
 
void rudimentary_nodata_fill ()
 a very rudimentay filling routine that just fills nodata nodes with the average elevation of its neighbors More...
 
LSDRaster alternating_direction_nodata_fill (int window_width)
 A routine that fills nodata holes. It cannot recognise nodata around the edges so the spiral trimmer should be used first The routine sweeps the raster looking for nodata and filling this nodata with an average value from surrounding nodes. The sweeping changes directions, four sweep directions in all (+ rows, - rows, + cols, -cols) and it alternates between these directions until the raster is filled. More...
 
LSDIndexRaster create_binary_isdata_raster ()
 This returns an index raster with 1 for data and 0 for nodata. More...
 
LSDRaster alternating_direction_nodata_fill_with_trimmer (int window_width)
 A routine that fills nodata holes. It first prepares the data with the sprial trimmer so nodata around the edges is removed. The routine sweeps the raster looking for nodata and filling this nodata with an average value from surrounding nodes. The sweeping changes directions, four sweep directions in all (+ rows, - rows, + cols, -cols) and it alternates between these directions until the raster is filled. The routine is particularly useful for data with holes that is to be prepared for spectral analysis. More...
 
LSDRaster nodata_fill_irregular_raster (int window_radius)
 Function to fill in no data holes in an irregular raster. Pixel must have all neighbours not equal to no data value within the specified window radius. Data is filled based on mean of pixels within the window radius.
 
LSDRaster alternating_direction_nodata_fill_irregular_raster (int window_width)
 A routine that fills nodata holes. Modified by FJC to only fill holes surrounded in all directions by pixels with valid elevation values. More...
 
LSDIndexRaster Create_Mask (string Condition, float TestValue)
 Function to create a masked LSDIndexRaster raster based on a conditional statement. More...
 
LSDRaster ExtractByMask (LSDIndexRaster Mask)
 Function to extract an LSDRaster based on a LSDIndexRaster mask. More...
 
void MaskRaster (LSDIndexRaster Mask)
 Function to update an LSDRaster based on a LSDIndexRaster mask. More...
 
LSDIndexRaster IsolateChannelsLashermesCurvature (float sigma, string q_q_filename)
 method to locate channel pixels outlined by Lashermes. More...
 
LSDIndexRaster IsolateChannelsLashermesAspect (float sigma, string q_q_filename)
 
LSDIndexRaster IsolateChannelsLashermesFull (float sigma, string q_q_filename_prefix)
 
LSDIndexRaster IsolateChannelsLashermesCurvatureArea (float sigma, float area_threshold, string q_q_filename)
 
LSDIndexRaster IsolateChannelsGeonet (float timesteps, float area_threshold, float window_radius, string q_q_filename)
 method to locate channel pixels outlined by Passalacqua et al. (2010). More...
 
LSDIndexRaster IsolateChannelsQuantileQuantile (string q_q_filename)
 uses quantile-quantile analysis to pick departure from gaussian behaviour, then uses this as a threshold to create a binary dataset. More...
 
LSDIndexRaster IsolateChannelsQuantileQuantileAdaptive (int half_width)
 
Array2D< float > CalculateAdaptiveCurvatureThresholdSD (int half_width)
 Function to calculate the curvature threshold used for DrEICH channel extraction which varies across the landscape. More...
 
LSDIndexRaster CreateHilltopPatches (int minimum_patch_size)
 Method to convert an LSDRaster hilltop file into a series of contigiuous hilltop patches. More...
 
LSDIndexRaster CreateHilltopPatchesNEW (int minimum_patch_size)
 
void FlattenToFile (string FileName)
 Simple method to flatten an LSDRaster to a text file, with a sigle value on each line. More...
 
void FlattenToCSV (string FileName)
 Method to flatten an LSDRaster and place the non NDV values in a csv file. More...
 
void FlattenToWGS84CSV (string FileName)
 Method to flatten an LSDRaster and place the non NDV values in a csv file. More...
 
LSDRaster RemoveBelow (float Value)
 Simple method to remove any values below a user supplied value from an LSDRaster. More...
 
LSDRaster RemoveAbove (float Value)
 Simple method to remove any values above a user supplied value from an LSDRaster. More...
 
LSDRaster apply_mask (LSDIndexRaster &mask)
 apply a mask to a raster dataset, converts pixels to nodata where mas=k=1 More...
 
LSDIndexRaster ConvertToBinary (int Value, int ndv)
 Method to convert all values in an LSDRaster to a single value. More...
 
LSDRaster MergeRasters (LSDRaster &RasterToAdd)
 Method to merge data from two LSDRasters WITH SAME EXTENT together. /// The data from the raster specified as an argument will be added (will overwrite the original raster if there is a conflict). More...
 
void OverwriteRaster (LSDRaster &RasterToAdd)
 Method to merge data from two LSDRasters WITH SAME EXTENT together. /// The data from the raster specified as an argument will be added (will overwrite the original raster if there is a conflict). Overloaded function to rewrite original raster rather than creating a new one. More...
 
LSDIndexRaster get_potential_floodplain_patches (LSDRaster &Relief, LSDRaster &Slope, float relief_threshold, float slope_threshold)
 Function to get potential floodplain patches using a slope and relief threshold. More...
 
float get_threshold_for_floodplain (float bin_width, float peak_threshold, int peak_distance)
 Function to get threshold from a raster using a histogram of Probability-Density values. The function identifies the peaks in the PDF, and sets the threshold to the peak with the lowest value. This can be used to set the floodplain threshold. More...
 
float get_threshold_for_floodplain_QQ (string q_q_filename, float threshold_condition, int lower_percentile, int upper_percentile)
 Function to get threshold from a raster using qq plots. More...
 
string ChannelLengthByOrder (LSDIndexRaster &StreamNetwork, Array2D< int > FlowDir)
 Get the lengths in spatial units of each part of the channel network, divided by strahler order. More...
 
LSDRaster PoupulateRasterGaussian (float minimum, float mean)
 Populate a raster with random noise drawn from a gaussian distribution of given mean and minimum values. More...
 
LSDRaster PoupulateRasterSingleValue (float value)
 Populate a raster with a single value. More...
 
void HilltopsToCSV (LSDRaster &CHT, LSDRaster &CHT_gradient, LSDRaster &gradient, int UTMZone, bool isNorth, int eId, string filename)
 Write CHT and hilltop gradient data to a *.csv file, coded by UTM coordinates as well as lat/long. More...
 
vector< vector< float > > Sample_Along_Ridge (LSDRaster &Raster1, LSDRaster &Raster2, LSDRaster &Raster3, int a, int b, int threshold)
 Sample the values of 3 input rasters that intersect with the point a,b within the area defined by threshold. More...
 
LSDRaster convert_from_feet_to_metres ()
 function to convert feet to metres using US international feet, where 1 foot = 0.3048006096012192 metres. More...
 
LSDRaster convert_from_centimetres_to_metres ()
 function to convert elevations from centimetres to metres More...
 

Public Attributes

map< string, bool > RM_model_switches
 This map holds all the possible model switches.
 
map< string, string > RM_method_map
 
map< string, float > RM_float_parameters
 This holds float parameters.
 
map< string, int > RM_int_parameters
 This holds integer parameters.
 
map< string, string > RM_support_file_names
 

Protected Attributes

bool quiet
 True if Supress output messages.
 
bool initialized
 True if initialize_model has been run.
 
bool steady_state
 True if initial steady state has been arrived at.
 
bool initial_steady_state
 True for first steady state arrival, used for activating periodic forcing parameters.
 
bool cycle_steady_check
 True for steady state using periodic forcing (not sure about this one)
 
bool recording
 True if recording data.
 
bool reporting
 True if writing the run report.
 
vector< string > boundary_conditions
 Boundary conditions of model NESW.
 
string name
 Name of the model run.
 
string report_name
 Name of the report.
 
float current_time
 The current time.
 
float time_delay
 The time at which steady state was reached. Used to sync period after steady state.
 
float timeStep
 Time in between each calculation.
 
float maxtimeStep
 The maximum possible timestep. Used with adaptive timestepping.
 
float endTime
 ending time
 
short endTime_mode
 
int num_runs
 the number of runs, used to do repeated cycles from the same steady state
 
Array2D< float > uplift_field
 
int uplift_mode
 
float max_uplift
 the maximum uplift rate
 
float uplift_amplitude
 the amplitude of uplift
 
float baseline_uplift
 the baseline uplift rate (for different uplift modes)
 
float steady_state_tolerance
 an iteration tolerance for detemring if a model run is at steady state.
 
float steady_state_limit
 
float m
 Area exponent from the stream power law.
 
float n
 Slope exponent for the stream power law.
 
float K_fluv
 Fluvial erodability coefficient (units depend on m and n)
 
float K_soil
 Soil transport coefficient (usually in m^2/yr)
 
float threshold_drainage
 Drainage area above which soil will be flushed from the system in m^2.
 
float S_c
 Critical slope (for non-linear soil creep), dimensionless.
 
float rigidity
 Flexural rigidity of plate (SMM: dimensions?)
 
Array2D< float > root_depth
 Depth to topographic root, used in isostatic calculations.
 
float erosion
 the erosion (distance)
 
float erosion_last_step
 the erosion (distance) over the last timestep
 
vector< float > erosion_cycle_record
 the erosion over cycles, a vector since it stores sucessive cycles
 
float total_erosion
 Total erosion, calcualted as Offset from uplift from each cell.
 
float min_erosion
 minimum erosion distance, used in cyclic calculations
 
float max_erosion
 minimum erosion distance, used in cyclic calculations
 
float response
 maximum response over a single run (SMM: no idea if this is a length or what)
 
float total_response
 response over all model runs (to be divided by num_runs)
 
float noise
 This sets the amplitude of random noise, used in model initialisation.
 
float report_delay
 SMM: not sure what this does.
 
Array2D< float > zeta_old
 the elevations from the last timestep
 
Array2D< float > steady_state_data
 the elevations at steady state
 
Array2D< float > erosion_cycle_field
 a field calculated over an erosion cycle
 
short K_mode
 
short D_mode
 
short period_mode
 
float K_amplitude
 Amplitude of K wave.
 
float D_amplitude
 Amplitude of D wave.
 
float periodicity
 Periodicty.
 
float periodicity_2
 2nd periodicity (if period_mode = 2)
 
int cycle_number
 cycle that the model is on. Used to track changes in erosion between cycles
 
float p_weight
 Ratio for weight of periodicity in period_mode 3 or 4.
 
float switch_time
 Time at which switch happens (time mode is same as endTime_mode)
 
float switch_delay
 Similar to time delay (but for switching periodicities)
 
bool fluvial
 True if fluvial erosion is on.
 
bool hillslope
 true if linear hillslope erosion is on
 
bool nonlinear
 True if nonlinear hillslope erosion is on.
 
bool isostasy
 True if isostatic component is on.
 
bool flexure
 True if // Whether flexural isostasy will be used.
 
int current_frame
 This is the current frame, used for keeping track of the output rasters.
 
int print_interval
 interval over which output is written. Just based on number of timesteps
 
float float_print_interval
 this is for printing at fixed times
 
float next_printing_time
 
bool print_elevation
 Switch for printing elevation, if true elevation is printed to a raster.
 
bool print_erosion
 Switch for printing erosion, if true elevation is printed to a raster.
 
bool print_erosion_cycle
 Switch for printing erosion over a cycle, if true erosion is printed to a raster.
 
bool print_hillshade
 Switch for printing the hillshade, if true hillshade is printed to a raster.
 
bool print_slope_area
 Switch for printing S-A data, if true S-A data is printed.
 
Array2D< float > zeta_last_iter
 This array keeps track of the elevation on the previous iteration.
 
Array2D< float > zeta_last_timestep
 This array keeps track of the elevation from the previous timestep.
 
Array2D< float > zeta_this_iter
 Array for the current iteratation (used for implicit nonlinear solvers)
 
float inv_dx_S_c_squared
 precalculated 1/(dx^2*S_c^2)
 
float dx_front_term
 precalculated dt*D_nl/(dx^2)
 
int problem_dimension
 the problem dimension, used to determine the size of the solver matrix
 
vector< int > vec_k_value_i_j
 k value at i,j. This is an index into the vectorised elevation data.
 
vector< int > vec_k_value_ip1_j
 k value at i+1, j. This is an index into the vectorised elevation data.
 
vector< int > vec_k_value_im1_j
 k value at i-1, j. This is an index into the vectorised elevation data.
 
vector< int > vec_k_value_i_jp1
 k value at i, j+1. This is an index into the vectorised elevation data.
 
vector< int > vec_k_value_i_jm1
 k value at i, j-1. This is an index into the vectorised elevation data.
 
- Protected Attributes inherited from LSDRasterSpectral
int Lx
 
int Ly
 
float dfx
 
float dfy
 
float NyquistFreq
 
float WSS
 
Array2D< float > P_DFT
 
vector< float > RadialFrequency
 
vector< float > RadialPSD
 
vector< float > BackgroundPSD
 
vector< float > NormalisedPSD
 
vector< float > CI95
 
vector< float > normCI95
 
vector< float > normCI99
 
vector< float > R_sq
 
vector< float > beta
 
- Protected Attributes inherited from LSDRaster
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.
 
Array2D< float > RasterData
 Raster data.
 
Array2D< double > RasterData_dbl
 These are used primarily by LSDCatchmentModel.
 
Array2D< int > RasterData_int
 

Detailed Description

Create model objects to use LSDRaster methods on synthetic landscapes.

Constructor & Destructor Documentation

LSDRasterModel::LSDRasterModel ( )
inline

Constructor. Create a deafult LSDRasterModel (100x100)

Returns
An instance of LSDRasterModel
LSDRasterModel::LSDRasterModel ( string  master_param)
inline

Constructor. Create a LSDRasterModel from a parameter file.

Returns
An instance of LSDRasterModel
Parameters
master_paramA filenam for the master parameter file
LSDRasterModel::LSDRasterModel ( string  filename,
string  extension 
)
inline

Constructor. Create an LSDRasterModel from a file. Uses a filename and file extension.

Returns
LSDRasterModel
Parameters
filenameA String, the file to be loaded.
extensionA String, the file extension to be loaded.
LSDRasterModel::LSDRasterModel ( int  nrows,
int  ncols,
float  xmin,
float  ymin,
float  cellsize,
float  ndv,
Array2D< float >  data 
)
inline

Constructor. Create an LSDRasterModel from memory.

Returns
LSDRasterModel
Parameters
nrowsAn integer of the number of rows.
ncolsAn integer of the number of columns.
xminA float of the minimum X coordinate.
yminA float of the minimum Y coordinate.
cellsizeA float of the cellsize.
ndvAn integer of the no data value.
dataAn Array2D of floats in the shape nrows*ncols, containing the data to be written.
LSDRasterModel::LSDRasterModel ( LSDRaster An_LSDRaster)
inline

Constructor. Create an LSDRasterModel from an LSDRaster.

Returns
LSDRasterModel
Parameters
An_LSDRasterLSDRaster object.
LSDRasterModel::LSDRasterModel ( int  NRows,
int  NCols 
)

Constructor. Create a blank raster nodel.

Returns
LSDRasterModel
Parameters
NColsHeight of raster
NRowsWidth of raster

Member Function Documentation

void LSDRasterModel::add_path_to_names ( string  pathname)

this ads a pathname to the default names

Parameters
thename of the path
Author
SMM
Date
18/06/2014
void LSDRasterModel::Airy_isostasy ( void  )

Correct for isostasy using Airy model

void LSDRasterModel::append_run_name ( string  append_name)

this appends a string to the run name can be used to append parameters to run names

Author
SMM
Date
09/04/2015
Array2D< float > LSDRasterModel::array_channel_width_wolman ( Array2D< float > &  Q_w,
float &  k_w,
float &  b 
)

array_channel_width_wolman this function calcualtes channel width in a stand alone module so the widths

can be tested

float LSDRasterModel::calculate_channel_width_wolman ( float  Q_w,
float  k_w,
float  b 
)

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

HYDROLOGICAL TOOLS

calculate_channel_width_wolman This function calculates channel width using the wolman method. NOTE: typically Q_w will be in m^3/s. EXAMPLE: in Salmon River, Idaho (Emmett, 1975 cited in Knighton 1988):

k_w = 2.77 and b = 0.56. b is often assumed to be 0.5

Array2D< float > LSDRasterModel::calculate_erosion_rates ( void  )

Simple function that creates an array with the erosion rates for a given timestep. It doesn't do anything with NoData cells, and for cells with data it calls the get_erosion_at_cell member function updated to catch instances when zeta_old has not been calculated.

Returns
an array with the erosion rates
Author
JAJ updated SMM
Date
01/01/2014 updated 01/07/2014
Array2D< float > LSDRasterModel::calculate_fluvial_erosion_rate ( Array2D< float >  ChannelWidth,
Array2D< float >  Q_w,
Array2D< float >  TopoDivergence,
float  K,
float  n,
float  m,
float  eros_thresh 
)

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- EROSION RATES/SEDIMENT FLUXES


this caluclates the fluvial erosion rate at each point

void LSDRasterModel::calculate_k_values_for_assembly_matrix ( int  NRows,
int  NCols,
vector< int > &  k_value_i_j,
vector< int > &  k_value_ip1_j,
vector< int > &  k_value_im1_j,
vector< int > &  k_value_i_jp1,
vector< int > &  k_value_i_jm1 
)

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

IMPLICIT MODEL COMPONENTS

Implicit schemes for combination of hillslope sediment transport using non-linear hillslope transport law, and fluvial erosion. This is essentially the implicit implementation of MuddPILE, but has been modified so that now fluvial erosion is undertaken using FASTSCAPE (Braun and Willet, 2013), which

greatly increases computational efficiency.

calculate_k_values_for_assembly_matrix/mtl_initiate_assembler_matrix this function creates vectors of integers that refer to the k values, that is the index into the vectorized matrix of zeta values, that is used in the assembly matrix

the number of elements in the k vectors is N_rows*N_cols

Array2D< float > LSDRasterModel::calculate_root ( void  )

Calculates depth of topographic root using FFT methods inherited from LSDRasterSpectral

void LSDRasterModel::check_and_correct_uplift_field ( )

This checks to see if the uplift field is consistent with the raster dimensions. If not it corrects the dimensions of the uplift field.

Author
SMM
Date
23/08/2017
bool LSDRasterModel::check_end_condition ( void  )

This checks on the ending condition of the model run endTime_mode: 1 == The end time is just some fixed time after initial steady state 2 == The end time is after a fixed number of cycles 3 == The time is after steady state, but waits for a fixed number of cycles before ending.

Returns
returns a boolean that is true if the end time has been reached and false if end time has not been reached
Author
JAJ, comments SMM
Date
01/01/2014 comments SMM 27/06/2014
bool LSDRasterModel::check_if_hung ( void  )

If the periodic model cycles over 100 times this returns true.

Author
JAJ
void LSDRasterModel::check_periodicity_switch ( void  )

This function checks to see if this is a periodic run. If it is, it sets the times to align with the period Note this only realy comes into play if period mode == 2 or 4 period_mode means 1 (default) one periodicity used without 2 Two periodicities that switch at a given interval 3 Two periodicities used as a compound sin wave 4 Same as three, but weightings switch at a given interval (as in 2)

Author
JAJ
Date
01/012014

Possible problem here, if running sequential models we can't remeber which periodicity was the original one

void LSDRasterModel::check_recording ( void  )

This function checks to see if the model should record results If initial steady state has not been reached, recording is set to false: that is, the model does not record information on the build up to steady state.

Author
JAJ
Date
01/01/2014
void LSDRasterModel::check_steady_state ( void  )

This function checks to see if the model has achieved steady state. The nature of steady state checked is set by the cycle_steady_check flag If this is false, it checks if there is simple steady state (the surface elevations do not change in time) If the cycle_steady_check is true, it check if steady state has been achieved from one cycle to another.

Returns
does not return anything, but instead changes the steady_state flag
Author
JAJ commented SMM
Date
01/01/2014 commented SMM 27/06/2014
void LSDRasterModel::close_static_outfiles ( )

This function closes some static outfiles used for printing.

Author
SMM
Date
01/08/2014
LSDRasterModel LSDRasterModel::create_buffered_surf ( int  b_type)

This first function is used as a simple way to implement boundary conditions, particularly no flux and periodic boundary conditions. The buffered surface has NRows+2 rows and NCols+2 columns. The integer b_type sets the type of boundary conditions, but currently there is only one implementation: no flux across N and S; periodic for E and W.

Parameters
b_typeat the moment this is irrelevant since this just switches to default
Returns
creates a buffered LSDRasterModel
LSDRasterModel LSDRasterModel::create_buffered_surf ( float  South_boundary_elevation,
float  North_boundary_elevation 
)

This second version has periodic boundaries at E and W boundaries, and Neumann boundary conditions (prescribed elevations) at the N and S boundaries.

Parameters
South_boundary_elevationthe elevation at the southern boundary
North_boundary_elevationthe elevation at the southern boundary
void LSDRasterModel::cycle_report ( float  elev,
float  relief0,
float  relief10 
)

this prints a file about what has happened over a cycle

Author
JAJ
Date
01/01/2014
void LSDRasterModel::final_report ( void  )

this prints a final report (SMML not sure what is in the final report)

Author
JAJ
Date
01/01/2014
float LSDRasterModel::find_max_boundary ( int  boundary_number)

Gets the maxium elevation along a boundary.

Parameters
boundary_number0 == row 0 1 == col 0
Returns
the maximum elevation along the boundaty
void LSDRasterModel::flexural_isostasy ( float  alpha)

Correct for isostasy using flexural model

float LSDRasterModel::fluvial_calculate_K_for_steady_state_relief ( float  U,
float  desired_relief 
)

This method calcualtes the fluvial K required to generate the desired relief at steady state for the farthest upstream chi. It is based on equation 4a from Mudd et al 2014 JGR-ES. This does not update aything in the model, but simply returns the desired K.

Parameters
Uthe uplift rate (in m/yr)
desired_reliefThe desired landscape relief in metres
Returns
The back calculated K value for the desired relief
Author
SMM
Date
29/08/2017
LSDRaster LSDRasterModel::fluvial_erosion_rate ( float  timestep,
float  K,
float  m,
float  n,
vector< string >  boundary 
)

This function is more or less identical to fluvial_incision above, but it Returns a raster with the erosion rate and takes arguments rather than reading from data members.

Parameters
timestepthe time spacing
Kfluvial erosivity
marea exponent
nslope exponent
boundarya vector of strings cotaining model boundary conditions
Returns
A raster containing the erosion rate from fluvial processes
Author
JAJ
Date
01/01/2014
Array2D< float > LSDRasterModel::fluvial_erosion_rate ( void  )

This function is more or less identical to fluvial_incision above, but it Returns an array and takes arguments rather reads from data members.

Returns
A 2d float containing the erosion rate from fluvial processes
Author
SMM
Date
07/07/2014
void LSDRasterModel::fluvial_incision ( void  )

Fastscape, implicit finite difference solver for stream power equations O(n) Method takes its paramaters from the model data members and solves the stream power equation at a future timestep in linear time.

Author
JAJ, commented SMM
Date
01/01/2014, edit 18/01/2014
void LSDRasterModel::fluvial_incision_with_uplift ( void  )

Fastscape, implicit finite difference solver for stream power equations O(n) Method takes its paramaters from the model data members and solves the stream power equation at a future timestep in linear time This version includes the current uplift, so you do not need to call uplift after this has finished.

Author
SMM
Date
7/07/2014
void LSDRasterModel::fluvial_incision_with_uplift_and_variable_K ( LSDRaster K_raster)

Fastscape, implicit finite difference solver for stream power equations O(n) Method takes the K value from a raster fed to it and solves the stream power equation at a future timestep in linear time This version includes the current uplift, so you do not need to call uplift after this has finished.

Parameters
K_rasterthe raster of K values.
Author
SMM
Date
01/09/2017
void LSDRasterModel::fluvial_incision_with_variable_uplift_and_variable_K ( LSDRaster Uplift_rate,
LSDRaster K_raster 
)

Fastscape, implicit finite difference solver for stream power equations O(n) Method takes the K value from a raster fed to it and also take a raster of the uplift rates and solves the stream power equation at a future timestep in linear time This version includes the current uplift, so you do not need to call uplift after this has finished.

Parameters
K_rasterthe raster of K values.
Uplift_ratea raster of uplift rates in m/yr
Author
SMM
Date
01/09/2017
void LSDRasterModel::fluvial_incision_with_variable_uplift_and_variable_K_adaptive_timestep ( LSDRaster Uplift_rate,
LSDRaster K_raster 
)

Fastscape, implicit finite difference solver for stream power equations O(n) Method takes the K value from a raster fed to it and also take a raster of the uplift rates and solves the stream power equation at a future timestep in linear time This version includes the current uplift, so you do not need to call uplift after this has finished. Uses an adaptive timestep.

Parameters
K_rasterthe raster of K values.
Uplift_ratea raster of uplift rates in m/yr
Author
SMM
Date
06/09/2017
void LSDRasterModel::fluvial_snap_to_steady_state ( float  U)

This method creates a steady landscape that assumes everywhere obeys the stream power law. It is based on equation 4a from Mudd et al 2014 JGR-ES There is no return but the underlying raster data will reflect the analytical steady topography for the uplift rate.

Parameters
Uthe uplift rate (in m/yr)
Author
SMM
Date
10/08/2017
float LSDRasterModel::fluvial_snap_to_steady_state_tune_K_for_relief ( float  U,
float  desired_relief 
)

This method creates a steady landscape that assumes everywhere obeys the stream power law. It is based on equation 4a from Mudd et al 2014 JGR-ES. The function is given a target relief and the K value is adjusted to match this target relief at the maximum chi value. In addition to the return, the underlying raster data will reflect the analytical steady topography for the uplift rate.

Parameters
Uthe uplift rate (in m/yr)
desired_reliefThe desired landscape relief in metres
Returns
The back calculated K value for the desired relief
Author
SMM
Date
10/08/2017
mtl::compressed2D< float > LSDRasterModel::generate_fd_matrix ( int  dimension,
int  size,
bool  periodic 
)

Finite difference matrix

Array2D< float > LSDRasterModel::generate_uplift_field ( int  mode,
float  max_uplift 
)

Creates uplift field from a set of templates.

Parameters
modespecifies a mode of uplift: (0) - block uplift 1 - tilt block 2 - gaussian 3 - quadratic
secondargument is the maximum uplift
Returns
returns the uplift field that is the same dimensions as the original raster
Author
JAJ
Date
01/01/2014
Array2D< float > LSDRasterModel::generate_uplift_field ( void  )

Creates uplift field from a set of templates, parameters are taken from data members.

Returns
returns the uplift field that is the same dimensions as the original raster
Author
SMM
Date
07/07/2014
float LSDRasterModel::get_average_upflit_rate_last_timestep ( )

this calcualtes the average uplfit rate over the entire model domain, excluding the N and S boundaries

Returns
the average uplift rate in m/yr
Author
SMM
Date
01/08/2014
float LSDRasterModel::get_D ( void  )

This function gets the soil transport coefficient erodability. It has a number of switches that determine how D is calculated. D_mode == 1 sine wave D_mode == 2 square wave D_mode == 3 read from file D_mode: default is constant value.

Author
JAJ
Date
01/01/2014
float LSDRasterModel::get_erosion_at_cell ( int  row,
int  col 
)

This calculates the erosion rate for individual cells. Currently it assumes that the zeta_old data member is from the previous timestep.

Parameters
rowthe row of the cell
colthe column of the cell
Author
JAJ
Date
01/01/2014
float LSDRasterModel::get_K ( void  )

This function gets the fluvial erodability. It has a number of switches that determine how K is calcualted. K_mode == 1 sine wave K_mode == 2 square wave K_mode == 3 read from file K_mode: default is constant value.

Author
JAJ
Date
01/01/2014
float LSDRasterModel::get_m ( void  )
inline

Gets the area exponent.

Author
SMM
Date
10/08/2017
float LSDRasterModel::get_max_uplift ( void  )

This just returns the max_uplift data member NOTE; while this is currently a very trivial, and arguably unecessary method, it should be used and developed if someone wants to integrate some sort of changing uplift field.

Returns
the data member holding the maximum uplift
Author
JAJ
Date
01/01/2014
float LSDRasterModel::get_n ( void  )
inline

Gets the slope exponent.

Author
SMM
Date
10/08/2017
string LSDRasterModel::get_name ( void  )
inline

gets the name of the model run from the data members

Returns
the name of the model run
Author
JAJ
Date
01/01/2014
void LSDRasterModel::get_slopes ( Array2D< float > &  SlopesBetweenRows,
Array2D< float > &  SlopesBetweenCols 
)

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- TOPOGRAPHIC DERIVATIVES Specifically, this function gets the topographic slopes, as required for the sediment flux calculations. The slopes are stored as two matrices, one that stores slopes between rows, the other which for slopes between columns. Note that this is a finite volume model that utilises cubic model voxels. Sediment fluxes are only permitted through the faces.

For slopes between columns, the entry at S[row][col] refers to the slope between zeta at node [row][col] and at node [row][col+1]. Likewise for the slopes between rows. In short, the center points of the slopes are offset by 1/2 a node spacing in the positive direction.

Note that there are NCols +1 and NRows +1 columns and rows respectively

Array2D< float > LSDRasterModel::get_topographic_divergence ( )

get_topographic_divergence gets the topographic divergence at each point in the model domain. Use

buffered topography

float LSDRasterModel::get_total_erosion_rate_over_timestep ( )

this calcualtes the total erosion over a timester

Returns
the erosion rate calculated over the last timestep
Author
SMM
Date
01/08/2014
float LSDRasterModel::get_uplift_at_cell ( int  i,
int  j 
)

Gets the uplift value at a given cell this method is implemented as a memory saving measure, rather than storing the uplift field in memory Some methods still implemented still use this uplift field It's advisable this is changed, otherwise the size of rasters that can be modelled will be severely reduced.

This uses the uplift_mode to determine how uplift is calculated (0) - block uplift 1 - tilt block 2 - gaussian 3 - quadratic 4 - periodic

Parameters
row
column
Returns
the uplift (as a distance rather than rate, uses data member timestep)
Author
JAJ commented SMM
01/01/2014 commented 26/06/2014
float LSDRasterModel::get_uplift_rate_at_cell ( int  i,
int  j 
)

Gets the uplift rate at a given cell this method is implemented as a memory saving measure, rather than storing the uplift field in memory Some methods still implemented still use this uplift field It's advisable this is changed, otherwise the size of rasters that can be modelled will be severely reduced.

This uses the uplift_mode to determine how uplift is calculated (0) - block uplift 1 - tilt block 2 - gaussian 3 - quadratic 4 - periodic

Parameters
row
column
Returns
the uplift rate
Author
SMM
Date
07/07/2014 commented 26/06/2014
void LSDRasterModel::initialise_model ( )

This module initialises the model using the maps that have been read in from the parameter file via the param file parser function.

Parameters
nowt
Author
DAV
Date
2015-01-17
void LSDRasterModel::initialise_nonlinear_SS ( float  U)

This initialises a surface with a hillslope that is the solution to the nonlinear sediment flux equation. It overwrites RasterData.

The parameters D and S_c are stored as data members Solution from Roering et al., (EPSL, 2007)

Parameters
Uthe uplift rate
Author
SMM
Date
01/07/2014
void LSDRasterModel::initialise_parabolic_surface ( float  peak_elev,
float  edge_offset 
)

This resets the RasterData array to have a parabolic shape, with 0 elevation at the N and S boundaries. It also adds some random noise to the topography. The amplitude of this noise is set by the data member 'noise'. The default noise is 1mm.

Parameters
peak_elevThe peak elevation in metres. Is in the middle of the model domain
edge_offsetan offest from the edge elevation. You can have a little cliff at the edge
Author
SMM
Date
1/7/2014
void LSDRasterModel::initialise_taper_edges_and_raise_raster ( int  rows_to_taper)

This takes a raster and tapers the edges to zero elevation. Its purpose is to remove edge artefacts.

Parameters
rows_to_taperThe number of rows at the N and S boudaries to taper
Author
SMM
Date
10/08/2017
void LSDRasterModel::initialize_model ( string  parameter_file)

This module initialises the model runs, calling the required function from the initial topography and loads the parameters from the parameter file.

Parameters
parameter_filethe filename of the paramter file (with extension)
Author
JAJ
Date
01/01/2014
vector< LSDParticleColumn > LSDRasterModel::initiate_steady_CRN_columns ( int  column_spacing,
vector< int > &  CRNcol_rows,
vector< int > &  CRNcol_cols,
double  rho_r,
double  this_U,
int  startType,
double  startDepth,
double  particle_spacing,
LSDCRNParameters CRNParam 
)

This initiates a vector of CRN columns that sit under the model.

Author
SMM
Parameters
column_spacingand integer telling how many nodes between particle columns
CRNcol_rowsthis is an integer vector that is replaced in this function each element indexes the row of the vector of columns
CRNcol_colsthis is an integer vector that is replaced in this function each element indexes the col of the vector of columns
rho_rthe density of the rock in kg/m^3
this_Uthe uplift rate in m/yr that the particles CRN concentrations will be equilibrated to. Note it is only via nucleonic production
startTypethe starting type of the particle (doesn't really play a role)
startDepththe starting depth (in m) of the particles
particle_spacingvertical distance between particles in the column
CRNParamthe cosmogenic parameter values
Returns
a vector of particle columns
Author
SMM
Date
31/07/2014
void LSDRasterModel::intialise_diamond_square_fractal_surface ( int  feature_order,
float  desired_relief 
)

This initialises the raster model to a fractal surface using the diamond square algorithm.

Parameters
feature_orderis an interger n where the feature size consists of 2^n nodes. If the feature order is set bigger than the dimensions of the parent raster then this will default to the order of the parent raster.
desired_reliefThe relief desired from the final surface
Author
SMM
Date
10/08/2017
void LSDRasterModel::intialise_fourier_fractal_surface ( float  fractal_D)

This initialises the raster model to a square model domain with a fractal surface using the algorithm from Saupe (1987d)

Parameters
fractal_DUsed to determine the fractal dimension, D by: D = 3 - fractal_D. So the fractal dimension should be between 2 and 3.
Author
DAV
Date
20/10/2014
void LSDRasterModel::intialise_fourier_fractal_surface_v2 ( float  beta,
float  desired_relief 
)

This initialises the raster model to a square model domain with a fractal surface using the algorithm from the LSDRasterModel.

Parameters
betaUsed to determine the fractal dimension, beta by: beta = 3 - fractal_beta. So the fractal dimension should be between 2 and 3.
desired_reliefThe relief desired from the final surface
Author
SMM
Date
10/08/2017
bool LSDRasterModel::is_base_level ( int  i,
int  j 
)

Check whether current node is a base level node.

Parameters
row
column
Returns
true or false
Author
JAJ
Date
01/01/2014
void LSDRasterModel::make_template_param_file ( string  filename)

Produce a template of a parameter file to be supplied to the model.

Parameters
thename of the parameter file to be printed
Author
JAJ
Date
01/01/2014
void LSDRasterModel::mtl_assemble_matrix ( Array2D< float > &  zeta_last_iter,
Array2D< float > &  zeta_last_timestep,
Array2D< float > &  zeta_this_iter,
Array2D< float > &  uplift_rate,
Array2D< float > &  fluvial_erosion_rate,
mtl::compressed2D< float > &  mtl_Assembly_matrix,
mtl::dense_vector< float > &  mtl_b_vector,
float  dt,
int  problem_dimension,
float  inv_dx_S_c_squared,
float  inv_dy_S_c_squared,
float  dx_front_term,
float  dy_front_term,
float  South_boundary_elevation,
float  North_boundary_elevation,
vector< int > &  vec_k_value_i_j,
vector< int > &  vec_k_value_ip1_j,
vector< int > &  vec_k_value_im1_j,
vector< int > &  vec_k_value_i_jp1,
vector< int > &  vec_k_value_i_jm1 
)

mtl_assemble_matrix this function assembles the solution matrix for nonlinear creep transport

void LSDRasterModel::mtl_solve_assembler_matrix ( Array2D< float > &  zeta_last_iter,
Array2D< float > &  zeta_last_timestep,
Array2D< float > &  zeta_this_iter,
Array2D< float > &  uplift_rate,
Array2D< float > &  fluvial_erosion_rate,
float  dt,
int  problem_dimension,
float  inv_dx_S_c_squared,
float  inv_dy_S_c_squared,
float  dx_front_term,
float  dy_front_term,
vector< int > &  vec_k_value_i_j,
vector< int > &  vec_k_value_ip1_j,
vector< int > &  vec_k_value_im1_j,
vector< int > &  vec_k_value_i_jp1,
std::vector< int > &  vec_k_value_i_jm1,
float  South_boundary_elevation,
float  North_boundary_elevation 
)

mtl_solve_assembler_matrix

this function assembles the solution matrix

void LSDRasterModel::MuddPILE_assemble_matrix ( Array2D< float > &  uplift_rate,
Array2D< float > &  fluvial_erosion_rate,
mtl::compressed2D< float > &  mtl_Assembly_matrix,
mtl::dense_vector< float > &  mtl_b_vector 
)

this assembles the sparse matrix that must then be solved to get the next iteration of the hillslope elevations

Note this is not a buffered surface, boundaries are implemented at Row == 0 and Row = NRows-1 in the LSDModelRasters domain

Parameters
uplift_ratea float array giving the uplift rate
fluvial_erosion_ratea float array giving the fluvial erosion rate
mtl_Assembly_matrixthis is a sparce matrix that is reset within this member function and passed to the solver
mtl_b_vectorthe b vector in the linear system M z = b where M is the assembly matrix and z is the vector of surface elevations
Author
SMM
Date
01/07/2014
void LSDRasterModel::MuddPILE_calculate_k_values_for_assembly_matrix ( void  )

this initiates some parameters for the assembler matrix it is required before running any further calculations for the nonlinear solver

Does the work of calculating vec_k_value_i_j, vec_k_value_ip1_j, vec_k_value_im1_j, vec_k_value_i_jp1 and vec_k_value_i_jm1. These are the indices into the vectorized matrix of zeta values that are used in the assembly matrix the number of elements in the k vectors is N_rows*N_cols WARNING: This is only used for fixed NS boundaries and periodic EW boundaries

Author
SMM
Date
01/07/2014
void LSDRasterModel::MuddPILE_initiate_assembler_matrix ( void  )

this initiates some parameters for the assembler matrix it is required before running any further calculations for the nonlinear solver

The function sets data members inv_dx_S_c_squared, dx_front_term, problem_dimension, vec_k_value_i_j, vec_k_value_ip1_j, vec_k_value_im1_j, vec_k_value_i_jp1 and vec_k_value_i_jm1

Author
SMM
Date
01/07/2014
void LSDRasterModel::MuddPILE_nl_soil_diffusion_nouplift ( )

This version of the MuddPILE nonlinear solver does not include uplift and uses a default iteration tolerance of 1e-7. It is built to integrate with JAJ's 'run_components' module.

Author
SMM
Date
03/07/2014
void LSDRasterModel::MuddPILE_nonlinear_creep_timestep ( Array2D< float > &  uplift_rate,
Array2D< float > &  fluvial_erosion_rate,
float  iteration_tolerance 
)

This runs one timestep of the nonlinear sediment flux law It replaces the data in RasterData.

Parameters
uplift_ratea float array of the same size as RasterData that contains the uplift rate
fluvial_erosion_ratea float array of the same size as RasterData
iteration_tolerancethe maximum change in surface elevation between iterations
Author
SMM
Date
01/07/2014
void LSDRasterModel::MuddPILE_solve_assembler_matrix ( Array2D< float > &  uplift_rate,
Array2D< float > &  fluvial_erosion_rate 
)

this function solves the assembled matrix for the nonlinear hillslope sediment flux law. The implementation calls MuddPILE_assemble_matrix.

After solution the zeta_this_iter data member will be updated

Parameters
uplift_ratea float array of the same size as RasterData that contains the uplift rate
fluvial_erosion_ratea float array of the same size as RasterData
Author
SMM
Date
01/07/2014
void LSDRasterModel::nonlinear_creep_timestep ( Array2D< float > &  fluvial_erosion_rate,
float  iteration_tolerance,
int  problem_dimension,
float  inv_dx_S_c_squared,
float  inv_dy_S_c_squared,
float  dx_front_term,
float  dy_front_term,
vector< int > &  vec_k_value_i_j,
vector< int > &  vec_k_value_ip1_j,
vector< int > &  vec_k_value_im1_j,
vector< int > &  vec_k_value_i_jp1,
vector< int > &  vec_k_value_i_jm1,
float  South_boundary_elevation,
float  North_boundary_elevation 
)

nonlinear_creep_timestep do a creep timestep. This function houses the above two functions to undertake model timestep using implicit implementation of the nonlinear transport law.

NOTE you need to run mtl_initiate_assembler_matrix before you run this function

Array2D< float > LSDRasterModel::precip_array_from_precip_rate ( float  precip_rate)

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= CREATE PRECIPITION FLUX ARRAY

Produces precipitation array from provided precipitation rate.

void LSDRasterModel::print_average_erosion_and_apparent_erosion ( int  frame,
vector< LSDParticleColumn > &  CRNColumns,
LSDCRNParameters CRNParams 
)

This function prints the apparent cosmogenic rates from a collection of LSDParticle Columns This function opens a file if none exists.

Parameters
framethe frame to be printed
CRNColumnsthe columns of cosmogenic particles
CRNParamsand LSDCRNParamters object
Author
SMM
Date
01/08/2014
void LSDRasterModel::print_column_erosion_and_apparent_erosion ( int  frame,
vector< LSDParticleColumn > &  CRNColumns,
LSDCRNParameters CRNParams 
)

This function prints the apparent cosmogenic rates from individual LSDParticle Columns This function opens a file if none exists.

Parameters
framethe frame to be printed
CRNColumnsthe columns of cosmogenic particles
CRNParamsand LSDCRNParamters object
Author
SMM
Date
24/05/2015
void LSDRasterModel::print_parameters ( void  )

this prints parameters to screen

Author
JAJ
Date
01/01/2014
void LSDRasterModel::print_rasters ( int  frame_num)

This function prints a series of rasters. The rasters printed depend on the switches print_elevation, print_erosion, print_erosion_cycle, print_hillshade; and print_slope_area The filename inculdes the frame_num.

Parameters
theframe of the rasters to be printed
Author
JAJ
Date
01/01/2014
void LSDRasterModel::print_rasters_and_csv ( int  frame)

This function prints a series of rasters. The rasters printed depend on the switches print_elevation, print_erosion, print_erosion_cycle, print_hillshade; and print_slope_area The filename inculdes the frame_num It also prints a csv of the model info which can be ingested by pandas for visualisation.

Parameters
theframe of the rasters to be printed
Author
FJC
Date
22/08/17
void LSDRasterModel::raise_and_fill_raster ( )

this raises the raster so the lowest point is zero and also fills the raster

Author
SMM
Date
25/08/2017
void LSDRasterModel::random_surface_noise ( float  min,
float  max 
)

Adds random noise to each pixel in range [min, max].

Parameters
miniumrandom addition
maximumrandom addition
Author
JAJ
Date
01/01/2014
void LSDRasterModel::random_surface_noise ( )

Adds random noise to each pixel using the noise data member.

Author
SMM
Date
17/06/2014
void LSDRasterModel::reach_steady_state ( void  )

This method forces the landscape into its steady state profile, by using periodic forcing. This is much more efficient than using static forcing (as in run model), but doesn't give a nice animation of an evolving landscape Swings and roundabouts.

Author
JAJ
Date
01/01/2014
void LSDRasterModel::reset_model ( void  )

Reset model - reset erosion values to 0 after a complete model run.

Author
JAJ
Date
01/01/2014
void LSDRasterModel::resize_and_reset ( int  new_rows,
int  new_cols 
)

This resizes the LSDRasterModel, resetting some flags in the process, as well as setting many of the Array2D data members to be empty arrays The raster data in the end is a random surface (determined by the noise data member)

Parameters
new_rowsthe new number of rows
new_colsthe new number of columns
Author
SMM
Date
30/06/2014
void LSDRasterModel::resize_and_reset ( int  new_rows,
int  new_cols,
float  new_resolution 
)

This resizes the LSDRasterModel, resetting some flags in the process, as well as setting many of the Array2D data members to be empty arrays The raster data in the end is a random surface (determined by the noise data member) This overloaded version also changes the data resolution.

Parameters
new_rowsthe new number of rows
new_colsthe new number of columns
new_resolutionthe new data resolution
Author
SMM
Date
30/06/2014
LSDRaster LSDRasterModel::return_as_raster ( )

This just returns the raster model object data as a raster.

Returns
A raster with the data from the LSDRasterModel
Author
SMM
Date
01/09/2017
void LSDRasterModel::run_components ( void  )

This wrapper just calls the run_components method. Parameters used are those stored as data members. This one actually calls the erosion laws.

Author
JAJ
Date
01/01/2014
void LSDRasterModel::run_components_combined ( void  )

This is a wrapper similar to run_components but sends the fluvial and uplfit fields to the nonlinear solver.

Author
SMM
Date
07/07/2014
void LSDRasterModel::run_components_combined ( LSDRaster URaster,
LSDRaster KRaster,
bool  use_adaptive_timestep 
)

This is a wrapper similar to run_components but sends the fluvial and uplfit fields to the nonlinear solver. Variable U and K rasters can be used.

Parameters
URasterA raster of uplift rates
KRasterA raster of K values
use_adaptive_timestepIf true, an adaptive timestep is used
Author
SMM
Date
03/09/2017
void LSDRasterModel::run_components_combined_cell_tracker ( vector< LSDParticleColumn > &  CRNColumns,
vector< LSDParticleColumn > &  eroded_cells,
int  startType,
double  startDepth,
double  particle_spacing,
LSDCRNParameters CRNParam 
)

This is a wrapper that runs the model but includes CRN columns fluvial and uplfit fields to the nonlinear solver.

Parameters
CRNColumnsthe vector of particle columns
eroded_cellsthis gets replaced, it is the eroded particles
startTypethe starting type of the particle (doesn't really play a role)
startDepththe starting depth (in m) of the particles
particle_spacingvertical distance between particles in the column
CRNParamthe cosmogenic parameter values
Author
SMM
Date
25/07/2014
LSDRasterModel LSDRasterModel::run_isostatic_correction ( void  )

Runs flexural isostatic calculations Uses fourier filtering method

Pelletier (2008)

void LSDRasterModel::run_model ( void  )

This wrapper just calls the run_components method. Parameters used are those stored as data members.

Author
JAJ
Date
01/01/2014
void LSDRasterModel::run_model_from_steady_state ( void  )

This loads a steady state raster from the data members so that a model can be run repeatedly from the same steady state condition.

Author
JAJ
Date
01/01/2014
LSDRasterModel LSDRasterModel::run_model_implicit_hillslope_and_fluvial ( string  param_file)

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

RUN MODEL

A series of wrapper functions that implement the numerical model

implicit_hillslope_and_fluvial This function sets up a landscape evolution model run incorporating fluvial erosion and hillslope erosion via non-linear creep. It calls the implicit implementation and returns the topography after the final timestep. The user should provide the parameter file which sets out the details of the

model run.

void LSDRasterModel::set_D_mode ( short  mode)
inline

this sets the D mode

Parameters
modeThe mode of calculating D D_mode == 1 sine wave D_mode == 2 square wave D_mode == 3 read from file D_mode: default is constant value
Author
JAJ
Date
01/01/2014
void LSDRasterModel::set_flexure ( bool  on_status)
inline

set the flexure switch

Parameters
on_statusa boolean, true if on, false if off
Author
JAJ @ date 01/01/2014
void LSDRasterModel::set_fluvial ( bool  on_status)
inline

set the fluvial switch

Parameters
on_statusa boolean, true if on, false if off
Author
JAJ @ date 01/01/2014
void LSDRasterModel::set_hillslope ( bool  on_status)
inline

set the hillslop switch

Parameters
on_statusa boolean, true if on, false if off
Author
JAJ @ date 01/01/2014
void LSDRasterModel::set_isostasy ( bool  on_status)
inline

set the isostacy switch

Parameters
on_statusa boolean, true if on, false if off
Author
JAJ @ date 01/01/2014
void LSDRasterModel::set_K_mode ( short  mode)
inline

this sets the K mode

Parameters
modeThe mode of calculating K K_mode == 1 sine wave K_mode == 2 square wave K_mode == 3 read from file K_mode: default is constant value
Author
JAJ
Date
01/01/2014
void LSDRasterModel::set_nonlinear ( bool  on_status)
inline

set the hillslop linear or nonlinear switch

Parameters
on_statusa boolean, true if on, false if off
Author
SMM @ date 03/07/2014
void LSDRasterModel::set_period_mode ( short  mode)
inline

This sets the way the periodicity is calculated.

Parameters
modethe mode of periodic forcing 1 (default) one periodicity used without 2 Two periodicities that switch at a given interval 3 Two periodicities used as a compound sin wave 4 Same as three, but weightings switch at a given interval (as in 2)
Author
JAJ
Date
01/01/2014
void LSDRasterModel::set_print_elevation ( bool  do_I_print_elevation)
inline

Sets the print elevation.

Parameters
boolean;if true prints elevation
Author
SMM
Date
09/08/2017
void LSDRasterModel::set_print_erosion ( bool  do_I_print_erosion)
inline

Sets the print erosion.

Parameters
boolean;if true prints erosion
Author
SMM
Date
09/08/2017
void LSDRasterModel::set_print_hillshade ( bool  do_I_print_hillshade)
inline

Sets the print hillshade.

Parameters
boolean;if true prints hillshade
Author
SMM
Date
09/08/2017
void LSDRasterModel::set_quiet ( bool  on_status)
inline

set the quiet switch

Parameters
on_statusa boolean, true if on, false if off
Author
JAJ @ date 01/01/2014
void LSDRasterModel::set_uplift ( int  mode,
float  max_rate 
)
inline

overloaded function, set the array of uplift, but using the uplift mode

uplfit modes are: (0) - block uplift 1 - tilt block 2 - gaussian 3 - quadratic 4 - periodic

void LSDRasterModel::set_uplift_field_to_block_uplift ( float  uplift_rate)

This function sets the uplift_field data member as bolck uplift with a rate of uplift_rate.

Parameters
uplift_ratea float of uplift rate, the entire block will uplift at this rate
Author
SMM
Date
03/07/2014
void LSDRasterModel::slope_area_data ( string  name)

Print slope area data Probably fits better into LSDRaster, but requires LSDFlowInfo.

Parameters
requiresa filename
Author
JAJ
Date
01/01/2014
void LSDRasterModel::slope_area_data ( string  name,
int  slope_flag,
int  area_flag 
)

Print slope area data This is an overloaded function that calcualtes slope area data based on flags. There are two flag, one for the slope calculation and one for the area calculation.

The output is a file with four columns Elevation slope area predicted_slope The predicted slope is that based on the SS solution of stream power at the current uplift rate and the current K

Parameters
requiresa filename
aflag for calculation of the topographic slope 0 == polyfit using the data resolution as the smoothing diameter 1 == slope calculated with the D8 slopes, with dx = data resolution or DataResolution*sqrt(2) depending on flow direction.
aflag for calculation of the area 0 == area using contributing pixels but smoothed to data resolution with polyfit 1 == area using contributing pixels only 2 ==
Author
SMM
Date
18/06/2014
void LSDRasterModel::soil_diffusion_fd_linear ( void  )

Soil diffusion using linear flux model

Solved using finite difference

void LSDRasterModel::soil_diffusion_fv ( void  )

Soil diffusion method

Container for all the finite volume components

void LSDRasterModel::superimpose_parabolic_surface ( float  peak_elev)

Adds a parabolic surface to the DEM. Used to try and avoid ;arge areas of fill from the fractal initiation steps.

Parameters
peak_elevThe peak elevation in metres. Is in the middle of the model domain
Author
SMM
Date
11/8/2017
LSDRasterModel LSDRasterModel::uplift_surface ( float  UpliftRate,
float  dt 
)

Apply uplift field to the raster. Overloaded function so that the first simply considers uniform uplift, the second allows user to use a prescribed uplift fields of greater complexity, for example taking account of fault geometry.

WARNING the returned LSDRasterModel only contains a very small subset of the data members of the original LSDRasterModel. Implementation NOT RECOMMENDED!

Parameters
UpliftRatethe rate of uplift at that timestep
dtthe timestep
Returnsan LSDRasterModel of uplift (SMM: why not just update the raster directly??)
Author
JAJ, comments SMM
Date
01/01/2014 SMM comments 26/06/2014
LSDRasterModel LSDRasterModel::uplift_surface ( Array2D< float >  UpliftRate,
float  dt 
)

Uplift surface using specified uplift field uplift field should be specified as an array with the same dimensions as the elevation raster, permitting non-uniform uplift fields to be applied in the model.

WARNING the returned LSDRasterModel only contains a very small subset of the data members of the original LSDRasterModel. Implementation NOT RECOMMENDED!

Parameters
UpliftRatea 2D float array of the uplift. Can be made using the member function generate_uplift_field
dtthe timestep
anLSDRasterModel object (SMM again, why not update the underlying data member of surface elevation?)
Author
JAJ, comments SMM
Date
01/01/2014 SMM comments 26/06/2014
void LSDRasterModel::uplift_surface ( void  )

Intrinsic method of uplifting the Raster Uplift field attribute is incremented onto RasterData itself There are no parameters, but rather it simply passes upflift to the get upflift at cell function.

Uplift is calculated based on data_members max_uplift, timestep and uplift mode. This uses the uplift_mode to determine how uplift is calculated (0) - block uplift 1 - tilt block 2 - gaussian 3 - quadratic 4 - periodic

Author
JAJ commented SMM 26/06/2014
Date
01/01/2014, commented 26/06/2014
void LSDRasterModel::wash_out ( void  )

This assumes that all sediment transported from rivers into channels is removed. It checks the raster to see where the channels are which at this point is determined by a threshold drainage area, and then removes all the sediment to those pixels.

Author
JAJ
Date
01/01/2014
void LSDRasterModel::write_report ( void  )

This method calculates some features of the landscape at set times. The frequency of the reports are set by the data member report_delay One of the things it does is calculates erosion rates, and stores this as a data member.

Author
JAJ
Date
01/01/2014

Member Data Documentation

short LSDRasterModel::D_mode
protected

Whether or not D is periodic D_mode == 1 sine wave D_mode == 2 square wave D_mode == 3 read from file D_mode: default is constant value

short LSDRasterModel::endTime_mode
protected

This is a mode of end times. 0 == default, run until the endTime 1 == run until a specified time after steady state 2 == run a number of cycles 3 == run to steady state, then run some cycles.

short LSDRasterModel::K_mode
protected

Whether or not K is periodic K_mode == 1 sine wave K_mode == 2 square wave K_mode == 3 read from file K_mode: default is constant value

short LSDRasterModel::period_mode
protected

Whether or not there is only one periodicity or two 1 (default) one periodicity used without 2 Two periodicities that switch at a given interval 3 Two periodicities used as a compound sin wave 4 Same as three, but weightings switch at a given interval (as in 2)

map<string,string> LSDRasterModel::RM_method_map

This holds names of methods. For example, if the key is 'sed_transport_law', the string is the method which is used to calculate sediment transport (such as 'wilcock' or 'einstein')

map<string,string> LSDRasterModel::RM_support_file_names

This holds names of supporting files, for example files that contain node of junction indices to be loaded.

Array2D<float> LSDRasterModel::uplift_field
protected

The uplift field, can be used as absolute uplift or uplift rate, depending on the calling member function

int LSDRasterModel::uplift_mode
protected

The mode of uplift. Options are: default == block uplift 1 == tilt block 2 == gaussian 3 == quadratic 4 == periodic


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