Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Consider adding opt-in support for circular axes when calling `bounds_to_vertices` (related to #594)

Open
#596 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

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

Research direction

Start by reading the bounds_to_vertices implementation and the context in issues #594 and #595. Define the expected behavior for circular_period and start, including seam rotation and periodic axes beyond longitude. Done means an opt-in API handles mixed circular coordinates without NotImplementedError while preserving existing ascending and descending behavior.

Written by the indexing model from the issue text.

Description

Description

The latest bounds_to_vertices() function in cf-xarray v0.10.7+ only handles core dimensions that are in ascending or descending order. Core dims that are in mixed order instead raise a NotImplementedError #595 with a message for the user to normalize coordinates to a monotonic convention (related comment).

Examples
  • Ascending

    [0, 1, 2, ..., 357, 358, 359]
    
  • Descending

    [359, 358, 357, ..., 2, 1, 0]
    
  • Mixed (wraps at seam)

    [0, 1, 2, ..., 179, -180, -179, ..., -1]
    

bounds_to_vertices() works in the first two cases but fails in the third.


Proposed solution

For a long-term solution, it might be worth considering opt-in support for circular axes, e.g.:

bounds_to_vertices(..., circular_period=360.0, start=None)

With circular_period set, cf-xarray could:

  • Detect circular monotonicity
  • Rotate away from the seam
  • Proceed safely as if the dimension were monotonic

While longitude (circular_period=360.0) is the most common use case, the same approach could generalize to other periodic axes (e.g. angles, phases).

Why it is useful

  • Users working with model output that mixes 0–360 and −180–180 conventions may encounter NotImplementedError today and must manually normalize coordinates before downstream operations.
  • This affects packages such as xESMF, which rely on bounds_to_vertices() but do not implement detection/normalization for circular axes.
  • I’ve opened a related xESMF issue for visibility: https://github.com/pangeo-data/xESMF/issues/454
Dominant language
Python
Stars
181
Forks
49
Avg merge
43m
Merged PRs (30d)
1

Contributor guide

No contributing guide indexed for this repository

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 xarray-contrib/cf-xarray

All issues in xarray-contrib/cf-xarray

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.