Exponentially weighted moving covariance. `keep_attrs` is always True for this method. Drop attrs separately to remove attrs. Examples -------- >>> da = xr.DataArray([1, 1, 2, 2, 2], dims="x") >>> da.rolling_exp(x=2, window_type="span").cov(da**2)
(self, other: T_DataWithCoords)
| 226 | ).transpose(*dim_order) |
| 227 | |
| 228 | def cov(self, other: T_DataWithCoords) -> T_DataWithCoords: |
| 229 | """ |
| 230 | Exponentially weighted moving covariance. |
| 231 | |
| 232 | `keep_attrs` is always True for this method. Drop attrs separately to remove attrs. |
| 233 | |
| 234 | Examples |
| 235 | -------- |
| 236 | >>> da = xr.DataArray([1, 1, 2, 2, 2], dims="x") |
| 237 | >>> da.rolling_exp(x=2, window_type="span").cov(da**2) |
| 238 | <xarray.DataArray (x: 5)> Size: 40B |
| 239 | array([ nan, 0. , 1.38461538, 0.55384615, 0.19338843]) |
| 240 | Dimensions without coordinates: x |
| 241 | """ |
| 242 | |
| 243 | dim_order = self.obj.dims |
| 244 | import numbagg |
| 245 | |
| 246 | return apply_ufunc( |
| 247 | numbagg.move_exp_nancov, |
| 248 | self.obj, |
| 249 | other, |
| 250 | input_core_dims=[[self.dim], [self.dim]], |
| 251 | kwargs=self.kwargs, |
| 252 | output_core_dims=[[self.dim]], |
| 253 | keep_attrs=True, |
| 254 | on_missing_core_dim="copy", |
| 255 | dask="parallelized", |
| 256 | ).transpose(*dim_order) |
| 257 | |
| 258 | def corr(self, other: T_DataWithCoords) -> T_DataWithCoords: |
| 259 | """ |