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

pixel position of grid #219

Closed Eddysearcher closed 8 months ago

Eddysearcher commented 8 months ago

Bug report

Bug summary

Hello dear author, I encountered this issue while running the code.

Code for reproduction

# Paste your code here
#from datetime import datetime

from matplotlib import pyplot as plt
from numpy import arange

from py_eddy_tracker import data
from py_eddy_tracker.dataset.grid import RegularGridDataset
def start_axes(title):
    fig = plt.figure(figsize=(13, 5))
    ax = fig.add_axes([0.03, 0.03, 0.90, 0.94])
    ax.set_xlim(-6, 36.5), ax.set_ylim(30, 46)
    ax.set_aspect("equal")
    ax.set_title(title, weight="bold")
    return ax

def update_axes(ax, mappable=None):
    ax.grid()
    if mappable:
        plt.colorbar(mappable, cax=ax.figure.add_axes([0.94, 0.05, 0.01, 0.9]))
g = RegularGridDataset(
    data.get_demo_path(r"E:\data\pet_eddy\data\dt_med_allsat_phy_l4_20160515_20190101.nc"),
    "longitude",
    "latitude",)

ax = start_axes("ADT (m)")
m = g.display(ax, "adt", vmin=-0.15, vmax=0.15, cmap="RdBu_r")
update_axes(ax, m)

ax = start_axes("ADT closed contours (only 1 / 4 levels)")
g.contours.display(ax, step=4)
update_axes(ax)

#

Actual outcome

image



**Expected outcome**

<!--A description of the expected outcome from the code snippet-->
Eddysearcher commented 8 months ago

Error: We assume pixel position of grid is centered for E:\data\pet_eddy\data\dt_med_allsat_phy_l4_20160515_20190101.nc

AntSimi commented 8 months ago

If you use matplotlib 3.8 or newer try previous version, right now pyeddytracker doesn't work with matplotlib >=3.8.

AntSimi commented 8 months ago

Link to #216

Eddysearcher commented 8 months ago

I sincerely appreciate your invaluable assistance. Your support means a lot to me.