In this notebook, we will see how to generate a regular topographic grid for generic cases based on 3 simple geometrical forms:
Combining these simple forms it is possible to create some complex geometries that will have the desired format for running a badlands simulation.
Badlands imports a regular grid that is later triangularized and used to compute erosion and deposition induced by a combination of climate, tectonics and sea-level changes.
In [1]:
%matplotlib inline
# Import badlands grid generation toolbox
import pybadlands_companion.toolGeo as simple
# display plots in SVG format
%config InlineBackend.figure_format = 'svg'
We first initialize the extent of the simulation area.
The function takes 3 arguments:
dx
in metres.For more information regarding the function uncomment the following cell.
In [2]:
#help(simple.toolGeo.__init__)
In [3]:
slope = simple.toolGeo(extentX=[0.,40000.], extentY=[0.,40000.], dx=200.)
In [4]:
#help(slope.buildSlope)
In [26]:
slope.Z = slope.buildSlope(base=0.,slope=0.0, axis='X')
It is possible to have a look at the grid surface using plotly library before proceeding to the creation of the badlands surface.
In [27]:
#help(slope.viewGrid)
In [28]:
slope.viewGrid(width=600, height=600, zmin=0, zmax=1000, zData=slope.Z, title='Export Slope Grid')
Once the surface has been generated, we export a CSV regular grid that will be loaded in the simulation. The file provides for each line the following information:
Note: Nodes must be defined in increasing order from the South/West corner, first along the X axis.
The buildGrid
function takes the return elevation from the buildSlope
function and creates the badlands grid in the appropriate format.
For more information regarding the function uncomment the following cell.
In [29]:
#help(slope.buildGrid)
In [30]:
slope.buildGrid(elevation=slope.Z, nameCSV='mountain/data/slope200')
Now, we move to another surface generation model based on a cosine wave.
Here again, we first initialize the extent of the simulation area.
The function takes 3 arguments:
dx
in metres.For more information regarding the function uncomment the following cell.
In [10]:
#help(simple.toolGeo.__init__)
In [11]:
wave = simple.toolGeo(extentX=[0.,50000.], extentY=[0.,50000.], dx=100.)
We create a wave by defining 3 parameters:
For more information regarding the function uncomment the following cell.
In [12]:
#help(wave.buildWave)
In [13]:
wave.Z = wave.buildWave(A=250., P=20000., base=100., xcenter=25000.)
It is possible to have a look at the grid surface using plotly library before proceeding to the creation of the badlands surface.
In [14]:
#help(wave.viewGrid)
In [15]:
wave.viewGrid(width=600, height=600, zmin=-1000, zmax=1000, zData=wave.Z, title='Export Wave Grid')
Once the surface has been generated, we export a CSV regular grid that will be loaded in the simulation. The file provides for each line the following information:
Note: Nodes must be defined in increasing order from the South/West corner, first along the X axis.
The buildGrid
function takes the return elevation from the buildWave
function and creates the badlands grid in the appropriate format.
For more information regarding the function uncomment the following cell.
In [16]:
#help(wave.buildGrid)
In [17]:
wave.buildGrid(elevation=wave.Z, nameCSV='xyz')
The last example show how to create a half-ellipsoid (dome-shape) surface. The ellipsoid equation center on ($x_o,y_o,z_o$) is of the form:
$$ \frac{(x-x_o)^2}{a^2} + \frac{(y-y_o)^2}{b^2} + \frac{(z-z_o)^2}{c^2} = 1 $$where $a,b,c$ are strictly positives and equal to the lenght of the ellipsoid half axes.
Here again, we first initialize the extent of the simulation area.
The function takes 3 arguments:
dx
in metres.For more information regarding the function uncomment the following cell.
In [18]:
#help(simple.toolGeo.__init__)
In [19]:
dome = simple.toolGeo(extentX=[0.,50000.], extentY=[0.,50000.], dx=100.)
We create the dome wave by defining 6 parameters:
The function buildDome
solves for the given parameters the following equation for the elevation:
For more information regarding the function uncomment the following cell.
In [20]:
#help(dome.buildDome)
In [21]:
dome.Z = dome.buildDome(a=10000., b=20000., c=500., base=100., xcenter=25000., ycenter=25000.)
It is possible to have a look at the grid surface using plotly library before proceeding to the creation of the badlands surface.
In [22]:
#help(dome.viewGrid)
In [23]:
dome.viewGrid(width=600, height=600, zmin=-1000, zmax=1000, zData=dome.Z, title='Export Dome Grid')
Once the surface has been generated, we export a CSV regular grid that will be loaded in the simulation. The file provides for each line the following information:
Note: Nodes must be defined in increasing order from the South/West corner, first along the X axis.
The buildGrid
function takes the return elevation from the buildDome
function and creates the badlands grid in the appropriate format.
For more information regarding the function uncomment the following cell.
In [24]:
#help(dome.buildGrid)
In [25]:
dome.buildGrid(elevation=dome.Z, nameCSV='xyz')
In [ ]: