Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
dhruvbalwada opened this issue Mar 19, 2024 · 0 comments
Open

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

dhruvbalwada opened this issue Mar 19, 2024 · 0 comments

Comments

@dhruvbalwada
Copy link

dhruvbalwada commented Mar 19, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant