Skip to content

PyTolosa Presentation

Some results generated by Tolosa-sw need to be post-treated. One could generate binary files, csv files with Tolosa, and post-treat them with PyTolosa. The different outputs generated by Tolosa are listed in Tolosa-lib Outputs.

PyTolosa enables the user to post-treat:

  • Two-dimensional data from binary files
  • One-dimensional data from CSV files

In PyTolosa, two running modes are available:

  • Interactive mode - User-guided post-processing
  • Batch mode - Automated processing with command-line arguments

The one dimensional data can be post-treated if it is stored in a .csv file. PyTolosa reads those files and creates plots catching the time evolution of the fields extracted.

Typical 1D outputs:

  • Time series at gauge points
  • Cross-section profiles
  • Discharge evolution
  • Water level variations

1D Output Example

The two dimensional data can be post-treated if it is stored in .bin files. These files each represent the state of the domain at each output time step.

One binary file contains:

  • A key to define the content of the binary file
  • The date (if specified)
  • The minimum and maximum values of the fields
  • The fields values at each cell center

Binary File Key Meanings:

  • key = 0: No date and no min/max values
  • key = 1: No date, but min/max values written
  • key = 2: Date written, no min/max values
  • key = 3: Date and min/max values written

Fields that can be extracted:

  • Sea surface height (SSH)
  • Total water depth (h)
  • Bathymetry
  • Horizontal velocity component (u)
  • Vertical velocity component (v)

PyTolosa post-treats those files by creating an animation of the fields distribution on the domain. PyTolosa needs to read another binary file containing the mesh connectivity. By reading this mesh file and the other binary files (one for each time step), PyTolosa creates an animation in the directory containing those files.

  • Change display window - Zoom on a subdomain by specifying the window (in longitude/latitude or stereo x/y coordinates)
  • Rescale fields - Adjust colorbar and define new field scales
  • Animation settings - Customize extension, frame rate, image size, colormap, and resolution
  • Browsing - Explore working directory to search and post-treat 1D and/or 2D cases automatically

See the System Requirements page for detailed installation instructions.

Main dependencies:

  • Python 3.x
  • Matplotlib
  • NumPy
  • SciPy
  • mpi4py (for parallel post-processing)
  • FFMPEG (for animations)
Terminal window
# Clone the repository
git clone https://github.com/TolosaProject/PyTolosa.git
cd PyTolosa
# Add to PYTHONPATH
export PYTHONPATH=$PYTHONPATH:$(pwd)
Terminal window
# Serial execution
python3 -m pytolosa -i
# Parallel execution (4 processes)
mpirun -np 4 python3 -m pytolosa -i
Terminal window
# Process 2D case with water depth field
python3 -m pytolosa -wdir ./bin/res -c2D -h
# Process 1D case
python3 -m pytolosa -wdir ./bin/res -c1D -ssh