AntSimi / py-eddy-tracker

Eddy identification and tracking
https://py-eddy-tracker.readthedocs.io/en/latest/
GNU General Public License v3.0
131 stars 55 forks source link

Observation Flag #110

Closed Ashwitaa closed 2 years ago

Ashwitaa commented 3 years ago

Dear Antoine,

Could you please help me in understanding how the “observation_flag” is used in the code?

Thanks…

AntSimi commented 3 years ago

Hi,

observation_flag is an output of tracking:

Ashwitaa commented 3 years ago

My concern is: why I don't see the flag = 1, even when I am using the Virtual length in the tracking? where, I see the differences with different virtual lengths: 1, 2, or 3 but I don't see the flag = 1, when I am trying to see it in the map!

I don't understand why the flag = 0 for all different cases of virtual lengths…

Could you please help me with this?

AntSimi commented 3 years ago

if you want more help maybe share data or/and graph to show problems

Ashwitaa commented 3 years ago

Anticyclonic_VL01.nc.zip Cyclonic_VL01.nc.zip Anticyclonic_VL03.nc.zip Cyclonic_VL03.nc.zip

T5V1_T5V3

I have attached the tracked files: with virtual length (VL) of 1 day and 3 days, and minimum track duration of 5 days. The tracking is done along isopycnal 27.86

The figure attached above shows the tracked eddies (at one time step) the differences are highlighted with the green ellipses here, in the attached plot I tried to see the structures with flag = 1 but, we see nothing whereas, if I choose to look for flag = 0, I see the whole map with detected eddies…

AntSimi commented 3 years ago

Ok quick answers, Flagged observation(virtual) haven't contour, you could fill those contours with this function if you use python module(doc here). I will look to the data later

AntSimi commented 3 years ago

Flag looks good. I looked at some contours, their shape seems very irregular, are you happy with that?

Ashwitaa commented 3 years ago

The contour definition is okay for me. But, I unable to see the flagged (flag=1) contour

AntSimi commented 3 years ago

Here, some examples to show virtual, i hope it will help you

from py_eddy_tracker.observations.tracking import TrackEddiesObservations
from matplotlib import pyplot as plt
from py_eddy_tracker import gui
# Load data
anticyclonic = TrackEddiesObservations.load_file('Anticyclonic_VL01.nc')

Display percent of virtual

def start_axes(title):
    fig = plt.figure(figsize=(8, 8))
    ax = fig.add_axes([0.03, 0.03, 0.90, 0.94], projection='full_axes')
    ax.set_xlim(-100, 20), ax.set_ylim(-70, 70)
    ax.set_aspect("equal")
    ax.set_title(title)
    return ax
# Compute percent of virtual/flaged observations by box
step = 2
g = anticyclonic.grid_stat(((-100, 20, step), (-70, 70, step)), "virtual")
g.vars["virtual"] *= 100
ax = start_axes("Percent of virtual by box of %s°" % step)
m = g.display(ax, name="virtual", vmin=0, vmax=20)
ax.grid()
cb = plt.colorbar(m, cax=ax.figure.add_axes([0.94, 0.05, 0.01, 0.9]))
cb.set_label("Percent of virtual (%)")

output_4_0

Display virtual/flagged observations for one track

# Compute number of virtual by track
i_track_max = anticyclonic.count_by_track(anticyclonic.observation_flag).argmax()
# Get track id for track which contains the highest number of virtual
track = anticyclonic.first_obs().track[i_track_max]
# Extract selected track
selected_track = anticyclonic.extract_ids([track])
fig = plt.figure(figsize=(10,8))
ax = fig.add_subplot(111)
m = selected_track.filled(ax, 'time', cmap='Spectral_r', alpha=.35)
plt.colorbar(m)
selected_track.plot(ax)
# Yellow scatter => virtual/flagged obs
# Blue scatter => detected eddies
selected_track.scatter(ax, 'observation_flag',s=60)
ax.set_xlim(306.4,307)
ax.set_ylim(12.6,13.1)
ax.grid()
ax.set_aspect('equal')

output_6_0

CoriPegliasco commented 3 years ago

Hi, I don't know if you had the answer you needed, but for the figure you posted: On the left you plot the eddies involved in trajectories lasting more than 5 days with 1 virtual observation at most On the right you plot the eddies involved in trajectories lasting more than 5 days with 3 virtual observation at most -> the eddies that are present on the right but not on the left are eddies detected (thus not virtual) that are linked to other observations in trajectories using more than 1 virtual observations. They exist in the detection but can't be linked in trajectories with only 1 virtual observation, they need more virtual observations.

To visualize the virtual observations you can add a circle as contour with : anticyclonic = TrackEddiesObservations.load_file('Anticyclonic_VL01.nc') anticyclonic.circle_contour(only_virtual=True)