Hello,
I'm trying to apply the eddy tracking to numerical model outputs, but the start is not so easy.
Based on the example here https://py-eddy-tracker.readthedocs.io/en/stable/grid_identification.html#python-code, I created the grid:
h = RegularGridDataset(grid_name, lon_name, lat_name)
(with the needed substitutions).
Issue1: Then I tried the filtering:
h.bessel_high_filter('XE', 500, order=3)
where XE
is the name of the variable storing the sea_surface_height_above_sea_level. I get this error:
ValueError Traceback (most recent call last)
<ipython-input-28-abe544c8a678> in <module>
----> 1 h.bessel_high_filter('XE', 500, order=3)
~/Software/PythonEnvs/EddyMitchell/lib/python3.8/site-packages/pyEddyTracker-3.1.0+46.g0b64a4d-py3.8.egg/py_eddy_tracker/dataset/grid.py in bessel_high_filter(self, grid_name, wave_length, order, lat_max, **kwargs)
1422 dict(wave_length=wave_length, order=order),
1423 )
-> 1424 data_out = self.convolve_filter_with_dynamic_kernel(
1425 grid_name,
1426 self.kernel_bessel,
~/Software/PythonEnvs/EddyMitchell/lib/python3.8/site-packages/pyEddyTracker-3.1.0+46.g0b64a4d-py3.8.egg/py_eddy_tracker/dataset/grid.py in convolve_filter_with_dynamic_kernel(self, grid, kernel_func, lat_max, extend, **kwargs_func)
1314
1315 for i, lat in enumerate(self.y_c):
-> 1316 if abs(lat) > lat_max or data[:, i].mask.all():
1317 data_out.mask[:, i] = True
1318 continue
ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()
which is not so clear to me. According to the method help/docstring:
Signature: h.bessel_high_filter(grid_name, wave_length, order=1, lat_max=85, **kwargs)
Docstring: <no docstring>
File: ~/Software/PythonEnvs/EddyMitchell/lib/python3.8/site-packages/pyEddyTracker-3.1.0+46.g0b64a4d-py3.8.egg/py_eddy_tracker/dataset/grid.py
Type: method
so I would understand that the 1st argument is the name of the grid (grid_name
), but that doesn't seem to correspond to the documentation.
Issue 2: let's say I don't need the filtering, I want to proceed directly to the identification, following the same example as before.
date = datetime(2015, 1, 1, 12, 0, 0)
a, c = h.eddy_identification(
'XE', 'U', 'V', # Variables used for identification
date, # Date of identification
0.002, # step between two isolines of detection (m)
pixel_limit=(5, 2000), # Min and max pixel count for valid contour
shape_error=55, # Error max (%) between ratio of circle fit and contour
)
this also returns a ValueError
:
ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()
So maybe my issue is how to specify which time step I want to process in the netCDF file. I though that using
date = datetime(2015, 1, 1, 12, 0, 0)
and using this argument in the call of eddy_identification
. I cannot provide a full file (6G per file) but can provide the result of ncdump -h
if that helps.
Thanks