From b7965c645cd679f43216411df6ff8f74243e56e9 Mon Sep 17 00:00:00 2001 From: mattgoalen <86776642+mattgoalen@users.noreply.github.com> Date: Wed, 20 Nov 2024 17:25:17 +0000 Subject: [PATCH 1/3] replace `np.uint8(-1)` etc. Silent truncation no longer occurs in the numpy >=2.0.0 --- obsarray/templater/dataset_util.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/obsarray/templater/dataset_util.py b/obsarray/templater/dataset_util.py index c1fbe57..31adb60 100644 --- a/obsarray/templater/dataset_util.py +++ b/obsarray/templater/dataset_util.py @@ -454,15 +454,15 @@ def get_default_fill_value(dtype: numpy.typecodes) -> Union[int, float]: if dtype == numpy.int8: return numpy.int8(-127) if dtype == numpy.uint8: - return numpy.uint8(-1) + return numpy.iinfo(np.uint8).max elif dtype == numpy.int16: return numpy.int16(-32767) elif dtype == numpy.uint16: - return numpy.uint16(-1) + return numpy.iinfo(np.uint16).max elif dtype == numpy.int32: return numpy.int32(-2147483647) elif dtype == numpy.uint32: - return numpy.uint32(-1) + return numpy.iinfo(np.uint32).max elif dtype == numpy.int64: return numpy.int64(-9223372036854775806) elif dtype == numpy.float32: From 805ba4c785b79ed6cfede5db586857e384781f49 Mon Sep 17 00:00:00 2001 From: mattgoalen <86776642+mattgoalen@users.noreply.github.com> Date: Wed, 20 Nov 2024 17:29:22 +0000 Subject: [PATCH 2/3] Fix np typo --- obsarray/templater/dataset_util.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/obsarray/templater/dataset_util.py b/obsarray/templater/dataset_util.py index 31adb60..4e0fc11 100644 --- a/obsarray/templater/dataset_util.py +++ b/obsarray/templater/dataset_util.py @@ -454,15 +454,15 @@ def get_default_fill_value(dtype: numpy.typecodes) -> Union[int, float]: if dtype == numpy.int8: return numpy.int8(-127) if dtype == numpy.uint8: - return numpy.iinfo(np.uint8).max + return numpy.iinfo(numpy.uint8).max elif dtype == numpy.int16: return numpy.int16(-32767) elif dtype == numpy.uint16: - return numpy.iinfo(np.uint16).max + return numpy.iinfo(numpy.uint16).max elif dtype == numpy.int32: return numpy.int32(-2147483647) elif dtype == numpy.uint32: - return numpy.iinfo(np.uint32).max + return numpy.iinfo(numpy.uint32).max elif dtype == numpy.int64: return numpy.int64(-9223372036854775806) elif dtype == numpy.float32: From 8866481584a6203972bae7a44a24dafd944dc8ab Mon Sep 17 00:00:00 2001 From: mattgoalen <86776642+mattgoalen@users.noreply.github.com> Date: Wed, 20 Nov 2024 17:32:10 +0000 Subject: [PATCH 3/3] remove netcdf4 versioning constraint --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 1755ebd..b41a6fa 100644 --- a/setup.py +++ b/setup.py @@ -25,7 +25,7 @@ def read(filename): description="Measurement data handling in Python", long_description=read("README.md"), packages=find_packages(exclude=("tests",)), - install_requires=["comet_maths", "netcdf4==1.6.5", "xarray"], + install_requires=["comet_maths", "netcdf4", "xarray"], extras_require={ "dev": [ "pre-commit",