Logic of different functions used in the evaluation of gully
From GeoMod
[edit]
Different functions used in my project till now are
- Creating a class and coding following function in that class.
- Creating a hypothetical area of several cells similar to class program of making tiles. To have undulating surface the elevation of different cells are choosen random. And to make sure that every time same random elevation number is selected by code the 'seed' function is used.
- The 'slope' function is created in this class to give general slope to the surface. A two dimensional array is created to store the values of slope of each cell.
- The 'ij_number' function is created to know corresponding to particular row and column number what is the number of the cell. A variable 'num' is used starting with initial value of zero and it's value keep on incrementing in a loop. The loop startes from zero row and zero column and ends at last row and last column cell. The value of each row and column finally stores in a 2D array 'Num'.
- The 'number_ij' function is opposite to the function 'ij_number'. In this function if we know the number of particular cell then the corresponding row and column will be determined. The logic in this code is that divide the number of that cell by distance between two adjacent cells (the spacing between cells in x and y direction is same). If it is less than 1 then the row is 1 and column is one less than the vlaue of number. Similarly, if the division is between 4 and 5 then the row number is 4 and column number is (number -4*self.nx-1) where self.nx is the total number of columns.
- The 'rc_xy' function is coded to convert the given row and column to corresponding x and y co-ordinates. The logic of doing this self.x=self.xmin+self.dx/2.0+((self.dx)*C) and self.y=self.ymax-self.dx/2.0-((self.dx)*R) where self.x and self.y are the x co-ordinate and y co-ordinate resp. The self.xmin is the minimum x co-ordinate and self.ymax is the maximum y co-ordinate both co-ordinates being at the top left portion of the topography.
- The 'catchment' function is coded to determine the lowest elevation cells in the topography to which water and sediment from other cells acts as catchment to this cell. In this function the boundary cells are not included. Two for loops are created which run from first row and first column uptill second last row and column. This for loop calls another function 'LowTrace' for every value of row and column. This LowTrace function further calls another function 'LowRC' in which in a window of 3x3 cells surronding the given row and column the lowest elevation cell is computed. The value of this low row and low column is stored in a 2D array r_out and c_out resp. The lowest elevation is stored in array cr_out. The logic for finding the lowest cell is first by assuming that the value of given row and column is the lowest and if within 3x3 window any value is lower than this value then that value will be the lowest value.
- The 'watershed' function is coded to detwemine how many surronding cells are contributing to the lowest elevation cell found in the 'catchment' function. The logic in this function is first assuming that initially every cell has catchment of it's own cell that is 1. If that cell is also the lowest cell then the catchment will be incremented by one. This process is keep on repeating for the whole topography till there is no change in the values. These values are stored in 2D array counter[i,j].
- The 'localSlope' function is coded to calculate the local slope between the given cell and the corresponding lowest cell to it which was already computed using catchment function.
- The 'sediTrans' function is coded to calculate the sediment transport capacity of all the cells whose catchment is greater than 1. It is a big equation taken from paper of Istanbulluoglu E., Tarboton D., Pack R., 2003. A sediment transport model for incision of gullies on steep topography. Water Resources Research Vol. 39, No. 4. At present i'd taken the values of some variables as listed in this paper.
- The 'eroht1' function is coded to calculate the erosion height in cells. It is calculated by dividing the sediment volume in that cell by the area of the cell. In present case the area of all the cells are same. The height of cell is multiplied by gully incision time.
- The 'chgele' function is coded to compute the change in the evelation of the topography after the eroding the height of that cell from the amount of the erosion height. At present i'm assuming there is no deposition in the topography what ever is eroded is going out of the topography.
- The 'newdisp' function is coded to create another display for the final eroded topography.
- Finally this class 'area' having all these function is called from the main function giving the values for number of rows, number of columns, distance between two consecutive cells. The functions from catchment to newdisp were called again in a loop till the desired number of iteration. This is done to have some considrable amount of erosion in the topography.

