Dataset.reduce methods#137
Conversation
xray/dataset.py
Outdated
There was a problem hiding this comment.
Let's make this OrderedDict() instead of an unordered dictionary, just so the result will be less surprising (that is, with variables in the same order as the original).
|
Very nice start! Please also add a |
There was a problem hiding this comment.
Please add a test for dimension=[]:
self.assertDatasetEqual(data.mean(dimension=[]), data)
test/test_dataset.py
Outdated
There was a problem hiding this comment.
This suggests another reason why it might make more sense to loop over variables (and handle coordinates explicitly) instead of only looping over noncoordinates: it's kind of weird to lose a dimension that wasn't summed over.
xray/dataset.py
Outdated
There was a problem hiding this comment.
You could simply make this:
bad_dims = [dim for dim in dims if dim not in self.coordinates]
if bad_dims:
raise ValueError
|
This getting pretty close but I would like more comprehensive tests to be confident that it is working properly:
|
|
@shoyer - re. the two tests you requested.
|
xray/dataset.py
Outdated
There was a problem hiding this comment.
To make this slightly less dissonant, let's rename da to something like var which doesn't suggest this is DataArray variable.
A first attempt at implementing Dataset reduction methods.
#131