Skip to content

Add interval accessor. #10445

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft

Conversation

dcherian
Copy link
Contributor

@dcherian dcherian commented Jun 26, 2025

Quick attempt at

  1. CF-compliant encoding of Variables wrapping pd.IntervalArray to two variables.
  2. decoding of CF-compliant bounds variables (e.g. time_bounds) to an IntervalArray. For this to be useful when a central value time is present requires that we drop time, create the intervalindex for time_bounds and then assign that as time.

Alternatively we might not want to record the "central value" on encode. Then we could simply have a 1D Variable(pd.IntervalArray) -> 2D Variable encoding pipeline with attributes:

  1. closed: 'left'. which side of the interval is closed?
  2. xarray_dtype: 'pandas_interval'. tells Xarray to decode to the pd.Interval dtype
  3. bounds_dim_name: 'bounds' that identifies the dimension with size-2 (left & right edges)

This is not CF-compliant but would let us close #2847

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cannot store data after group_by
1 participant