You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There was a discussion on the performance of the weighted mean/ sum in terms of memory footprint but also speed, and there may indeed be some things that can be optimized. See the posts at the end of the PR. However, the optimal implementation will probably depend on the use case and some profiling will be required.
I'll just open an issue to keep track of this. @seth-p
da.fillna(0.0) in turn calls where(null(data), other). Thus null/ notnull is called twice. This could be optimized by doing self.null = obj.null() in __init__(...). This might also allow self.any_null = self.null.any() to skip NaN handling if there are none. However, this needs more thinking if a Dataset is passed. Probably overkill but leaving this here for reference.
Activity
mathause commentedon Mar 25, 2020
maybe relevant: #1995
mathause commentedon May 18, 2020
mathause commentedon May 26, 2020
weighted(weights).mean(skipna=True)callsxarray/xarray/core/weighted.py
Line 143 in d1f7cb8
and
xarray/xarray/core/weighted.py
Line 130 in d1f7cb8
da.fillna(0.0)in turn callswhere(null(data), other). Thusnull/notnullis called twice. This could be optimized by doingself.null = obj.null()in__init__(...). This might also allowself.any_null = self.null.any()to skipNaNhandling if there are none. However, this needs more thinking if aDatasetis passed. Probably overkill but leaving this here for reference.