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

Add nansum and nanmean functions #308

Merged
merged 2 commits into from
Sep 25, 2023
Merged

Add nansum and nanmean functions #308

merged 2 commits into from
Sep 25, 2023

Conversation

tomwhite
Copy link
Member

This is for #153 (although the Xarray side would need work too). I put the new functions in cubed.array, but there is a strong argument to put them (and all the existing array API functions) in the top-level cubed namespace (see #307).

if (
any(s > 1 for i, s in enumerate(result.chunksize) if i in axis)
or func != combine_func
):
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This condition needs to be removed since otherwise there are cases where no function is ever run in reduction. In particular if the array is of size 1 along the reduction axis. So far this hasn't been a problem since the reduction of a single element has always been that element (e.g. sum(1) is 1). But that doesn't hold for NaN (e.g. nansum(nan) is 0).

@tomwhite
Copy link
Member Author

there is a strong argument to put them (and all the existing array API functions) in the top-level cubed namespace (see #307)

Now moved nansum and nanmean to cubed

@tomwhite
Copy link
Member Author

Looks like we might be hitting fsspec/filesystem_spec#1357 (which f284639 fixes by excluding the relevant fsspec release).

@tomwhite tomwhite merged commit 9f73a02 into main Sep 25, 2023
11 of 12 checks passed
@tomwhite tomwhite deleted the nansum branch September 25, 2023 09:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant