You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 14 Next »

To add the bathymetry, we will employ the Gebco data set, as used in Delft dashboard. The following code retrieves the bathymetry data from the Gebco data set using the extent of our grid. The coordinate system EPSG code is required because the data set uses a specific (different) coordinate system.

Get bathymetry data
bathymetryData = GetGebcoBathymetryData(xOffset, yOffset, xOffset + gridWidth, yOffset + gridHeigth, EPSGCode)

Next, the cells that are located on land will be removed. This can be determined from the bathymetry data. The CleanupLandCells method removes all land cells that have a z coordinate larger than a certain value. In our case, above sea level, so z > 0.

Remove land cells
CleanupLandCells(fmModel, bathymetryData, 0)

The grid should now be trimmed along the coastline.

Then, the bathymetry (defined as elevation, z coordinate, at the vertex) will be added to the model. This is done by first declaring a variable values as a list. Then, we continue by looping trough the vertices of the grid and calling the function GetGebcoBathymetryValueFor  ( ) to obtain the elevation on the location of the vertex and adding it to the list. Finally, we add the bathymetry values to the model by using the SetValues method on the bathymetry property of the model.

Add bathymetry to model
values = []
for vertex in fmModel.Grid.Vertices :
    values.append(GetGebcoBathymetryValueFor(vertex.CoordinateValue, 3857, bathymetryData))

fmModel.Bathymetry.SetValues(values)

The bathymetry just defined can be seen by double clicking on the corresponding item of the project explorer panel.

Note: The icon  indicates functions that you might find interesting to see how they have been built. You can do this by opening the corresponding library (another normal script python file on its own) in the toolbox and checking the code which defines the function or method you are interested in.

 

 

 

  • No labels