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

keep attrs when reducing xray objects #138

Closed
jhamman opened this issue May 21, 2014 · 4 comments · Fixed by #141
Closed

keep attrs when reducing xray objects #138

jhamman opened this issue May 21, 2014 · 4 comments · Fixed by #141

Comments

@jhamman
Copy link
Member

jhamman commented May 21, 2014

Reduction operations currently drop all Variable and Dataset attrs when a reduction operation is performed. I'm proposing adding a keyword to these methods to allow for copying of the original Variable or Dataset attrs.

The default value of the keep_attrs keyword would be False.

For example:

new = ds.mean(keep_attrs=True)

returns new with all the Variable and Dataset attrs as ds contained.

Some previous discussion in #131 and #137.

This was referenced May 21, 2014
@shoyer
Copy link
Member

shoyer commented May 21, 2014

This seems fine by me.

@akleeman Your thoughts?

@akleeman
Copy link
Contributor

Yeah I agree, seems like a great option to have.

@ebrevdo
Copy link
Contributor

ebrevdo commented May 21, 2014

Why not options like 'first', 'common', etc?
On May 20, 2014 11:52 PM, "akleeman" notifications@github.com wrote:

Yeah I agree, seems like a great option to have.


Reply to this email directly or view it on GitHubhttps://github.com//issues/138#issuecomment-43718217
.

@shoyer
Copy link
Member

shoyer commented May 21, 2014

@ebrevdo This is for reduce operations like "mean" which are unary operators. But it does seem like a good idea to consider if/how this could be extended to binary operations (e.g., "merge" or "add"). To make this an option for mathematical operations like "add" we would need to add an add method for instead of just relying on overloading the + operator.

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 a pull request may close this issue.

4 participants