Comments (2)
First, i am not familiar with ORCAGrid.I don't know if all ORCAGrid have jump in nav_lon.
Solution given below isn't added for now in py-eddy-tracker(PET), but anyone could use with current version of PET.
Explanations
Problem are due to nav_lon have jump around indice 450. Matplolib contour function doesn't work with this nav_lon. This function provide big contour which are not usable for detection. shift of nav_lon seems to be enough to have correct identification.
Warnings for ORCAGrid
- UnregularGrid doesn't try to close around sphere, so identification at grid border could be not accurate
- I didn't check identification result at high latitude near of ORCAGrid closing, above Russia and Canada
Solution used
I rewrote load function to add two lines to shift a part of nav_lon
import pylook
from netCDF4 import Dataset
from matplotlib import pyplot as plt
from datetime import datetime
from py_eddy_tracker import start_logger
from py_eddy_tracker.dataset.grid import UnRegularGridDataset
class ORCAGrid(UnRegularGridDataset):
def load(self):
"""Load variable (data)
"""
x_name, y_name = self.coordinates
with Dataset(self.filename) as h:
self.x_dim = h.variables[x_name].dimensions
self.y_dim = h.variables[y_name].dimensions
sl_x = [self.indexs.get(dim, slice(None)) for dim in self.x_dim]
sl_y = [self.indexs.get(dim, slice(None)) for dim in self.y_dim]
self.vars[x_name] = h.variables[x_name][sl_x]
self.vars[y_name] = h.variables[y_name][sl_y]
self.x_c = self.vars[x_name]
###
# To avoid jump of longitude, needed for file in example
x_v = self.x_c[:,:500]
x_v[x_v > 0] -= 360
###
self.y_c = self.vars[y_name]
self.init_pos_interpolator()
if __name__ == '__main__':
start_logger().setLevel('DEBUG')
grid_name = 'GIOPS_NativeGrid_20200424.nc'
lon_name, lat_name = 'nav_lon', 'nav_lat'
# Must be set with time of grid
date = datetime(2020, 4, 24)
# Identification every 2 mm
args = ('sla', 'u', 'v', date, .002)
kwargs = dict(pixel_limit=(5, 2000), shape_error=55)
# without filter
h = ORCAGrid(grid_name, lon_name, lat_name, indexs=dict(time=0))
a_unfiltered, c_unfiltered = h.eddy_identification(*args, **kwargs)
# with filter
h = ORCAGrid(grid_name, lon_name, lat_name, indexs=dict(time=0))
# Ugly filter for unregular
h.high_filter('sla', 500)
a, c = h.eddy_identification(*args, **kwargs)
# plot
ax = plt.subplot(111, projection='plat_carre')
ax.grid()
kwargs_display = dict(lw=.5)
a_unfiltered.display(ax, label='Anticyclonic unfiltered', color='r', **kwargs_display)
c_unfiltered.display(ax, label='Cyclonic unfiltered', color='b', **kwargs_display)
a.display(ax, label='Anticyclonic', color='green', **kwargs_display)
c.display(ax, label='Cyclonic', color='purple', **kwargs_display)
ax.legend()
ax.set_title('Identification on ORCA grid')
plt.show()
Quantities seems to be coherent with classic AVISO ADT grid
Filter
Filter step is important to remove long scale in grid, in order to highlight mesoscale structure which could hide by large scale. I used in this example for unregular grid an ugly solution to filter sea level grid, which also could add some other problems ...
from py-eddy-tracker.
I am not sure, but i think "nav_lon" content produce problem with matplotlib contour:
When we apply matplotlib.pyplot.contour on all the ORCA data, we have that, i think contour need no jump in lon. i will try to find a solution...
from netCDF4 import Dataset
from matplotlib import pyplot as plt
import numpy as np
import pylook
if __name__ == '__main__':
grid_name = 'GIOPS_NativeGrid_20200424.nc'
lon_name, lat_name = 'nav_lon', 'nav_lat'
ax = plt.subplot(111, projection='plat_carre')
with Dataset(grid_name) as h:
lon = h.variables[lon_name][:]
lat = h.variables[lat_name][:]
sla = h.variables['sla'][:]
ax.contour(lon,lat, sla, levels=np.arange(-2,2,.25))
plt.show()
from py-eddy-tracker.
Related Issues (20)
- Eddies detected on land HOT 6
- Eddy kinetic energy of different types of eddies and its calculation HOT 1
- about from py_eddy_tracker.dataset.grid import RegularGridDataset HOT 1
- 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
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.