|
16 | 16 | """
|
17 | 17 |
|
18 | 18 | import py_eddy_tracker_sample
|
| 19 | +from matplotlib import pyplot as plt |
| 20 | +from numpy import arange, outer |
19 | 21 |
|
20 |
| -from py_eddy_tracker.data import get_demo_path, get_remote_demo_sample |
| 22 | +from py_eddy_tracker.data import get_demo_path |
21 | 23 | from py_eddy_tracker.observations.network import NetworkObservations
|
22 | 24 | from py_eddy_tracker.observations.observation import EddiesObservations, Table
|
23 | 25 | from py_eddy_tracker.observations.tracking import TrackEddiesObservations
|
|
58 | 60 | # ---------------
|
59 | 61 | # All contours are stored on the same number of points, and are resampled if needed with an algorithm to be stored as objects
|
60 | 62 |
|
| 63 | +# %% |
| 64 | +# Speed profile storage |
| 65 | +# --------------------- |
| 66 | +# Speed profile is an interpolation of speed mean along each contour. |
| 67 | +# For each contour included in eddy, we compute mean of speed along the contour, |
| 68 | +# and after we interpolate speed mean array on a fixed size array. |
| 69 | +# |
| 70 | +# Several field are available to understand "uavg_profile" : |
| 71 | +# 0. - num_contours : Number of contour in eddies, must be equal to amplitude divide by isoline step |
| 72 | +# 1. - height_inner_contour : height of inner contour used |
| 73 | +# 2. - height_max_speed_contour : height of max speed contour used |
| 74 | +# 3. - height_external_contour : height of outter contour used |
| 75 | +# |
| 76 | +# Last value of "uavg_profile" is for inner contour and first value for outter contour. |
| 77 | + |
| 78 | +# Observations selection of "uavg_profile" with high number of contour(Eddy with high amplitude) |
| 79 | +e = eddies_collections.extract_with_mask(eddies_collections.num_contours > 15) |
| 80 | + |
| 81 | +# %% |
| 82 | + |
| 83 | +# Raw display of profiles with more than 15 contours |
| 84 | +ax = plt.subplot(111) |
| 85 | +_ = ax.plot(e.uavg_profile.T, lw=0.5) |
| 86 | + |
| 87 | +# %% |
| 88 | + |
| 89 | +# Profile from inner to outter |
| 90 | +ax = plt.subplot(111) |
| 91 | +ax.plot(e.uavg_profile[:, ::-1].T, lw=0.5) |
| 92 | +_ = ax.set_xlabel("From inner to outter contour"), ax.set_ylabel("Speed (m/s)") |
| 93 | + |
| 94 | +# %% |
| 95 | + |
| 96 | +# If we normalize indice of contour to set speed contour to 1 and inner contour to 0 |
| 97 | +ax = plt.subplot(111) |
| 98 | +h_in = e.height_inner_contour |
| 99 | +h_s = e.height_max_speed_contour |
| 100 | +h_e = e.height_external_contour |
| 101 | +r = (h_e - h_in) / (h_s - h_in) |
| 102 | +nb_pt = e.uavg_profile.shape[1] |
| 103 | +# Create an x array for each profile |
| 104 | +x = outer(arange(nb_pt) / nb_pt, r) |
| 105 | + |
| 106 | +ax.plot(x, e.uavg_profile[:, ::-1].T, lw=0.5) |
| 107 | +_ = ax.set_xlabel("From inner to outter contour"), ax.set_ylabel("Speed (m/s)") |
| 108 | + |
| 109 | + |
61 | 110 | # %%
|
62 | 111 | # Trajectories
|
63 | 112 | # ------------
|
|
86 | 135 | # - next_obs : Index of the next observation in the full dataset, if -1 there are no next observation (the segment ends)
|
87 | 136 | # - previous_cost : Result of the cost function (1 is a good association, 0 is bad) with previous observation
|
88 | 137 | # - next_cost : Result of the cost function (1 is a good association, 0 is bad) with next observation
|
89 |
| -eddies_network = NetworkObservations.load_file( |
90 |
| - get_remote_demo_sample( |
91 |
| - "eddies_med_adt_allsat_dt2018_err70_filt500_order1/Anticyclonic_network.nc" |
92 |
| - ) |
93 |
| -) |
| 138 | +eddies_network = NetworkObservations.load_file(get_demo_path("network_med.nc")) |
94 | 139 | eddies_network.field_table()
|
95 | 140 |
|
96 | 141 | # %%
|
|
0 commit comments