Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

The next step is to remove the cells that are on land. We can determine this by using our bathymetry data. Add and run the following line to remove the all land cells that have a depth above -2

Code Block
languagepy
titleRemove land cells
CleanupLandCells(fmModel, bathymetryData, -2)

 

The grid should now look something like this:

Image Added

 

The last step is to add the bathymetry to the model (defined as depth at the vertex) with the following lines : 

Code Block
languagepy
titleRemove land cells
values = []

for vertex in fmModel.Grid.Vertices :

    values.append(GetGebcoBathymetryValueFor(vertex.CoordinateValue, 3857, bathymetryData))

    

fmModel.Bathymetry.SetValues(values)

First we declare a variable called values as a list. Then we continue by looping trough the vertices of the grid and calling the function "GetGebcoBathymetryValueFor"  to get the depth value 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