GithubHelp home page GithubHelp logo

Comments (11)

AntSimi avatar AntSimi commented on August 17, 2024

Hi,
You could do identification only with numpy matrix if you want, but you need to control all step manually:

  • Remove large scale (with a filter) to highlight eddy hill/hole
  • Specify unit
  • Provide current grid on same position than height
  • Save output

To create a GridDataset object with numpy array:

from py_eddy_trakce.dataset.grid import RegularGridDataset
regular_grid = RegularGridDataset.with_array(
    coordinates=(lon_name, lat_name),
    datas=dict(
        grid_name=z,
        lon_name=lon,
        lat_name=lat,
        ...
    )
)

And with this object you must do something similar to this example.

Antoine

from py-eddy-tracker.

liu-ran avatar liu-ran commented on August 17, 2024

@AntSimi Many thanks! But I found that the 'with_array' seems to return a wrong lat/lon dimensions. For example, I input the lon with shape (480,), but the 'with_array' return the lon with (481,) and then fail to pain. My code is as follow:

微信图片_20210107202044

微信图片_20210107202034

from py-eddy-tracker.

AntSimi avatar AntSimi commented on August 17, 2024

ok 2 things:

working test

import numpy as np
from py_eddy_tracker.dataset.grid import RegularGridDataset
from matplotlib import pyplot as plt
g = RegularGridDataset.with_array(('x','y'), dict(z=np.ones((30,60)),x=np.arange(30), y=np.arange(60)))
ax=plt.subplot(111)
g.display(ax, 'z')
plt.show()

test with same error than you

If i transpose matrix, so dimension order is like this : (y,x), i get same error, problem come from dimension order and not dimensions size.

import numpy as np
from py_eddy_tracker.dataset.grid import RegularGridDataset
from matplotlib import pyplot as plt
g = RegularGridDataset.with_array(('x','y'), dict(z=np.ones((30,60)).T,x=np.arange(30), y=np.arange(60)))
ax=plt.subplot(111)
g.display(ax, 'z')
plt.show()

from py-eddy-tracker.

liu-ran avatar liu-ran commented on August 17, 2024

@AntSimi You are right. That's great! I still have a question. How to make the z has an attribute 'mask'. If it doesn't have this attribute, the g.add_uv('z') would fail to run.

g = RegularGridDataset.with_array(('x','y'), dict(z=np.ones((30,60)).T,x=np.arange(30), y=np.arange(60)))

The error information about the 'mask' is as follow:
微信图片_20210108010033

from py-eddy-tracker.

AntSimi avatar AntSimi commented on August 17, 2024

In most of case you have land on grid and this land is masked with ma.array from numpy.
In py eddy tracker software, we do the assumption that grid have a mask, when we load netCDF, software check this feature and add mask if needed.
In your case you must do manually, something like that in case of grid which are only on ocean:

from numpy import ma, zeros
etacache = ma.array(etacache, mask=zeros(etacache.shape, dtype="bool"))

In case of nan use, replace nan by a mask.

from py-eddy-tracker.

liu-ran avatar liu-ran commented on August 17, 2024

@AntSimi Awesome! Thank you very much! I read the add_uv code and found that the x_c and y_c should be degrees. But my model grid is a rectangle grid with 2400km*1200km as the picture shows. I will try to input the geostrophic u and the v by myself and then see if the eddy identification can work. The py-eddy-traker sofaware is so great that I really want to apply it to detect the eddies in my model simulation. Thanks again for your help.

微信图片_20210108173644

from py-eddy-tracker.

AntSimi avatar AntSimi commented on August 17, 2024

Ok, your grid seems not to be a RegularGrid for my mind, your longitude and latitude are not degrees evenly spaced.
So normaly you must use UnregularGridDataset like in issue #5 but i didn't test with_array method in this class.
You need degrees coordinates in lot of function not only for speed.
Maybe some more work are needed, like allow with_array method for UnregularGrid.

Antoine

from py-eddy-tracker.

liu-ran avatar liu-ran commented on August 17, 2024

@AntSimi Hi, I'm worried that my description is not accurate due to my poor English.

your grid seems not to be a RegularGrid for my mind, your longitude and latitude are not evenly spaced.

My grid is evenly spaced with 5km resolution. The X-axis is 2400km and reentrant. The Y-axis is 1200km.

You need degrees coordinates in lot of function not only for speed.

Does the eddyidentification also need degrees coordinates? I'm considering making degree coordinates approximately for my model domain according to the Coriolis parameter.

from py-eddy-tracker.

AntSimi avatar AntSimi commented on August 17, 2024

Hi,

Software current version need coordinates in degrees!

This software was in first place think to be apply on CMEMS altimetry product, which are regular grid in degrees. So most of features was thinking for that. In second time we add feature to use "unregular grid" not evenly spaced in degrees (you need a 2D array for each coordinates instead of an 1D array).

Antoine

from py-eddy-tracker.

liu-ran avatar liu-ran commented on August 17, 2024

@AntSimi All right. Now I understand. Thanks for your help~

from py-eddy-tracker.

AntSimi avatar AntSimi commented on August 17, 2024

I think your goals are achievable without too many changes to your data or code. Just keep in mind that the UnregularGridDataset class is poorer in functionality (especially for filtering) for eddy detection. After that it doesn't change anything for tracking.

Antoine

from py-eddy-tracker.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.