xr.corr on a dataset
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 4.2k
- Forks
- 1.4k
- Avg merge
- 2d 15h
- Merged PRs (30d)
- 14
Description
Is your feature request related to a problem?
Hi,
I wanted to find the correlation coefficient for every variables in a dataset with respect to 3 other dataArrays but there is no built-in method correaltion on a dataset.
Describe the solution you'd like
I would have loved to find a ds.corr( labels , labels, dims=optional) method accepting list of labels in the dataset and resulting in a dataArray or a dask/numpy.array with the correlations coefficients (and labels containing which variables were tested against each other ?)
The idea would be to have an efficient method that doesn't loop NxM times over each variable and that use dask chunk loading and parrallel computing.
I hope the request/idea is not too crazy.
Describe alternatives you've considered
I ended up looping over the 3 dataArrays and the dataset variables using xr.corr on each dataset[variable_label}, resulting in very long computations without the efficiency I was looking for in xarray.
Additional context
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the existing xr.corr entry point and Dataset behavior for selecting variables. Clarify the output labels, optional dims, and dask/numpy handling, then validate the design against the reported multi-variable correlation use case and confirm that the resulting computation avoids the current per-variable loops.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- numpy, python
- Domain
- data
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100