Utility function to promote scalar coords

Open
#6,913 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
30/100
Issue type
Feature
Clarity
Needs clarification
Activity status
Stale
Tech stack
python
Domain
data

Research direction

Begin with iris.util.promote_aux_coord_to_dim_coord and the equalise_cubes options documented in the linked API pages. Determine the supported scalar and related-coordinate cases and the required in-place behavior, then ensure the utility and integration make selected scalar coordinates create dimensions while related variables follow them, with tests covering the documented cases.

Written by the indexing model from the issue text.

Description

Part of #6383

Provide a new utility function + include it in the options for equalise_cubes
( which means it is also available in combine_cubes and CubeList.combine/combine_cube )

The basic need is to promote specific (i.e. ?named?) scalar coords to ensure they generate a new dimension
(( original spec called for remove/promote, but I can't see how this naturally extends to removal ? ))

The required api can probably look something like this:

def promote_scalars(
    cubes: list[Cube],
    scalars_and_related: dict[str | Coord, list[str]
):
    """Ensure specific scalar coords are promoted to a dimension."""

Functional Notes (to go in docstrings):

  • changes input cubes in-place
  • Each key of, 'scalars_and_related' specifies a scalar coord
    • the associated values are names of other coords/aux-vars/cell-measures which should also map to the new dimension.
    • See promote_aux_coord_to_dim_coord for how that needs to work
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.