(
self: DatasetCoarsen, keep_attrs: bool | None = None, **kwargs
)
| 1323 | kwargs["skipna"] = None |
| 1324 | |
| 1325 | def wrapped_func( |
| 1326 | self: DatasetCoarsen, keep_attrs: bool | None = None, **kwargs |
| 1327 | ) -> Dataset: |
| 1328 | from xarray.core.dataset import Dataset |
| 1329 | |
| 1330 | keep_attrs = self._get_keep_attrs(keep_attrs) |
| 1331 | |
| 1332 | if keep_attrs: |
| 1333 | attrs = self.obj.attrs |
| 1334 | else: |
| 1335 | attrs = {} |
| 1336 | |
| 1337 | reduced = {} |
| 1338 | for key, da in self.obj.data_vars.items(): |
| 1339 | reduced[key] = da.variable.coarsen( |
| 1340 | self.windows, |
| 1341 | func, |
| 1342 | self.boundary, |
| 1343 | self.side, |
| 1344 | keep_attrs=keep_attrs, |
| 1345 | **kwargs, |
| 1346 | ) |
| 1347 | |
| 1348 | coords = {} |
| 1349 | for c, v in self.obj.coords.items(): |
| 1350 | # variable.coarsen returns variables not containing the window dims |
| 1351 | # unchanged (maybe removes attrs) |
| 1352 | coords[c] = v.variable.coarsen( |
| 1353 | self.windows, |
| 1354 | self.coord_func[c], |
| 1355 | self.boundary, |
| 1356 | self.side, |
| 1357 | keep_attrs=keep_attrs, |
| 1358 | **kwargs, |
| 1359 | ) |
| 1360 | |
| 1361 | return Dataset(reduced, coords=coords, attrs=attrs) |
| 1362 | |
| 1363 | return wrapped_func |
| 1364 |
nothing calls this directly
no test coverage detected