@@ -170,11 +170,11 @@ We can also manually iterate through ``Rolling`` objects:
170
170
for label, arr_window in r:
171
171
# arr_window is a view of x
172
172
173
- Finally, the rolling object has ``construct `` method, which gives a
174
- view of the original ``DataArray `` with the windowed dimension attached to
173
+ Finally, the rolling object has a ``construct `` method which returns a
174
+ view of the original ``DataArray `` with the windowed dimension in
175
175
the last position.
176
- You can use this for more advanced rolling operations, such as strided rolling,
177
- windowed rolling, convolution, short-time FFT, etc.
176
+ You can use this for more advanced rolling operations such as strided rolling,
177
+ windowed rolling, convolution, short-time FFT etc.
178
178
179
179
.. ipython :: python
180
180
@@ -185,6 +185,12 @@ windowed rolling, convolution, short-time FFT, etc.
185
185
186
186
Because the ``DataArray `` given by ``r.construct('window_dim') `` is a view
187
187
of the original array, it is memory efficient.
188
+ You can also use ``construct `` to compute a weighted rolling mean:
189
+
190
+ .. ipython :: python
191
+
192
+ weight = xr.DataArray([0.25 , 0.5 , 0.25 ], dims = [' window' ])
193
+ arr.rolling(y = 3 ).construct(' window' ).dot(weight)
188
194
189
195
.. note ::
190
196
numpy's Nan-aggregation functions such as ``nansum `` copy the original array.
0 commit comments