pydata / pydata/xarray

`Coordinates` operations

Open
#10,314 1 comment 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

topic-indexing
Dominant language
Python
Stars
4.2k
Forks
1.4k
Avg merge
2d 15h
Merged PRs (30d)
14

Description

What is your issue?

At the moment, the Coordinates objects are not as useful as I'd like them to be, so in this issue I'd like to collect all the methods it should support. Some of these already exist, but listing them again helps with defining a coherent API:

  • coordinate variables
    • assignment of new coordinates (from Variable / DataArray / Coordinates / any array): Coordinates.assign()
    • deletion of coordinates (similar to Dataset.drop_vars): only via del coords["x"] but a Coordinates.drop_vars() might be welcome I guess
    • renaming coordinates: no specific method yet, Coordinates.rename_vars()?
    • renaming dimensions on coordinates: no specific method yet, Coordinates.rename_dims()?
  • indexes
    • assignment of index instances: could use Coordinates.assign(Coordinates.from_xindex(idx_obj)) but one index at a time
    • dropping indexes: Coordinates.drop_indexes() (#8118)
    • creation of an index based on variables, a given class, and additional options: Coordinates.set_xindex() (#8118)
  • combination
    • merging (also using |)

cc @benbovy, @scottyhq

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.

Research direction

Start by reviewing the existing Coordinates API and the unchecked operations listed in the issue, especially Coordinates.assign() and index assignment. Read the related drop_indexes() and set_xindex() work in issue #8118, then compare it with the existing deletion, renaming, and merging behavior. Done would require an agreed, coherent Coordinates API for the remaining operations.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
data
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.