Weighted DataArray operations. Parameters ---------- weights : DataArray An array of weights associated with the values in this Dataset. Each value in the data contributes to the reduction operation according to its associated wei
(self, weights: DataArray)
| 7170 | ) |
| 7171 | |
| 7172 | def weighted(self, weights: DataArray) -> DataArrayWeighted: |
| 7173 | """ |
| 7174 | Weighted DataArray operations. |
| 7175 | |
| 7176 | Parameters |
| 7177 | ---------- |
| 7178 | weights : DataArray |
| 7179 | An array of weights associated with the values in this Dataset. |
| 7180 | Each value in the data contributes to the reduction operation |
| 7181 | according to its associated weight. |
| 7182 | |
| 7183 | Notes |
| 7184 | ----- |
| 7185 | ``weights`` must be a DataArray and cannot contain missing values. |
| 7186 | Missing values can be replaced by ``weights.fillna(0)``. |
| 7187 | |
| 7188 | Returns |
| 7189 | ------- |
| 7190 | computation.weighted.DataArrayWeighted |
| 7191 | |
| 7192 | See Also |
| 7193 | -------- |
| 7194 | :func:`Dataset.weighted <Dataset.weighted>` |
| 7195 | |
| 7196 | :ref:`compute.weighted` |
| 7197 | User guide on weighted array reduction using :py:func:`~xarray.DataArray.weighted` |
| 7198 | |
| 7199 | :doc:`xarray-tutorial:fundamentals/03.4_weighted` |
| 7200 | Tutorial on Weighted Reduction using :py:func:`~xarray.DataArray.weighted` |
| 7201 | |
| 7202 | """ |
| 7203 | from xarray.computation.weighted import DataArrayWeighted |
| 7204 | |
| 7205 | return DataArrayWeighted(self, weights) |
| 7206 | |
| 7207 | def rolling( |
| 7208 | self, |