Explore the notebooks to learn how to do pre and post-treatment
February 26, 2026

Explore the notebooks to learn how to do pre and post-treatment

The openTELEMAC system comes with Python scripts for preprocessing calculations, running them, and postprocessing the results. In addition, notebooks are provided to give users an overview of how to use these scripts.

Example of plotting a grid and water depth for the Malpasset test case using existing Python scripts (excerpt from the notebook example_plot2d_advanced.ipynb)

python# Initialising Telemac file 
file_name = path.join(environ['HOMETEL'], 'examples', 'telemac2d', 'malpasset', 'f2d_malpasset-kin1.slf')
bnd_file = path.join(environ['HOMETEL'], 'examples', 'telemac2d', 'malpasset', 'geo_malpasset-small.cli')
res = TelemacFile(file_name, bnd_file=bnd_file)
H = res.get_data_value('WATER DEPTH', -1)

# Initialising matplotlib figure
fig, ax = plt.subplots(1, 1, figsize=(20, 10))
ax.set_aspect('equal')

# Plotting mesh
plot2d_triangle_mesh(ax, res.tri, color='k', linewidth=0.1)

# Define mask to hide dry zones in scalar 2d map
mask = mask_triangles(res.tri, H, relation='leq', threshold=0.01)
res.tri.set_mask(mask)

plot2d_scalar_map(fig, ax, res.tri, H, data_name='water depth (m)', vmax=10)

# Defining labels
ax.set_title('Malpasset, result at time: %d s'%res.times[0])
ax.set_xlabel('X-coordonate (m)')
ax.set_ylabel('Y-coordonate (m)')

# Showing the plot
plt.show()
plt.close(fig)

# Reset mask
res.tri.set_mask(None)
del res
Explore the notebooks to learn how to do pre and post-treatment | openTELEMAC