Example 8 - Drawing Particle Travel Paths (ANUGA)¶
In this example, we will use the particles movement simulated in Example 1 - Particles in Steady Flow (ANUGA), and visualize some of the particle travel paths.
Full example script available
First run Example 1 - Particles in Steady Flow (ANUGA), and then we can access and use the particle travel information output by that example.
>>> import numpy as np >>> import os >>> import json >>> from dorado.routines import draw_travel_path >>> data = np.load('ex_anuga_data.npz') >>> depth = data['depth'] >>> all_walk_data = json.load(open('steady_anuga_example'+os.sep+'data'+os.sep+'data.txt'))
Now we will apply the draw_travel_path function. In this example we are going to visualize the travel paths of the first 4 particles, indicated by the list we are providing to the draw_travel_path function. We will show every other iteration to visually simplify the path, controlled by interval parameter.
>>> draw_travel_path(depth, all_walk_data, [0, 1, 2, 3], >>> 'steady_anuga_example'+os.sep+'figs'+os.sep+'travel_paths.png', >>> interval=2, plot_legend=True)