Masked array / package problem #276
-
|
Hi, Python: 3.10.20
numpy: 1.26.4
numba: 0.65.0
netCDF4: 1.7.4
pint: 0.24.4
py_eddy_tracker: v3.6.1Any help would be greatly appreciated. 56 update_axes(ax, m)
58 # %%
59 # Get geostrophic speed u,v
60 # -------------------------
61 # U/V are deduced from ADT, this algortihm is not ok near the equator (~+- 2°)
---> 62 g.add_uv("adt")
64 # %%
65 # Pre-processings
66 # ---------------
67 # Apply a high-pass filter to remove the large scale and highlight the mesoscale
68 g.bessel_high_filter("adt", 700)
File ~\AppData\Local\miniconda3\envs\eddytracker\lib\site-packages\py_eddy_tracker\dataset\grid.py:1872, in RegularGridDataset.add_uv(self, grid_height, uname, vname, stencil_halfwidth)
1869 # Compute v
1870 mode = "wrap" if self.is_circular() else "reflect"
1871 self.vars[vname] = (
-> 1872 self.compute_stencil(data, mode=mode, stencil_halfwidth=stencil_halfwidth)
1873 * gof
1874 )
1875 # Compute u
1876 self.vars[uname] = (
1877 -self.compute_stencil(
1878 data, vertical=True, stencil_halfwidth=stencil_halfwidth
1879 )
1880 * gof
1881 )
File ~\AppData\Local\miniconda3\envs\eddytracker\lib\site-packages\py_eddy_tracker\dataset\grid.py:1754, in RegularGridDataset.compute_stencil(self, data, stencil_halfwidth, mode, vertical)
1752 stencil_halfwidth = max(min(int(stencil_halfwidth), 4), 1)
1753 logger.debug("Stencil half width apply : %d", stencil_halfwidth)
-> 1754 g, m = compute_stencil(
1755 self.x_c,
1756 self.y_c,
1757 data.data,
1758 self.get_mask(data),
1759 self.EARTH_RADIUS,
1760 vertical=vertical,
1761 stencil_halfwidth=stencil_halfwidth,
1762 )
1763 return ma.array(g, mask=m)
File ~\AppData\Local\miniconda3\envs\eddytracker\lib\site-packages\numba\core\dispatcher.py:687, in _DispatcherBase.typeof_pyval(self, val)
681 """
682 Resolve the Numba type of Python value *val*.
683 This is called from numba._dispatcher as a fallback if the native code
684 cannot decide the type.
685 """
686 try:
--> 687 tp = typeof(val, Purpose.argument)
688 except (errors.NumbaValueError, ValueError):
689 tp = types.pyobject
File ~\AppData\Local\miniconda3\envs\eddytracker\lib\site-packages\numba\core\typing\typeof.py:33, in typeof(val, purpose)
31 # Note the behaviour for Purpose.argument must match _typeof.c.
32 c = _TypeofContext(purpose)
---> 33 ty = typeof_impl(val, c)
34 if ty is None:
35 msg = _termcolor.errmsg(
36 f"Cannot determine Numba type of {type(val)}")
File ~\AppData\Local\miniconda3\envs\eddytracker\lib\functools.py:889, in singledispatch.<locals>.wrapper(*args, **kw)
885 if not args:
886 raise TypeError(f'{funcname} requires at least '
887 '1 positional argument')
--> 889 return dispatch(args[0].__class__)(*args, **kw)
File ~\AppData\Local\miniconda3\envs\eddytracker\lib\site-packages\numba\core\typing\typeof.py:246, in _typeof_ndarray(val, c)
244 if isinstance(val, np.ma.MaskedArray):
245 msg = "Unsupported array type: numpy.ma.MaskedArray."
--> 246 raise errors.NumbaTypeError(msg)
247 try:
248 dtype = numpy_support.from_dtype(val.dtype)
NumbaTypeError: Unsupported array type: numpy.ma.MaskedArray. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
|
Hi, |
Beta Was this translation helpful? Give feedback.
Hi,
Take a look at issue #221
PyEddyTracker need evolution to work with recent version of numba.