-
Notifications
You must be signed in to change notification settings - Fork 41
Unexpected behavior for .map_over_subtree
#188
Comments
I was using v0.0.10 for the record |
This bug is something to do with not properly copying |
Yes that's intended - nodes of a tree can't hold just one DataArray, they actually extract all the underlying |
You can actually reproduce this with just dt = datatree.DataTree(data=a)
weighted_mean(dt.ds) It's because I should be able to fix it either by:
|
Actually a better solution here might have been to re-implement |
* alternative fix for 188 * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
I want to apply a weighted mean over every dataset in a tree but cannot map a function as expected.
Take this simple example:
I am defining a very simple weighted mean function:
which works as expected on a single dataset:
But when I try to map this over the tree
I get this:
strangely if I modify the function to return a dataarray and map it
It gives me the desired result, but I am not sure if this is intended behavior (the return dataarray is converted back to a dataset?)
The text was updated successfully, but these errors were encountered: