Skip to content

No 'DUFunc' object has no attribute 'signature' issue #12

@dhruvbalwada

Description

@dhruvbalwada

I am running option 2 from the tutorial on LEAP hub:

import xarray as xr
from fastjmd95 import jmd95numba
import fastjmd95

print("xarry:"  + xr.__version__)
print("fastjmd95:" + fastjmd95.__version__)

from intake import open_catalog
cat = open_catalog("https://raw.githubusercontent.com/pangeo-data/pangeo-datastore/master/intake-catalogs/ocean.yaml")
ds  = cat["SOSE"].to_dask()

# load data into memory
th0 = ds.THETA[0].compute()
slt0 = ds.SALT[0].compute()

rho_xr = jmd95numba.rho(slt0, th0, 0)

and getting the error:

/srv/conda/envs/notebook/lib/python3.11/site-packages/intake_xarray/base.py:21: FutureWarning: The return type of `Dataset.dims` will be changed to return a set of dimension names in future, in order to be more consistent with `DataArray.dims`. To access a mapping from dimension names to lengths, please use `Dataset.sizes`.
  'dims': dict(self._ds.dims),
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
Cell In[41], line 16
     13 th0 = ds.THETA[0].compute()
     14 slt0 = ds.SALT[0].compute()
---> 16 rho_xr = jmd95numba.rho(slt0, th0, 0)

File /srv/conda/envs/notebook/lib/python3.11/site-packages/numba/np/ufunc/dufunc.py:186, in DUFunc.__call__(self, *args, **kws)
    184 for arg in args + tuple(kws.values()):
    185     if getattr(type(arg), "__array_ufunc__", default) is not default:
--> 186         output = arg.__array_ufunc__(self, "__call__", *args, **kws)
    187         if output is not NotImplemented:
    188             return output

File /srv/conda/envs/notebook/lib/python3.11/site-packages/xarray/core/arithmetic.py:56, in SupportsArithmetic.__array_ufunc__(self, ufunc, method, *inputs, **kwargs)
     51     if not is_duck_array(x) and not isinstance(
     52         x, self._HANDLED_TYPES + (SupportsArithmetic,)
     53     ):
     54         return NotImplemented
---> 56 if ufunc.signature is not None:
     57     raise NotImplementedError(
     58         f"{ufunc} not supported: xarray objects do not directly implement "
     59         "generalized ufuncs. Instead, use xarray.apply_ufunc or "
     60         "explicitly convert to xarray objects to NumPy arrays "
     61         "(e.g., with `.values`)."
     62     )
     64 if method != "__call__":
     65     # TODO: support other methods, e.g., reduce and accumulate.

AttributeError: 'DUFunc' object has no attribute 'signature'

My relevant package version numbers are:
xarry:2024.1.0
fastjmd95:0.2.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions