Skip to content
Closed
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
8 changes: 8 additions & 0 deletions .github/workflows/ci-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,14 @@ jobs:
mkdir --parents ${GITHUB_WORKSPACE}/iris_test_data
mv iris-test-data-${IRIS_TEST_DATA_VERSION} ${GITHUB_WORKSPACE}/iris_test_data_download

- name: "TEMPORARY: install specific Iris from pp-mo/lazy_encoding"
run: |
cd ${GITHUB_WORKSPACE}
git clone https://github.com/pp-mo/iris.git ./iris2
cd ./iris2
git checkout lazy_encoding
pip install -e .

- name: "Run tests"
if: matrix.session == 'tests'
run: |
Expand Down
6 changes: 3 additions & 3 deletions docs/userdocs/getting_started/introduction.rst
Original file line number Diff line number Diff line change
Expand Up @@ -265,9 +265,9 @@ Example code snippets :
Dimensions: (dim0: 3)
Dimensions without coordinates: dim0
Data variables:
vx0 (dim0) int64 ... dask.array<chunksize=(3,), meta=numpy.ma.MaskedArray>
vx1 (dim0) int64 ... dask.array<chunksize=(3,), meta=numpy.ma.MaskedArray>
v_mag (dim0) float64 ... dask.array<chunksize=(3,), meta=numpy.ma.MaskedArray>
vx0 (dim0) ... dask.array<chunksize=(3,), ...
vx1 (dim0) ... dask.array<chunksize=(3,), ...
v_mag (dim0) ... dask.array<chunksize=(3,), ...
Attributes:
Conventions: CF-1.7

Expand Down
5 changes: 5 additions & 0 deletions lib/ncdata/dataset_like.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,11 @@ def __setattr__(self, attr, value):
else:
self.setncattr(attr, value)

def set_auto_chartostring(self, value):
if bool(value):
msg = "Cannot enable 'auto_chartostring' for Nc4Dataselike or Nc4VariableLike."
raise ValueError(msg)


class Nc4DatasetLike(_Nc4DatalikeWithNcattrs):
"""
Expand Down
5 changes: 3 additions & 2 deletions tests/data_testcase_schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ def _define_iris_testdata_testcases():
# "_ORCA2__votemper",
# ]
EXCLUDES = []
for filepath in _netcdf_testfile_paths:
for filepath in sorted(_netcdf_testfile_paths):
param_name = str(filepath)
# remove unwanted path elements
param_name = param_name.replace(str(_testdirpath), "")
Expand Down Expand Up @@ -434,7 +434,7 @@ def _define_unit_dtype_testcases():
name="vx",
dims=["strlen"],
dtype="S1",
data=np.array("abc", dtype="S1"),
data=np.array(list("abc"), dtype="S1"),
)
],
}
Expand Down Expand Up @@ -525,6 +525,7 @@ def standard_testcase(request, session_testdir):
# """
"small_rotPole_precipitation",
"small_FC_167",
"test_monotonic_coordinate",
],
# Xarray can save ~anything
"save": [r"test_monotonic_coordinate"],
Expand Down
6 changes: 3 additions & 3 deletions tests/integration/test_iris_load_and_save_equivalence.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,9 @@ def test_load_direct_vs_viancdata(
# Some of the legacy UGRID unstructured files have incorrect encodings
# which are currently causing loading errors in Iris since UGRID loading
# became an always-on thing in v3.11
"unstructured_grid__theta_nodal_xios",
"ugrid__21_triangle_example",
# TEMP - re-enable ??
# "unstructured_grid__theta_nodal_xios",
# "ugrid__21_triangle_example",
]
if any(
name_fragment in standard_testcase.name
Expand Down Expand Up @@ -121,7 +122,6 @@ def test_save_direct_vs_viancdata(standard_testcase, tmp_path):
# Some of the legacy UGRID unstructured files have incorrect encodings
# which are currently causing loading errors in Iris since UGRID loading
# became an always-on thing in v3.11
"unstructured_grid__theta_nodal_xios",
"unstructured_grid__mesh_C12",
"ugrid__21_triangle_example",
]
Expand Down
35 changes: 21 additions & 14 deletions tests/integration/test_iris_xarray_roundtrips.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,18 +70,24 @@ def test_roundtrip_ixi(standard_testcase, use_irislock, adjust_chunks):
+ BAD_LOADSAVE_TESTCASES["xarray"]["load"]
# TODO: remaining unresolved problems ...
+ [
# string dimension problem
"ds__dtype__string",
# outstanding dims-mismatch problems.
"testing__small_theta_colpex",
# all-masked variables --> changing dtype, since xarray>v2026.02.0
"testing__cell_methods",
# coordinate attributes on mesh coordinate variables
"testdata____unstructured_grid__data_C4",
"testdata____ugrid__21_triangle_example",
# Problem with units on time bounds
"label_and_climate__small_FC_167",
# Broken UGRID files now won't load in Iris >= 3.10
"unstructured_grid__mesh_C12",
"_unstructured_grid__theta_nodal_xios",
# **No** mesh files will now roundtrip, since xarray 2026.04.0.
# This is because xarray now normalises the array type when loading
# from ncdata, removing masks and converting to nanarrays (thus making ints
# into floats).
# Previously we could create xarray Datasets with masked integer variables
# as data -- though that was alwaysobviously a bit tricksy.
# Iris can't accept the new form as it insists on integer types for
# mesh connectivities :-(
# TODO: do something to get this working again?
"unstructured",
]
)
if any(key in standard_testcase.name for key in exclude_case_keys):
Expand Down Expand Up @@ -209,14 +215,15 @@ def test_roundtrip_xix(
# float time(time) ;
# time:bounds = 'time_bnds'
# float time_bnds(time, time_bnds) ;
"label_and_climate__small_FC_167",
"rotated__xyt__small_rotPole_precipitation",
# This one fails to load in xarray, for somewhat unclear reasons
# NotImplementedError: Can not use auto rechunking with object dtype.
# We are unable to estimate the size in bytes of object data
"unstructured_grid__lfric_surface_mean",
# Iris loses the name of the unstructured dimension, causing multiple problems
"unstructured_grid__data_C4",
# TEMP - re-enable ??
# "label_and_climate__small_FC_167",
# "rotated__xyt__small_rotPole_precipitation",
# # This one fails to load in xarray, for somewhat unclear reasons
# # NotImplementedError: Can not use auto rechunking with object dtype.
# # We are unable to estimate the size in bytes of object data
# "unstructured_grid__lfric_surface_mean",
# # Iris loses the name of the unstructured dimension, causing multiple problems
# "unstructured_grid__data_C4",
]
if any(key in standard_testcase.name for key in excluded_casename_keys):
pytest.skip("excluded testcase")
Expand Down
Loading