AntSimi / py-eddy-tracker

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

intern = True and Center = True #242

Closed berzinastella closed 1 month ago

berzinastella commented 1 month ago

Hello,

I'm a bit confused about the inter and center parameters that you can add to grid_count function. Could you explain their functions a bit more?

For example, I read in the past issues that "If you specify center=True grid_count method count how many center are in each pixel. If center=False method count how many time a pixel are enclosed in an eddy contour." This would make me think that for eddy birth and death plots, if I specify center=True then I would get lower eddy frequency because only the eddy centres count. If I set center=False, I should het higher eddy frequency in each cell. Is my thinking correct? When I try this out, I get the opposite results:

t0, t1 = a_16wobs.period
step = 3
bins = ((-180, 180, step), (-85, 85, step))
kwargs = dict(cmap="terrain_r", name="count")

ax = start_axes("Birth cyclonic frenquency (%)")
g_c_first = a_16wobs.first_obs().grid_count(bins, intern=False, center=True)
m = g_c_first.display(ax, **kwargs)
update_axes(ax, m)
Screenshot 2024-05-31 at 10 11 40
ax = start_axes("Birth cyclonic frenquency (%)")
g_c_first = a_16wobs.first_obs().grid_count(bins, intern=False, center=False)
m = g_c_first.display(ax, **kwargs)
update_axes(ax, m)
Screenshot 2024-05-31 at 10 12 22

Why does this happen?

Additionally, do I understand the inter=True/False meaning correctly- if intern=False then effective contour is considered. If intern=True then speed contour is considered. Is that correct??

Thank you !

Best, Stella

AntSimi commented 1 month ago

There is two method to count eddy, come with own advantages: center = True allow a quick compute, but small or big eddies are not differentiate and this method is sensitiv to grid resolution. center = False need more compute time but will correct effects listed upper, but if you choose a coarse grid pixel center position won't be inside contour. For center = False you must use a fine resolution for grid like 1/4 ° or tinier and number will increase. Second things you plot absolute count and not frequency.

Additionally, do I understand the inter=True/False meaning correctly- if intern=False then effective contour is considered. If intern=True then speed contour is considered. Is that correct??

Correct

berzinastella commented 1 month ago

ok, so center = False counts the pixel only if it is fully covered by the eddy contour? If the eddy contour covers only half of the pixel then it is not counted in?

Thanks for the quick and helpful answer!

AntSimi commented 1 month ago

Not fully covered, only center of pixel in contour, that why a very fine grid resolution could be best like 1/10°. Limit of this parameter is time computing.

berzinastella commented 1 month ago

Thanks!!