-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Description
With comet_maths version 1.0.7, the following obsarray tests fail on NixOS:
============================= test session starts ==============================
platform linux -- Python 3.12.11, pytest-8.3.5, pluggy-1.6.0
rootdir: /build/obsarray-1.0.3
configfile: pyproject.toml
collected 173 items
obsarray/templater/tests/test_dataset_util.py .......................F.. [ 15%]
........... [ 21%]
obsarray/templater/tests/test_dswriter.py . [ 21%]
obsarray/templater/tests/test_template_util.py .......... [ 27%]
obsarray/test/test_err_corr_forms.py .................. [ 38%]
obsarray/test/test_flag_accessor.py ........................FF....... [ 57%]
obsarray/test/test_unc_accessor.py ..................................... [ 78%]
.................................... [ 99%]
obsarray/test/test_utils.py . [100%]
=================================== FAILURES ===================================
_________________ TestDatasetUtil.test_get_default_fill_value __________________
self = <obsarray.templater.tests.test_dataset_util.TestDatasetUtil testMethod=test_get_default_fill_value>
def test_get_default_fill_value(self):
self.assertEqual(-127, DatasetUtil.get_default_fill_value(np.int8))
self.assertEqual(-32767, DatasetUtil.get_default_fill_value(np.int16))
> self.assertEqual(np.uint16(-1), DatasetUtil.get_default_fill_value(np.uint16))
E OverflowError: Python integer -1 out of bounds for uint16
obsarray/templater/tests/test_dataset_util.py:474: OverflowError
_____________________ TestFlag.test__setitem___True2False ______________________
self = <obsarray.test.test_flag_accessor.TestFlag testMethod=test__setitem___True2False>
def test__setitem___True2False(self):
self.ds["temperature_flags"].values[:] = 1
> self.ds.flag["temperature_flags"]["bad_data"][:, 1, :] = False
obsarray/test/test_flag_accessor.py:334:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <Flag>
(x: 2, time: 3)> Size: 6B
array([[ True, True, True],
[ True, True, True]])
Dimensions without coordinates: x, time
sli = (slice(None, None, None), 1, slice(None, None, None)), flag_value = False
def __setitem__(self, sli: tuple, flag_value):
"""
Sets flag values
:param sli: slice of variable
:param flag_value: flag value as a single value boolean to apply to all data or boolean mask array
"""
self._sli = self._expand_sli(sli)
flag_meanings, flag_masks = DatasetUtil.unpack_flag_attrs(
self._obj[self._flag_var_name].attrs
)
flag_bit = flag_meanings.index(self._flag_meaning)
flag_mask = flag_masks[flag_bit]
# if boolean to apply to all data
if isinstance(flag_value, bool):
if flag_value:
self._obj[self._flag_var_name].values[self._sli] = (
self._obj[self._flag_var_name][self._sli].values | flag_mask
)
else:
self._obj[self._flag_var_name].values[self._sli] = (
> self._obj[self._flag_var_name][self._sli].values & ~flag_mask
)
E OverflowError: Python integer -2 out of bounds for uint8
obsarray/flag_accessor.py:86: OverflowError
________________________ TestFlag.test__setitem___array ________________________
self = <obsarray.test.test_flag_accessor.TestFlag testMethod=test__setitem___array>
def test__setitem___array(self):
self.ds["temperature_flags"].values[:] = np.array(
[[[1, 1, 1], [0, 0, 0]], [[1, 1, 1], [0, 0, 0]]]
)
> self.ds.flag["temperature_flags"]["bad_data"][:, :, 0] = np.array(
[[False, True], [False, True]]
)
obsarray/test/test_flag_accessor.py:345:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <Flag>
(x: 2, y: 2)> Size: 4B
array([[ True, True],
[ True, True]])
Dimensions without coordinates: x, y
sli = (slice(None, None, None), slice(None, None, None), 0)
flag_value = array([[False, True],
[False, True]])
def __setitem__(self, sli: tuple, flag_value):
"""
Sets flag values
:param sli: slice of variable
:param flag_value: flag value as a single value boolean to apply to all data or boolean mask array
"""
self._sli = self._expand_sli(sli)
flag_meanings, flag_masks = DatasetUtil.unpack_flag_attrs(
self._obj[self._flag_var_name].attrs
)
flag_bit = flag_meanings.index(self._flag_meaning)
flag_mask = flag_masks[flag_bit]
# if boolean to apply to all data
if isinstance(flag_value, bool):
if flag_value:
self._obj[self._flag_var_name].values[self._sli] = (
self._obj[self._flag_var_name][self._sli].values | flag_mask
)
else:
self._obj[self._flag_var_name].values[self._sli] = (
self._obj[self._flag_var_name][self._sli].values & ~flag_mask
)
# else apply mask
else:
if flag_value.dtype is not np.dtype(bool):
TypeError("Flag mask must of boolean type")
i_true = np.where(flag_value == True)
i_false = np.where(flag_value == False)
self._obj[self._flag_var_name][self._sli].values[i_true] = np.array(
self._obj[self._flag_var_name][self._sli].values[i_true] | flag_mask
)
self._obj[self._flag_var_name][self._sli].values[i_false] = np.array(
> self._obj[self._flag_var_name][self._sli].values[i_false] & ~flag_mask
)
E OverflowError: Python integer -2 out of bounds for uint8
obsarray/flag_accessor.py:102: OverflowError
=============================== warnings summary ===============================
obsarray/test/test_err_corr_forms.py: 13 warnings
obsarray/test/test_unc_accessor.py: 51 warnings
/nix/store/yjmfx4jv3xlwk3lxbsd6g6ib2hrdk3i9-python3.12-xarray-2025.04.0/lib/python3.12/site-packages/xarray/namedarray/core.py:264: UserWarning: Duplicate dimension names present: dimensions {'x.time'} appear more than once in dims=('x.time', 'x.time'). We do not yet support duplicate dimension names, but we do allow initial construction of the object. We recommend you rename the dims immediately to become distinct, as most xarray functionality is likely to fail silently if you do not. To rename the dimensions you will need to set the ``.dims`` attribute of each variable, ``e.g. var.dims=('x0', 'x1')``.
self._dims = self._parse_dimensions(dims)
obsarray/test/test_unc_accessor.py: 17 warnings
/build/obsarray-1.0.3/obsarray/unc_accessor.py:124: FutureWarning: The return type of `Dataset.dims` will be changed to return a set of dimension names in future, in order to be more consistent with `DataArray.dims`. To access a mapping from dimension names to lengths, please use `Dataset.sizes`.
self._obj.dims.keys(), self._sli
obsarray/test/test_unc_accessor.py::TestVariableUncertainty::test_total_err_corr_matrix
obsarray/test/test_unc_accessor.py::TestUncertainty::test_err_corr_matrix_3dvar
obsarray/test/test_unc_accessor.py::TestUncertainty::test_err_cov_matrix
/nix/store/yjmfx4jv3xlwk3lxbsd6g6ib2hrdk3i9-python3.12-xarray-2025.04.0/lib/python3.12/site-packages/xarray/namedarray/core.py:264: UserWarning: Duplicate dimension names present: dimensions {'x.y.time'} appear more than once in dims=('x.y.time', 'x.y.time'). We do not yet support duplicate dimension names, but we do allow initial construction of the object. We recommend you rename the dims immediately to become distinct, as most xarray functionality is likely to fail silently if you do not. To rename the dimensions you will need to set the ``.dims`` attribute of each variable, ``e.g. var.dims=('x0', 'x1')``.
self._dims = self._parse_dimensions(dims)
obsarray/test/test_unc_accessor.py::TestVariableUncertainty::test_total_err_corr_matrix
/nix/store/yjmfx4jv3xlwk3lxbsd6g6ib2hrdk3i9-python3.12-xarray-2025.04.0/lib/python3.12/site-packages/xarray/namedarray/core.py:264: UserWarning: Duplicate dimension names present: dimensions {'x.y'} appear more than once in dims=('x.y', 'x.y'). We do not yet support duplicate dimension names, but we do allow initial construction of the object. We recommend you rename the dims immediately to become distinct, as most xarray functionality is likely to fail silently if you do not. To rename the dimensions you will need to set the ``.dims`` attribute of each variable, ``e.g. var.dims=('x0', 'x1')``.
self._dims = self._parse_dimensions(dims)
obsarray/test/test_unc_accessor.py::TestVariableUncertainty::test_total_err_corr_matrix
/nix/store/yjmfx4jv3xlwk3lxbsd6g6ib2hrdk3i9-python3.12-xarray-2025.04.0/lib/python3.12/site-packages/xarray/namedarray/core.py:264: UserWarning: Duplicate dimension names present: dimensions {'time'} appear more than once in dims=('time', 'time'). We do not yet support duplicate dimension names, but we do allow initial construction of the object. We recommend you rename the dims immediately to become distinct, as most xarray functionality is likely to fail silently if you do not. To rename the dimensions you will need to set the ``.dims`` attribute of each variable, ``e.g. var.dims=('x0', 'x1')``.
self._dims = self._parse_dimensions(dims)
obsarray/test/test_unc_accessor.py::TestUncertainty::test_rename
obsarray/test/test_unc_accessor.py::TestUncertainty::test_rename_vars
/nix/store/yjmfx4jv3xlwk3lxbsd6g6ib2hrdk3i9-python3.12-xarray-2025.04.0/lib/python3.12/site-packages/xarray/namedarray/core.py:503: UserWarning: Duplicate dimension names present: dimensions {'x.time'} appear more than once in dims=('x.time', 'x.time'). We do not yet support duplicate dimension names, but we do allow initial construction of the object. We recommend you rename the dims immediately to become distinct, as most xarray functionality is likely to fail silently if you do not. To rename the dimensions you will need to set the ``.dims`` attribute of each variable, ``e.g. var.dims=('x0', 'x1')``.
self._dims = self._parse_dimensions(value)
obsarray/test/test_unc_accessor.py::TestUncertainty::test_rename_dims
/nix/store/yjmfx4jv3xlwk3lxbsd6g6ib2hrdk3i9-python3.12-xarray-2025.04.0/lib/python3.12/site-packages/xarray/namedarray/core.py:503: UserWarning: Duplicate dimension names present: dimensions {'x.time_test'} appear more than once in dims=('x.time_test', 'x.time_test'). We do not yet support duplicate dimension names, but we do allow initial construction of the object. We recommend you rename the dims immediately to become distinct, as most xarray functionality is likely to fail silently if you do not. To rename the dimensions you will need to set the ``.dims`` attribute of each variable, ``e.g. var.dims=('x0', 'x1')``.
self._dims = self._parse_dimensions(value)
obsarray/test/test_unc_accessor.py::TestUncertainty::test_rename_dims
/nix/store/yjmfx4jv3xlwk3lxbsd6g6ib2hrdk3i9-python3.12-xarray-2025.04.0/lib/python3.12/site-packages/xarray/namedarray/core.py:264: UserWarning: Duplicate dimension names present: dimensions {'x.time_test'} appear more than once in dims=('x.time_test', 'x.time_test'). We do not yet support duplicate dimension names, but we do allow initial construction of the object. We recommend you rename the dims immediately to become distinct, as most xarray functionality is likely to fail silently if you do not. To rename the dimensions you will need to set the ``.dims`` attribute of each variable, ``e.g. var.dims=('x0', 'x1')``.
self._dims = self._parse_dimensions(dims)
obsarray/test/test_unc_accessor.py::TestUncertainty::test_rename_vars
/build/obsarray-1.0.3/obsarray/unc_accessor.py:955: UserWarning: rename 'time' to 'time_test' does not create an index anymore. Try using swap_dims instead or use set_index after rename to create an indexed coordinate.
ds = ds.rename(var_dict_no_unc)
obsarray/test/test_utils.py::TestAppendNames::test_append_names
/nix/store/yjmfx4jv3xlwk3lxbsd6g6ib2hrdk3i9-python3.12-xarray-2025.04.0/lib/python3.12/site-packages/xarray/namedarray/core.py:264: UserWarning: Duplicate dimension names present: dimensions {'y'} appear more than once in dims=('y', 'y'). We do not yet support duplicate dimension names, but we do allow initial construction of the object. We recommend you rename the dims immediately to become distinct, as most xarray functionality is likely to fail silently if you do not. To rename the dimensions you will need to set the ``.dims`` attribute of each variable, ``e.g. var.dims=('x0', 'x1')``.
self._dims = self._parse_dimensions(dims)
obsarray/test/test_utils.py::TestAppendNames::test_append_names
/nix/store/yjmfx4jv3xlwk3lxbsd6g6ib2hrdk3i9-python3.12-xarray-2025.04.0/lib/python3.12/site-packages/xarray/namedarray/core.py:503: UserWarning: Duplicate dimension names present: dimensions {'y'} appear more than once in dims=('y', 'y'). We do not yet support duplicate dimension names, but we do allow initial construction of the object. We recommend you rename the dims immediately to become distinct, as most xarray functionality is likely to fail silently if you do not. To rename the dimensions you will need to set the ``.dims`` attribute of each variable, ``e.g. var.dims=('x0', 'x1')``.
self._dims = self._parse_dimensions(value)
obsarray/test/test_utils.py::TestAppendNames::test_append_names
/build/obsarray-1.0.3/obsarray/utils.py:55: FutureWarning: The return type of `Dataset.dims` will be changed to return a set of dimension names in future, in order to be more consistent with `DataArray.dims`. To access a mapping from dimension names to lengths, please use `Dataset.sizes`.
dim_rename = {dim_name: dim_name + suffix for dim_name in ds.dims.keys()}
obsarray/test/test_utils.py::TestAppendNames::test_append_names
/nix/store/yjmfx4jv3xlwk3lxbsd6g6ib2hrdk3i9-python3.12-xarray-2025.04.0/lib/python3.12/site-packages/xarray/namedarray/core.py:503: UserWarning: Duplicate dimension names present: dimensions {'y_test'} appear more than once in dims=('y_test', 'y_test'). We do not yet support duplicate dimension names, but we do allow initial construction of the object. We recommend you rename the dims immediately to become distinct, as most xarray functionality is likely to fail silently if you do not. To rename the dimensions you will need to set the ``.dims`` attribute of each variable, ``e.g. var.dims=('x0', 'x1')``.
self._dims = self._parse_dimensions(value)
obsarray/test/test_utils.py::TestAppendNames::test_append_names
/nix/store/yjmfx4jv3xlwk3lxbsd6g6ib2hrdk3i9-python3.12-xarray-2025.04.0/lib/python3.12/site-packages/xarray/namedarray/core.py:264: UserWarning: Duplicate dimension names present: dimensions {'y_test'} appear more than once in dims=('y_test', 'y_test'). We do not yet support duplicate dimension names, but we do allow initial construction of the object. We recommend you rename the dims immediately to become distinct, as most xarray functionality is likely to fail silently if you do not. To rename the dimensions you will need to set the ``.dims`` attribute of each variable, ``e.g. var.dims=('x0', 'x1')``.
self._dims = self._parse_dimensions(dims)
-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
=========================== short test summary info ============================
FAILED obsarray/templater/tests/test_dataset_util.py::TestDatasetUtil::test_get_default_fill_value - OverflowError: Python integer -1 out of bounds for uint16
FAILED obsarray/test/test_flag_accessor.py::TestFlag::test__setitem___True2False - OverflowError: Python integer -2 out of bounds for uint8
FAILED obsarray/test/test_flag_accessor.py::TestFlag::test__setitem___array - OverflowError: Python integer -2 out of bounds for uint8
================== 3 failed, 170 passed, 96 warnings in 3.19s ==================
Are you aware of this? The fix should be trivial if I understand it correctly.
Metadata
Metadata
Assignees
Labels
No labels