Skip to content
Merged
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
3 changes: 2 additions & 1 deletion docs/src/whatsnew/latest.rst
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ This document explains the changes made to Iris for this release
🐛 Bugs Fixed
=============

#. N/A
#. `@pp-mo`_ prevented the CHUNK_CONTROL feature from hitting an error when loading
from a NetCDF v3 file. (:pull:`5897`)


💣 Incompatible Changes
Expand Down
3 changes: 3 additions & 0 deletions lib/iris/fileformats/netcdf/loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,9 @@ def _get_cf_var_data(cf_var, filename):
result = as_lazy_data(proxy, chunks=None, dask_chunking=True)
else:
chunks = cf_var.cf_data.chunking()
if chunks is None:
# Occurs for non-version-4 netcdf
chunks = "contiguous"
# In the "contiguous" case, pass chunks=None to 'as_lazy_data'.
if chunks == "contiguous":
if (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,15 @@ def test_default(tmp_filepath, save_cubelist_with_sigma):
assert sigma.lazy_bounds().chunksize == (4, 2)


def test_netcdf_v3():
# Just check that it does not fail when loading NetCDF v3 data
path = iris.tests.get_data_path(
["NetCDF", "global", "xyt", "SMALL_total_column_co2.nc.k2"]
)
with CHUNK_CONTROL.set(time=-1):
iris.load(path)


def test_control_global(tmp_filepath, save_cubelist_with_sigma):
cube_varname, _ = save_cubelist_with_sigma
with CHUNK_CONTROL.set(model_level_number=2):
Expand Down