The trajectory_plot module¶
Introduction¶
The objective of this code is to plot or animate in various ways the trajectories and trajectory families generated by The trajectory_compute module.
An example of its use, after running the code example in The trajectory_compute module is:
from trajectory_plots import *
traj_list = tfm.family
traj_m = traj_list[-1]
sel_list = np.array([14, 44, 72, 74, 79, 85, 92])
mean_prop = traj_m.cloud_properties(version = 1)
for cloud in sel_list :
plot_traj_animation(traj_m, save_anim=False, \
anim_name='traj_cloud_{:03d}_class'.format(cloud), \
select = np.array([cloud]), fps = 10, \
no_cloud_size = 0.2, cloud_size = 2.0, legend = True, \
title = 'Reference Time {0} Cloud {1} Galilean Trans'.\
format(last_ref_time, cloud), with_boxes = False,
galilean = np.array([-8.5,0]), \
plot_class = mean_prop['class'],\
version = mean_prop['version'])
Detailed Module Contents¶
The entire module is documented below.
-
trajectory_plot.
plot_traj_animation
(traj, save_anim=False, anim_name='traj_anim', legend=False, select=None, galilean=None, plot_field=False, dir_override=None, title=None, plot_class=None, no_cloud_size=0.2, cloud_size=2.0, field_size=0.5, fps=10, with_boxes=False)¶ Function to plot animation of trajectories.
- Parameters
traj – Trajectory set object.
save_anim (bool) – If True, create mpeg animation file.
anim_name (string) – Name of animation file. Default is ‘traj_anim’.
legend (bool) – If True, include legend.
select (int) – ID of object to plot.
galilean (Array[2]) – Array with u and v components of system velocity to apply Galilean Transformation to plot. Default in None.
plot_field (bool) – If True also plot Eulerian field of cloud.
dir_override (string) – Override original directory for file names contained in traj.
title (string) – Title for plot. Default is None.
plot_class – Dict of Classifications of trajectory points provided by set_cloud_class function.
no_cloud_size – Size of symbols used to plot non-cloudy points. Default is 0.2.
cloud_size – Size of symbols used to plot cloudy points. Default is 2.0.
field_size – Size of symbols used to plot Eulerian cloud points. Default is 0.5.
fps (int) – Frames per second in animation. Default is 10.
with_boxes (bool) – If True, include cloud box in plots.
- Returns
Nothing
@author: Peter Clark
-
trajectory_plot.
plot_traj_family_animation
(traj_family, match_index, overlap_thresh=0.02, save_anim=False, anim_name='traj_anim', legend=False, title=None, select=None, super_obj=None, galilean=None, plot_field=False, dir_override=None, no_cloud_size=0.2, cloud_size=2.0, field_size=0.5, fps=10, with_boxes=False)¶ Function to plot animation of members of trajectory family.
- Parameters
traj_family – Trajectory_family object.
match_index – Index of time to match selected objects. If positive, matching object comes from traj_family.matching_object_list_summary If negative and super_obj is None, matching object comes from traj_family.find_linked_objects If negative and super_obj is not None, matching object comes from super_obj
save_anim (bool) – If True, create mpeg animation file.
anim_name (string) – Name of animation file. Default is ‘traj_anim’.
legend (bool) – If True, include legend.
title (string) – Title for plot. Default is None.
select (int) – IDs of objects to plot. None gives all objects.
super_obj – Super objects provided by traj_family.find_super_objects
galilean (Array[2]) – Array with u and v components of system velocity to apply Galilean Transformation to plot. Default in None.
plot_field (bool) – If True also plot Eulerian field of cloud.
dir_override (string) – Override original directory for file names contained in traj.
no_cloud_size – Size of symbols used to plot non-cloudy points. Default is 0.2.
cloud_size – Size of symbols used to plot cloudy points. Default is 2.0.
field_size – Size of symbols used to plot Eulerian cloud points. Default is 0.5.
fps (int) – Frames per second in animation. Default is 10.
with_boxes (bool) – If True, include cloud box in plots.
- Returns
Nothing
@author: Peter Clark
-
trajectory_plot.
plot_traj_family_members
(traj_family, selection_list, galilean=None, with_boxes=False, asint=True, no_cloud_size=0.2, cloud_size=2.0)¶ Function to plot animation of members of trajectory family.
- Parameters
traj_family – Trajectory_family object.
selection_list (int) – IDs of objects to plot.
galilean (Array[2]) – Array with u and v components of system velocity to apply Galilean Transformation to plot. Default in None.
with_boxes (bool) – If True, include cloud box in plots.
asint (bool) – Round x,y,z to nearest integer (grid point).
no_cloud_size – Size of symbols used to plot non-cloudy points. Default is 0.2.
cloud_size – Size of symbols used to plot cloudy points. Default is 2.0.
field_size – Size of symbols used to plot Eulerian cloud points. Default is 0.5.
- Returns
Nothing
@author: Peter Clark
-
trajectory_plot.
plot_traj_pos
(traj, index, fn, save=False)¶ Function to plot a single 3D plot of a set of trajectories at a given time.
- Parameters
traj – trajectory set object.
index (integer) – Time index.
fn – Root file name for save figures.
save (bool) – Save figure.
- Returns
Nothing
@author: Peter Clark
-
trajectory_plot.
plot_trajectory_history
(tr, select_obj, fn)¶ Function to plot variables history of all trajectories in an object.
- Parameters
tr – trajectory set object.
select_obj (integer) – ID of object to plot.
fn – root file name for save figures.
- Returns
Nothing
- Plots:
“w”,”th”,”q_vapour”,”q_cloud_liquid_mass”,”theta_L”,”q_t” against height and time, height vs time and3D history of cloudy points.
@author: Peter Clark
-
trajectory_plot.
plot_trajectory_mean_history
(tr, traj_cl, mean_prop, fn, select=None, obj_per_plt=10)¶ Function to plot variables mean history of cloudy points.
- Parameters
tr – trajectory set object.
mean_prop (dict) – Mean properties provided by tr.mean_properties().
fn – root file name for save figures.
select (integer) – ID of object to plot. Default plots all objects.
obj_per_plt (integer) – Number of objects to plot before starting new frame.
- Returns
Nothing
- Plots:
“w”,”th”,”q_vapour”,”q_cloud_liquid_mass”,”theta_L”,”q_t”,”mse” plus mse loss and various entrainment and detrainment parameters.
@author: Peter Clark