44
44
node in the tree. As this API is copied without directly subclassing `xarray.Dataset` we instead create various Mixin
45
45
classes which each define part of `xarray.Dataset`'s extensive API.
46
46
47
+ Some of these methods must be wrapped to map over all nodes in the subtree. Others are fine to inherit unaltered
48
+ (normally because they (a) only call dataset properties and (b) don't return a dataset that should be nested into a new
49
+ tree) and some will get overridden by the class definition of DataTree.
47
50
"""
48
51
49
52
@@ -329,6 +332,8 @@ def method_name(self, *args, **kwargs):
329
332
return self.method(*args, **kwargs)
330
333
```
331
334
335
+ Every method attached here needs to have a return value of Dataset or DataArray in order to construct a new tree.
336
+
332
337
Parameters
333
338
----------
334
339
target_cls_dict : MappingProxy
@@ -368,8 +373,6 @@ def method_name(self, *args, **kwargs):
368
373
class MappedDatasetMethodsMixin :
369
374
"""
370
375
Mixin to add Dataset methods like .mean(), but wrapped to map over all nodes in the subtree.
371
-
372
- Every method wrapped here needs to have a return value of Dataset or DataArray in order to construct a new tree.
373
376
"""
374
377
375
378
__slots__ = ()
@@ -391,11 +394,7 @@ class MappedDataWithCoords(DataWithCoords):
391
394
392
395
class DataTreeArithmetic (DatasetArithmetic ):
393
396
"""
394
- Mixin to add Dataset methods like __add__ and .mean()
395
-
396
- Some of these methods must be wrapped to map over all nodes in the subtree. Others are fine unaltered (normally
397
- because they (a) only call dataset properties and (b) don't return a dataset that should be nested into a new
398
- tree) and some will get overridden by the class definition of DataTree.
397
+ Mixin to add Dataset methods like __add__ and .mean().
399
398
"""
400
399
401
400
_wrap_then_attach_to_cls (
0 commit comments