-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Move Variable aggregations to NamedArray #8304
Conversation
TODO: - [ ] the handling of global keep_attrs is not tested well. This should be breaking DataArray/Dataset tests! - [ ] Look at `numeric_only` in NAMED_ARRAY_OBJECT - [ ] Do we want to support `axis`?
xarray/core/variable.py
Outdated
# to True by NamedArray.mean. | ||
# Instead we need to make VariableAggregations mixin with .mean, | ||
# and delegate to NamedArray.reduce setting keep_attrs explicitly | ||
result = self._to_named_array().reduce( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
re the comment: This is quite annoying.
a613abe
to
b94d78d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks solid to me 👍🏽! thank you for working on this, @dcherian
Don't know how to fix these.
|
@dcherian, are we okay w/ merging this as is, and fixing the typing issue in a separate pull request? i personally don't know how to address the typing issues. |
Cc @Illviljan for help if you happen to have time :) |
No strong view on fixing vs. ignoring, but I would vote quite strongly to explicitly ignore errors, rather than break the tests, since it's difficult to oversee tests whose good state is a break... |
I think the issue is real and tied to not having
One option would be to use a |
didn't work. |
self, | ||
func: Callable[..., Any], | ||
dim: Dims = None, | ||
axis: int | Sequence[int] | None = None, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is NamedArray big fans of axis inputs? I thought this was a mistake in xarray.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah I forgot to raise this as an issue. It's definitely a mistake for Dataset. DataArray and Variable do have ordered dimensions so in principle it's OK but discouraged.
numeric_only
in NAMED_ARRAY_OBJECT