Skip to content
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

feat: add ragged.io submodule with conversions for CF conventions #39

Closed
wants to merge 2 commits into from

Conversation

jpivarski
Copy link
Member

@jpivarski jpivarski commented Feb 20, 2024

These are the CF conventions.

This PR still needs tests, obviously, but I want to know what the final form of the API should be, with regard to reading/writing from h5py and zarr.

c.f. pydata/xarray#7988 (reply in thread)

@jpivarski jpivarski marked this pull request as draft February 21, 2024 00:06
@jpivarski
Copy link
Member Author

Copying the example from pydata/xarray#7988 (reply in thread), so that it's more easily associated with this PR:

>>> import ragged.io
>>> a = ragged.array([
...     [1.01, 1.02],
...     [2.01, 2.02, 2.03, 2.04],
...     [3.01, 3.02, 3.03],
...     [4.01, 4.02, 4.03, 4.04, 4.05, 4.06]
... ])

>>> ragged.io.to_cf_contiguous(a)
(ragged.array([1.01, 1.02, 2.01, 2.02, 2.03, ..., 4.02, 4.03, 4.04, 4.05, 4.06]),
 ragged.array([2, 4, 3, 6]))

>>> ragged.io.from_cf_contiguous(*ragged.io.to_cf_contiguous(a))
ragged.array([
    [1.01, 1.02],
    [2.01, 2.02, 2.03, 2.04],
    [3.01, 3.02, 3.03],
    [4.01, 4.02, 4.03, 4.04, 4.05, 4.06]
])

>>> ragged.io.to_cf_indexed(a)
(ragged.array([1.01, 1.02, 2.01, 2.02, 2.03, ..., 4.02, 4.03, 4.04, 4.05, 4.06]),
 ragged.array([0, 0, 1, 1, 1, 1, 2, 2, 2, 3, 3, 3, 3, 3, 3]))

>>> ragged.io.from_cf_indexed(*ragged.io.to_cf_indexed(a))
ragged.array([
    [1.01, 1.02],
    [2.01, 2.02, 2.03, 2.04],
    [3.01, 3.02, 3.03],
    [4.01, 4.02, 4.03, 4.04, 4.05, 4.06]
])

This is the current state of the interface, after the first two commits of this PR. Maybe it will change before the PR is merged.

Copy link
Collaborator

@ianna ianna left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jpivarski - please, let me know what is the plan for this PR? Thanks!

@jpivarski
Copy link
Member Author

I think we should drop it. I was hoping to get the Zarr and Pangeo communities interested in ragged by adopting some of the conventions for raggedness that they use, but I haven't received any feedback beyond the in-person meeting where we talked about it. If the feature doesn't have users, we can't be sure that what's implemented here is what they want. (I don't have any sample files that conform to this convention.)

So I'm going to close the PR. It still exists, and should turn up in searches if anyone ever wants to revive this idea.

@jpivarski jpivarski closed this Jan 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants