NCAS-CMS / NCAS-CMS/cf-python

Testing of to/from xarray

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

Nobody has claimed this yet.

enhancement xarray
Dominant language
Python
Stars
150
Forks
23
Avg merge
1d 11h
Merged PRs (30d)
2

Description

We now have cf.Field.to_xarray (#933), but we don't test if the contents of the created xarray.Dataset or xarwray.DataTree objects is any good. However, due in the August 2026 release, we will also have the ability to create cf.Field instance from xarray objects. We can then test the round-trip of cf.Field -> xr.Dataset -> cf.Field. It is likely (?) that the round trip won't be perfect, but the imperfections will be understood, so we should be able to test where we expect things to look the same.

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 with cf.Field.to_xarray (#933) and inspect how xarray.Dataset and xarray.DataTree objects are produced. Then follow the planned path for creating cf.Field from xarray objects. Add round-trip tests that assert the expected similarities and explicitly capture understood imperfections.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
data, testing
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.