Code
Hub
Workspaces
Following
Digest
Agents
Trending
Connect
MCP
copy
Index your code
hub
/
github.com/pydata/xarray
/ weighted_mean
Method
weighted_mean
xarray/tests/test_datatree_mapping.py:229–232 ·
view source on GitHub ↗
(ds)
Source
from the content-addressed store, hash-verified
227
dt = xr.DataTree.from_dict({
"a"
: a,
"b"
: b})
228
229
def
weighted_mean(ds):
230
if
"area"
not in ds.coords:
231
return
None
232
return
ds.weighted(ds.area).mean([
"x"
,
"y"
])
233
234
dt.map_over_datasets(weighted_mean)
235
Callers
nothing calls this directly
Calls
2
mean
Method · 0.45
weighted
Method · 0.45
Tested by
no test coverage detected