You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Now that __array_ufunc__ has appeared in NumPy 1.13, we should be able to resolve a long-standing annoyance with xarray: the inability to use NumPy ufuncs like np.sin() directly on all xarray objects, such as xarray.Dataset.
I believe this could be straightforwardly accomplished by wrapping xarray.core.computation.apply_ufunc.
Some care should be taken to ensure that properly defer to other array types, as suggested in the NEP. This also could be a good time to resolve some of the xarray's broader consistency issues when interacting with and wrapping other array-like types.
The text was updated successfully, but these errors were encountered:
Ultimately, it would be nice to have some sort of registration system, especially for objects that aren't ndarray subclasses, that indicates that a class can safely be wrapped by xarray.
I'm thinking something like xarray.register_data_type(ArrayWithUnits) which indicates that .data for xarray objects can now be an ArrayWithUnits object. This would also possibly require passing a reference to a set of function to use on data containing these objects (e.g., for stacking or concatenating).
Now that
__array_ufunc__
has appeared in NumPy 1.13, we should be able to resolve a long-standing annoyance with xarray: the inability to use NumPy ufuncs likenp.sin()
directly on all xarray objects, such asxarray.Dataset
.I believe this could be straightforwardly accomplished by wrapping
xarray.core.computation.apply_ufunc
.Some care should be taken to ensure that properly defer to other array types, as suggested in the NEP. This also could be a good time to resolve some of the xarray's broader consistency issues when interacting with and wrapping other array-like types.
The text was updated successfully, but these errors were encountered: