Skip to content

Commit 745e95b

Browse files
committed
replace xr.ufuncs.log with np.log
1 parent 7c28d80 commit 745e95b

File tree

1 file changed

+3
-10
lines changed

1 file changed

+3
-10
lines changed

intermediate/hierarchical_computation.ipynb

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@
137137
"source": [
138138
"## Applying functions designed for `Dataset` with `map_over_datasets`\n",
139139
"\n",
140-
"What if we wanted to apply a element-wise function, for example to convert the data to log-space? For a `Dataset` or `DataArray`, we could just use {py:func}`xarray.ufuncs.log`, but that does not support `DataTree` objects, yet:"
140+
"What if we wanted to apply a element-wise function, for example to convert the data to log-space? For a `DataArray` we could just use {py:func}`numpy.log`, but this is not supported for `DataTree` objects:"
141141
]
142142
},
143143
{
@@ -147,16 +147,14 @@
147147
"metadata": {},
148148
"outputs": [],
149149
"source": [
150-
"xr.ufuncs.log(tree)"
150+
"np.log(tree)"
151151
]
152152
},
153153
{
154154
"cell_type": "markdown",
155155
"id": "13",
156156
"metadata": {},
157157
"source": [
158-
"Note how the result is a empty `Dataset`?\n",
159-
"\n",
160158
"To map a function to all nodes, we can use {py:func}`xarray.map_over_datasets` and {py:meth}`xarray.DataTree.map_over_datasets`: "
161159
]
162160
},
@@ -201,12 +199,7 @@
201199
"cell_type": "code",
202200
"execution_count": null,
203201
"id": "18",
204-
"metadata": {
205-
"tags": [
206-
"raises-exception",
207-
"hide-output"
208-
]
209-
},
202+
"metadata": {},
210203
"outputs": [],
211204
"source": [
212205
"tree.map_over_datasets(demean)"

0 commit comments

Comments
 (0)