How to calculate seasonal temporal correlations?

Open
#5,541 2 comments 4 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
35/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Stale
Tech stack
python
Domain
data

Research direction

Start with iris.analysis.stats.pearsonr and review how iris.coord_categorisation.add_season and Cube.aggregated_by represent seasonal groups. Determine the API needed to calculate Pearson correlations for each grid point without requiring direct Cube.data access. Done means a documented, tested Iris analysis capability matching the requested seasonal correlation workflow.

Written by the indexing model from the issue text.

Description

Discussed in https://github.com/SciTools/iris/discussions/5520

Originally posted by krikru September 27, 2023
If I have two iris cubes, A and B, both on the same grid and with the same time points, how can I calculate the intra-seasonal (according the seasons that are added when calling add_season) Pearson correlations between A and B for each grid point? Can I do this somehow by only using Iris functions (i.e., not extracting the data property from both cubes and using NumPy), and without using the definition of the Pearson correlation?

Pearson correlation can usually be calculated with pearsonr, but this function doesn't seem to enable aggregation by an auxiliary variable, and I need to aggregate by season.

We might want to include a version of @krikru's code within iris.analysis. Please vote if you'd like this feature!

Dominant language
Python
Stars
724
Forks
317
Avg merge
3d 20h
Merged PRs (30d)
9

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from SciTools/iris

All issues in SciTools/iris

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.