-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added option to specify weights in xr.corr() and xr.cov() (#8527)
* Added function _weighted_cov_corr and modified cov and corr to call it if parameter weights is not None * Correct two indentation errors * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Stupid typo * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Remove the min_count argument from mean * Unified the code for weighted and unweighted _cov_corr * Remove old _cov_corr function after checking that new version produces same results when weights=None or weights=xr.DataArray(1) * Added examples that use weights for cov and corr * Added two tests for weighted correlation and covariance * Fix error in mypy, allow None as weights type. * Update xarray/core/computation.py Co-authored-by: Maximilian Roos <5635139+max-sixty@users.noreply.github.com> * Update xarray/core/computation.py Co-authored-by: Maximilian Roos <5635139+max-sixty@users.noreply.github.com> * Info on new options for cov and corr in whatsnew * Info on new options for cov and corr in whatsnew * Fix typing --------- Co-authored-by: Llorenc Lledo <Llorenc.Lledo@ecmwf.int> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Maximilian Roos <5635139+max-sixty@users.noreply.github.com> Co-authored-by: Maximilian Roos <m@maxroos.com>
- Loading branch information
1 parent
8ad0b83
commit 562f2f8
Showing
3 changed files
with
181 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters