Skip to content

Commit

Permalink
Changes to allow nan functions to work with xarray
Browse files Browse the repository at this point in the history
  • Loading branch information
tomwhite committed Jan 15, 2025
1 parent 5f75ba2 commit 039ec69
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions cubed/array_api/array_object.py
Original file line number Diff line number Diff line change
Expand Up @@ -367,9 +367,9 @@ def __array_namespace__(self, /, *, api_version=None):
"2023.12",
):
raise ValueError(f"Unrecognized array API version: {api_version!r}")
import cubed.array_api as array_api
import cubed

return array_api
return cubed

def __bool__(self, /):
if self.ndim != 0:
Expand Down
4 changes: 2 additions & 2 deletions cubed/nan_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@
# https://github.com/data-apis/array-api/issues/621


def nanmean(x, /, *, axis=None, keepdims=False, split_every=None):
def nanmean(x, /, *, axis=None, dtype=None, keepdims=False, split_every=None):
"""Compute the arithmetic mean along the specified axis, ignoring NaNs."""
dtype = x.dtype
dtype = dtype or x.dtype
intermediate_dtype = [("n", nxp.int64), ("total", nxp.float64)]
return reduction(
x,
Expand Down

0 comments on commit 039ec69

Please sign in to comment.