Skip to content

Add dtype support for reduce methods. #1841

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

Merged
merged 8 commits into from
Jan 20, 2018

Conversation

fujiisoup
Copy link
Member

  • Closes #1838changes)
  • Tests added
  • Tests passed
  • Passes git diff upstream/master **/*py | flake8 --diff
  • Fully documented, including whats-new.rst for all changes and api.rst for new API

Fixes #1838.
The new rule for reduce is

  • If dtype is not None and different from array's dtype, use numpy's aggregation function instead of bottleneck's.
  • If out is not None, raise an error.

as suggested in this comments.

Copy link
Member

@shoyer shoyer left a comment

Choose a reason for hiding this comment

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

Looks great, thanks!

kwargs.pop('dtype', None)
kwargs.pop('out', None)
if kwargs.pop('out', None) is not None:
raise ValueError('`out` is not valid for {}'.format(name))
Copy link
Member

Choose a reason for hiding this comment

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

This should probably be TypeError for invalid argument names.

'c': -999}
orig = DataArray([[-1, 0, 1], [-3, 0, 3]], coords, dims=['x', 'y'])

for dtype in [np.float32, np.float64, np.float128]:
Copy link
Member

Choose a reason for hiding this comment

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

Looks like you'll need to remove np.float128. It appears that it's not available on Windows, which is triggering this test failure.

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

Successfully merging this pull request may close these issues.

2 participants