You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Reduction operations currently drop all Variable and Datasetattrs when a reduction operation is performed. I'm proposing adding a keyword to these methods to allow for copying of the original Variable or Datasetattrs.
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 Datasetattrs as ds contained.
@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.
Activity
shoyer commentedon May 21, 2014
This seems fine by me.
@akleeman Your thoughts?
akleeman commentedon May 21, 2014
Yeah I agree, seems like a great option to have.
ebrevdo commentedon May 21, 2014
Why not options like 'first', 'common', etc?
On May 20, 2014 11:52 PM, "akleeman" notifications@github.com wrote:
shoyer commentedon 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
addmethod for instead of just relying on overloading the+operator.Update minimum required version for xarray (pydata#138)