Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions Changelog.rst
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
Version NEXTVERSION
-------------------
--------------

**2025-12-??**
**2026-01-??**

* Write Zarr v3 datasets with `cf.write`, and allow the reading of
grouped Zarr v2 and v3 datasets with `cf.read`
Comment on lines +6 to +7
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
* Write Zarr v3 datasets with `cf.write`, and allow the reading of
grouped Zarr v2 and v3 datasets with `cf.read`
* Write Zarr v3 datasets with `cf.write`

since the second part is duplicating the information in the bullet below (and I think it is nice to have them as separate bullets given the separate linked Issues).

(https://github.com/NCAS-CMS/cf-python/issues/895)
* Read Zarr v2 and v3 datasets that contain a group hierarchy with
`cf.read` (https://github.com/NCAS-CMS/cf-python/issues/894)
* Reduce the time taken to import `cf`
(https://github.com/NCAS-CMS/cf-python/issues/902)
* New optional dependency: ``zarr>=3.1.3``

----

Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,8 @@ of its array manipulation and can:
* read field constructs from netCDF, CDL, Zarr, PP and UM datasets with a
choice of netCDF backends,and in local, http, and s3 locations,
* create new field constructs in memory,
* write and append field and domain constructs to netCDF datasets on disk,
* write and append field and domain constructs to netCDF and Zarr v3
datasets on disk,
* read, create, and manipulate UGRID mesh topologies,
* read, write, and create coordinates defined by geometry cells,
* read netCDF and CDL datasets containing hierarchical groups,
Expand Down
4 changes: 2 additions & 2 deletions cf/functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -3184,7 +3184,7 @@ def environment(display=True, paths=True):
netCDF4: 1.7.2 /home/miniconda3/lib/python3.12/site-packages/netCDF4/__init__.py
h5netcdf: 1.3.0 /home/miniconda3/lib/python3.12/site-packages/h5netcdf/__init__.py
h5py: 3.12.1 /home/miniconda3/lib/python3.12/site-packages/h5py/__init__.py
zarr: 3.0.8 /home/miniconda3/lib/python3.12/site-packages/zarr/__init__.py
zarr: 3.1.3 /home/miniconda3/lib/python3.12/site-packages/zarr/__init__.py
s3fs: 2024.12.0 /home/miniconda3/lib/python3.12/site-packages/s3fs/__init__.py
scipy: 1.15.1 /home/miniconda3/lib/python3.12/site-packages/scipy/__init__.py
dask: 2025.5.1 /home/miniconda3/lib/python3.12/site-packages/dask/__init__.py
Expand All @@ -3210,7 +3210,7 @@ def environment(display=True, paths=True):
netCDF4: 1.7.2
h5netcdf: 1.3.0
h5py: 3.12.1
zarr: 3.0.8
zarr: 3.1.3
s3fs: 2024.12.0
scipy: 1.15.1
dask: 2025.5.1
Expand Down
10 changes: 10 additions & 0 deletions cf/read_write/read.py
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,10 @@ class read(cfdm.read):

.. versionadded:: 3.17.0

{{read store_dataset_shards: `bool`, optional}}

.. versionadded:: NEXTVERSION

{{read cfa: `dict`, optional}}

.. versionadded:: 3.15.0
Expand All @@ -328,6 +332,10 @@ class read(cfdm.read):

.. versionadded:: 3.17.0

{{read group_dimension_search: `str`, optional}}

.. versionadded:: (cfdm) NEXTVERSION
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
.. versionadded:: (cfdm) NEXTVERSION
.. versionadded:: NEXTVERSION


umversion: deprecated at version 3.0.0
Use the *um* parameter instead.

Expand Down Expand Up @@ -434,6 +442,7 @@ def __new__(
warn_valid=False,
dask_chunks="storage-aligned",
store_dataset_chunks=True,
store_dataset_shards=True,
domain=False,
cfa=None,
cfa_write=None,
Expand All @@ -445,6 +454,7 @@ def __new__(
ignore_read_error=False,
fmt=None,
file_type=None,
group_dimension_search="closest_ancestor",
):
"""Read field or domain constructs from a dataset."""
kwargs = locals()
Expand Down
16 changes: 8 additions & 8 deletions cf/read_write/um/umread.py
Original file line number Diff line number Diff line change
Expand Up @@ -3575,7 +3575,7 @@ def read(
# Return now if there are valid file types
return []

f = self.file_open(filename, parse=True)
f = self.dataset_open(filename, parse=True)

info = is_log_level_info(logger)

Expand All @@ -3598,7 +3598,7 @@ def read(
for var in f.vars
]

self.file_close()
self.dataset_close()

return [field for x in um for field in x.fields if field]

Expand Down Expand Up @@ -3632,7 +3632,7 @@ def _open_um_file(
The open PP or FF file object.

"""
self.file_close()
self.dataset_close()
try:
f = File(
filename,
Expand Down Expand Up @@ -3678,15 +3678,15 @@ def is_um_file(self, filename):
try:
# Note: No need to completely parse the file to ascertain
# if it's PP or FF.
self.file_open(filename, parse=False)
self.dataset_open(filename, parse=False)
except Exception:
self.file_close()
self.dataset_close()
return False
else:
self.file_close()
self.dataset_close()
return True

def file_close(self):
def dataset_close(self):
"""Close the file that has been read.

:Returns:
Expand All @@ -3700,7 +3700,7 @@ def file_close(self):

self._um_file = None

def file_open(self, filename, parse=True):
def dataset_open(self, filename, parse=True):
"""Open the file for reading.

:Paramters:
Expand Down
Loading