Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The question about the data #214

Open
SomnusQue opened this issue Sep 20, 2023 · 5 comments
Open

The question about the data #214

SomnusQue opened this issue Sep 20, 2023 · 5 comments

Comments

@SomnusQue
Copy link

No description provided.

@SomnusQue
Copy link
Author

Dear authors,
I am wondering the data structure about this project. Now, I got a SLA.nc file which could not run the pet_sla_and_adt.py, the reason why that was Coordinates in RegularGridDataset must be strictly increasing. I have been sort the longitude and latitude about this data, should I make sure the data is arithmetic progression?
Best wishes.

@AntSimi
Copy link
Owner

AntSimi commented Sep 20, 2023

could you share ncdump -h of your file?

@SomnusQue
Copy link
Author

SomnusQue commented Sep 21, 2023

Of course, this is our file. Now, the new error that was Cannot convert from 'dimensionless' (dimensionless) to 'meter' ([length])..I'm sorry to trouble you again. Would you please see what the problem is?
By the way, our file don't contains adt data. We just want to detect eddy by SLA..
Best wishes
pred_mra5_20190101_zos.nc.zip

@SomnusQue
Copy link
Author

SomnusQue commented Sep 21, 2023

This is the code which we changed.

"""
Eddy detection on SLA
=============================

"""
from datetime import datetime

from matplotlib import pyplot as plt

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)
    return ax


def update_axes(ax, mappable=None):
    ax.grid()
    if mappable:
        plt.colorbar(mappable, cax=ax.figure.add_axes([0.95, 0.05, 0.01, 0.9]))


g = RegularGridDataset(
    data.get_demo_path("/Users/Maybe/Desktop/pred_mra5_20190101_zos.nc"),
    "longitude",
    "latitude",
)

g.add_uv("prediction", "ugosa", "vgosa")
wavelength = 400
print('here')
g.copy("prediction", "sla_raw")

g.bessel_high_filter("prediction", wavelength)
date = datetime(2019, 1, 1)

kwargs_a_sla = dict(
    lw=0.5, label="Anticyclonic SLA ({nb_obs} eddies)", ref=-10, color="g"
)
kwargs_c_sla = dict(lw=0.5, label="Cyclonic SLA ({nb_obs} eddies)", ref=-10, color="b")

a_sla, c_sla = g.eddy_identification("prediction", "ugosa", "vgosa", date, 0.002)

ax = start_axes(f"SLA (m) filtered ({wavelength}km)" + str(date.date()))
m = g.display(ax, "sla", vmin=-0.15, vmax=0.15)
a_sla.display(ax, **kwargs_a_sla), c_sla.display(ax, **kwargs_c_sla)
ax.legend(), update_axes(ax, m)

ax = start_axes("SLA (m)")
m = g.display(ax, "sla_raw", vmin=-0.15, vmax=0.15)
a_sla.display(ax, **kwargs_a_sla), c_sla.display(ax, **kwargs_c_sla)
ax.legend(), update_axes(ax, m)

ax = start_axes("Eddies detected")
a_sla.display(ax, **kwargs_a_sla)
c_sla.display(ax, **kwargs_c_sla)
ax.legend()
update_axes(ax)
plt.show()

@AntSimi
Copy link
Owner

AntSimi commented Sep 27, 2023

First data.get_demo_path method is only to get demonstration sample, you don't need it for your own data.
You need to specify height and speed unit in eddy_identification method if there is no attribute unit in your netcdf.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants