Comments (11)
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.
@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:
from py-eddy-tracker.
ok 2 things:
- When you use pcolormesh in matplotlib, coordinates must be bounds of pixel and not center, so to be correct when you have a matrix of (480,240), x and y have respectively size 481 and 241. But, i think for convenience, matplotlib allows to skip last value and in this case you loose last column and last row.
- When you use
with_array
method, there are no check performed on matrix dimensions and by default object are stored with this dimensions order (x, y)
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.
@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:
from py-eddy-tracker.
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.
@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.
from py-eddy-tracker.
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.
@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.
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.
@AntSimi All right. Now I understand. Thanks for your help~
from py-eddy-tracker.
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)
- Eddy detection issue HOT 3
- batch identification of eddies over multiple days from a single netCDF file HOT 14
- Request for help: No extrema found in contour of xxx pixels in level xxx HOT 6
- Issue reading NEMO UnRegularGrid HOT 2
- grid_count and grid_stat error HOT 2
- The boundary cannot be closed normally, and the longitude and latitude of some points are wrong。 HOT 7
- How to store the eddy tracking results HOT 4
- Data is Empty
- Data is Empty HOT 1
- Cartopy projection HOT 1
- AttributeError: module 'configparser' has no attribute 'SafeConfigParser'. Did you mean: 'RawConfigParser'?
- ValueError: Invalid format string HOT 4
- grid_stat for zonal mean HOT 1
- intern = True and Center = True HOT 4
- No such file or directory: '/home/emason/toto/' HOT 1
- WARNING observation.create_variable : Data is empty && ValueError: zero-size array to reduction operation maximum which has no identity
- Problems encountered during eddy identification process. HOT 2
- Example pet_sla_and_adt.py long line HOT 2
- Help in generating representative contour and save as .nc HOT 5
- sign error in documentation about Okubo Weiss parameter
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from py-eddy-tracker.