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

warn if dim is passed to rolling operations. #3513

Merged
merged 3 commits into from
Nov 13, 2019

Conversation

dcherian
Copy link
Contributor

@@ -351,6 +352,14 @@ def _bottleneck_reduce(self, func, **kwargs):
def _numpy_or_bottleneck_reduce(
self, array_agg_func, bottleneck_move_func, **kwargs
):
if "dim" in kwargs:
warnings.warn(
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Should this just be a UserWarning saying that the dim kwargs is ignored?

Copy link
Collaborator

Choose a reason for hiding this comment

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

If it's definitely incorrect to pass (i.e. there's no legitimate potential use), I'd vote to raise an error in the future, rather than a warning. If someone makes a mistake, we should let them know quickly & loudly.

Copy link
Collaborator

@max-sixty max-sixty left a comment

Choose a reason for hiding this comment

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

Thanks @dcherian !

doc/whats-new.rst Outdated Show resolved Hide resolved
@@ -351,6 +352,14 @@ def _bottleneck_reduce(self, func, **kwargs):
def _numpy_or_bottleneck_reduce(
self, array_agg_func, bottleneck_move_func, **kwargs
):
if "dim" in kwargs:
warnings.warn(
Copy link
Collaborator

Choose a reason for hiding this comment

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

If it's definitely incorrect to pass (i.e. there's no legitimate potential use), I'd vote to raise an error in the future, rather than a warning. If someone makes a mistake, we should let them know quickly & loudly.

xarray/core/rolling.py Outdated Show resolved Hide resolved
dcherian and others added 2 commits November 12, 2019 19:01
Co-Authored-By: Maximilian Roos <[email protected]>
Co-Authored-By: Maximilian Roos <[email protected]>
@dcherian dcherian merged commit 7241aa1 into pydata:master Nov 13, 2019
@dcherian dcherian deleted the warn-rolling-dim branch November 13, 2019 15:53
dcherian added a commit to dcherian/xarray that referenced this pull request Nov 14, 2019
* upstream/master:
  Allow appending datetime & boolean variables to zarr stores (pydata#3504)
  warn if dim is passed to rolling operations. (pydata#3513)
  Deprecate allow_lazy (pydata#3435)
  Recursive tokenization (pydata#3515)
  format indexing.rst code with black (pydata#3511)
dcherian added a commit to dcherian/xarray that referenced this pull request Nov 17, 2019
* upstream/master:
  Added fill_value for unstack (pydata#3541)
  Add DatasetGroupBy.quantile (pydata#3527)
  ensure rename does not change index type (pydata#3532)
  Leave empty slot when not using accessors
  interpolate_na: Add max_gap support. (pydata#3302)
  units & deprecation merge (pydata#3530)
  Fix set_index when an existing dimension becomes a level (pydata#3520)
  add Variable._replace (pydata#3528)
  Tests for module-level functions with units (pydata#3493)
  Harmonize `FillValue` and `missing_value` during encoding and decoding steps (pydata#3502)
  FUNDING.yml (pydata#3523)
  Allow appending datetime & boolean variables to zarr stores (pydata#3504)
  warn if dim is passed to rolling operations. (pydata#3513)
  Deprecate allow_lazy (pydata#3435)
  Recursive tokenization (pydata#3515)
dcherian added a commit to dcherian/xarray that referenced this pull request Nov 17, 2019
* upstream/master: (22 commits)
  Added fill_value for unstack (pydata#3541)
  Add DatasetGroupBy.quantile (pydata#3527)
  ensure rename does not change index type (pydata#3532)
  Leave empty slot when not using accessors
  interpolate_na: Add max_gap support. (pydata#3302)
  units & deprecation merge (pydata#3530)
  Fix set_index when an existing dimension becomes a level (pydata#3520)
  add Variable._replace (pydata#3528)
  Tests for module-level functions with units (pydata#3493)
  Harmonize `FillValue` and `missing_value` during encoding and decoding steps (pydata#3502)
  FUNDING.yml (pydata#3523)
  Allow appending datetime & boolean variables to zarr stores (pydata#3504)
  warn if dim is passed to rolling operations. (pydata#3513)
  Deprecate allow_lazy (pydata#3435)
  Recursive tokenization (pydata#3515)
  format indexing.rst code with black (pydata#3511)
  add missing pint integration tests (pydata#3508)
  DOC: update bottleneck repo url (pydata#3507)
  add drop_sel, drop_vars, map to api.rst (pydata#3506)
  remove syntax warning (pydata#3505)
  ...
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.

reduce() got multiple values for keyword argument 'dim'
2 participants