Skip to content

Running PyTolosa

Two running modes are available: interactive mode and batch mode.

To get the running information:

Terminal window
python3 -m pytolosa -h

The interactive mode enables the user to enter all needed information without listing the arguments manually (see Batch mode below). The user will interact with the program to enter needed information.

Terminal window
pytolosa -i

Or without the PYTHONPATH environment variable:

Terminal window
# Place yourself in the /PyTolosa directory
python3 -m pytolosa -i

Run this post-treatment tool in parallel with 4 MPI processes:

Terminal window
mpirun -np 4 python3 -m pytolosa -i

Without the PYTHONPATH environment variable:

Terminal window
# Place yourself in the /PyTolosa directory
mpirun -np 4 python3 -m pytolosa -i

The batch running mode enables the user to run this post-treatment program without any interaction. The existing running arguments are listed below.

ArgumentDescription
-wdir WDIRWorking Directory (./bin/res/…) with output directories
-c1DRun 1D cases
-c2DRun 2D cases
-tmin TMINSet the time to begin data extraction. Format: Gregorian (YYYY-MM-DD_HH:MM) or Julian CNES date
-tmax TMAXSet the time to stop data extraction. Format: Gregorian (YYYY-MM-DD_HH:MM) or Julian CNES date
-allRun all 1D and/or 2D cases found in directory tree
-del, --deleteClean previous results in working directory
-title TITLESet title for results figures
-ns, --nostreamAccess binary file without stream
-verbose VERBOSEVerbosity level. From 0 to 2

Choose at least one field to extract:

ArgumentField
-hWater depth fields
-sshSea surface height fields
-uHorizontal velocity fields
-vVertical velocity fields
-bathyBathymetry

Arguments for 2D case post-processing:

ArgumentDescription
-hmin HMINMinimum height value considered
-hmax HMAXMaximum height value considered
-sshmin SSHMINMinimum SSH value considered
-sshmax SSHMAXMaximum SSH value considered
-umin UMINMinimum horizontal velocity value considered
-umax UMAXMaximum horizontal velocity value considered
-vmin VMINMinimum vertical velocity value considered
-vmax VMAXMaximum vertical velocity value considered
-bmin BATHYMIN, --bathymin BATHYMINMinimum bathymetry value considered
-bmax BATHYMAX, --bathymax BATHYMAXMaximum bathymetry value considered
ArgumentDescription
-plottype PLOTTYPEPlot type if smaller window is considered: static or dynamic
-xmin XMINSet smaller display window with minimum x coordinate
-xmax XMAXSet smaller display window with maximum x coordinate
-ymin YMINSet smaller display window with minimum y coordinate
-ymax YMAXSet smaller display window with maximum y coordinate
-lonmin LONGITUDEMIN, --longitudemin LONGITUDEMINSet smaller display window with minimum longitude
-lonmax LONGITUDEMAX, --longitudemax LONGITUDEMAXSet smaller display window with maximum longitude
-latmin LATITUDEMIN, --latitudemin LATITUDEMINSet smaller display window with minimum latitude
-latmax LATITUDEMAX, --latitudemax LATITUDEMAXSet smaller display window with maximum latitude
ArgumentDescription
-an_fps AN_FPSAnimation frames per second
-an_ext AN_EXTAnimation extension (default: mp4)
-an_size AN_SIZEAnimation image size (number of horizontal pixels)
-cmap CMAPColormap: new color range. See matplotlib colormap reference
-dpi DPIImage resolution in dots per inch. Default: 400
Terminal window
python3 -m pytolosa -wdir ./bin/res -c2D -h
Terminal window
python3 -m pytolosa -wdir ./results -c1D -ssh

Example 3: Process 2D with Custom Range and Animation

Section titled “Example 3: Process 2D with Custom Range and Animation”
Terminal window
python3 -m pytolosa -wdir ./bin/res -c2D -ssh \
-sshmin -2.0 -sshmax 2.0 \
-an_fps 30 -an_ext mp4 \
-cmap viridis -dpi 600
Terminal window
python3 -m pytolosa -wdir ./results -c2D -h \
-tmin 2024-01-01_00:00 \
-tmax 2024-01-02_00:00
Terminal window
python3 -m pytolosa -wdir ./results -c2D -ssh \
-xmin 0 -xmax 1000 \
-ymin 0 -ymax 500 \
-plottype dynamic
Terminal window
python3 -m pytolosa -wdir ./simulations -all -c2D -h -ssh
Terminal window
mpirun -np 8 python3 -m pytolosa -wdir ./large_simulation -c2D -h -u -v
Terminal window
pytolosa [arguments]

Or without PYTHONPATH:

Terminal window
# Place yourself in the /PyTolosa directory
python3 -m pytolosa [arguments]

Run with 4 MPI processes:

Terminal window
mpirun -np 4 pytolosa [arguments]

Or without PYTHONPATH:

Terminal window
# Place yourself in the /PyTolosa directory
mpirun -np 4 python3 -m pytolosa [arguments]

PyTolosa generates:

  • PNG/PDF plots of time series
  • Located in same directory as input CSV files
  • MP4/AVI/GIF animations (depending on -an_ext)
  • PNG/PDF static frames
  • Located in working directory specified by -wdir

Error: No module named ‘pytolosa’

  • Solution: Check your PYTHONPATH or run from PyTolosa directory

Error: No binary mesh file found

  • Solution: Ensure mesh connectivity file is in the same directory as output files

Error: FFMPEG not found

  • Solution: Install FFMPEG (conda install ffmpeg or apt-get install ffmpeg)

Animation is too slow/fast

  • Solution: Adjust -an_fps parameter (try 20-60 fps)

Colors are washed out

  • Solution: Adjust field min/max values or change colormap