Skip to content
This repository was archived by the owner on Oct 24, 2024. It is now read-only.

Commit 35fa1e3

Browse files
committed
updated developer's note
1 parent 085fc5d commit 35fa1e3

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

datatree/datatree.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,9 @@
4444
node in the tree. As this API is copied without directly subclassing `xarray.Dataset` we instead create various Mixin
4545
classes which each define part of `xarray.Dataset`'s extensive API.
4646
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.
4750
"""
4851

4952

@@ -329,6 +332,8 @@ def method_name(self, *args, **kwargs):
329332
return self.method(*args, **kwargs)
330333
```
331334
335+
Every method attached here needs to have a return value of Dataset or DataArray in order to construct a new tree.
336+
332337
Parameters
333338
----------
334339
target_cls_dict : MappingProxy
@@ -368,8 +373,6 @@ def method_name(self, *args, **kwargs):
368373
class MappedDatasetMethodsMixin:
369374
"""
370375
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.
373376
"""
374377

375378
__slots__ = ()
@@ -391,11 +394,7 @@ class MappedDataWithCoords(DataWithCoords):
391394

392395
class DataTreeArithmetic(DatasetArithmetic):
393396
"""
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().
399398
"""
400399

401400
_wrap_then_attach_to_cls(

0 commit comments

Comments
 (0)