Convert from/to `xarray`

Open
#978 0 comments 0 reactions 0 assignees View on GitHub

@davidhassell is already working on this.

Since Nov 20, 2026.

  • #980 by @davidhassell — open

Assessment

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

Research direction

Read the linked issue #935 for the existing conversion direction and inspect the package-level API and current to_xarray methods. Determine how conversion from xarray datasets should construct cf.Field and cf.Domain objects, including how lists should be handled; done means both conversion directions are available through the unified package-level API. A linked pull request (#980) is already open.

Written by the indexing model from the issue text.

Description

enhancement xarray

It would be nice to be able to convert from xarray datasets to cf.Field and cf.Domain constructs in memory.

See #935 (convert to xarray)

It would make sense to have a unified package-level API for this:

cf.from_xarray
cf.to_xarray

as opposed to to_xarray being a method on various classes. This new approach would also make it really easy to convert lists of fields/domains to xarray.

Dominant language
Python
Stars
151
Forks
23
Avg merge
3d 9h
Merged PRs (30d)
2

Getting set up

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 NCAS-CMS/cf-python

All issues in NCAS-CMS/cf-python

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.