From 69fc13baddc04f08453c4ddd22d6db533fd856eb Mon Sep 17 00:00:00 2001 From: Bas des Tombe Date: Fri, 28 Jul 2023 12:16:31 +0200 Subject: [PATCH 1/6] Update to python 3.11 netcdf4 to minimum of 1.6.4. Added flox as requirement to speed up resampling. --- .github/workflows/build.yml | 2 +- CHANGELOG.rst | 3 +++ pyproject.toml | 11 +++++++---- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ba481194..3faac415 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -39,7 +39,7 @@ jobs: fail-fast: false matrix: os: ['ubuntu-latest', 'macos-latest', 'windows-latest'] - python-version: ['3.9', '3.10'] + python-version: ['3.9', '3.10', '3.11'] steps: - uses: actions/checkout@v3 - name: Set up Python ${{ matrix.python-version }} diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 9ecbeeef..99128993 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -7,10 +7,13 @@ dev New features * Improved the functionality of `merge_double_ended`, by adding a check that handles measurements missing in one channel while present in the other ([#171](https://github.com/dtscalibration/python-dts-calibration/pull/171)) +* Support for Python 3.11 +* Requiring netcdf4 >= 1.6.4 Bug fixes * Single-ended measurements with `fix_alpha` failed due to a bug introduced in v2.0.0 ([#173](https://github.com/dtscalibration/python-dts-calibration/pull/173)). +* Flox included in requirements to speed up resampling via xarray ([Xarray #5734](https://github.com/pydata/xarray/pull/5734)). Introduced limitations diff --git a/pyproject.toml b/pyproject.toml index 1e896d88..b0904034 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -22,7 +22,7 @@ name = "dtscalibration" description = "A Python package to load raw DTS files, perform a calibration, and plot the result." readme = "README.rst" license = "BSD-3-Clause" -requires-python = ">=3.9, <3.11" +requires-python = ">=3.9, <=3.11" authors = [ {email = "bdestombe@gmail.com"}, {name = "Bas des Tombe, Bart Schilperoort"} @@ -48,6 +48,7 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", "Topic :: Utilities", ] dependencies = [ @@ -61,7 +62,8 @@ dependencies = [ "dask", "toolz", "matplotlib", - "netCDF4<=1.5.8", + "netCDF4>=1.6.4", + "flox", "pandas", ] dynamic = ["version"] @@ -117,7 +119,7 @@ build = [ features = ["dev"] [[tool.hatch.envs.matrix_test.matrix]] -python = ["3.9", "3.10"] +python = ["3.9", "3.10", "3.11"] [tool.hatch.envs.matrix_test.scripts] test = ["pytest ./src/ ./tests/",] # --doctest-modules @@ -155,7 +157,8 @@ line-length = 88 exclude = ["docs", "build"] # Allow unused variables when underscore-prefixed. dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$" -target-version = "py38" +# Minimum supported Python version +target-version = "py39" [tool.ruff.per-file-ignores] "tests/**" = ["D"] From 888354f3b8e9a89a79759b6fa52157c729e79a4b Mon Sep 17 00:00:00 2001 From: Bas des Tombe Date: Fri, 28 Jul 2023 12:31:36 +0200 Subject: [PATCH 2/6] pyyaml version requires 6.0.1 https://github.com/yaml/pyyaml/issues/724 --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index b0904034..b796de8b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -54,7 +54,7 @@ classifiers = [ dependencies = [ "numpy", "xarray", - "pyyaml", + "pyyaml>=6.0.1", "xmltodict", "scipy", "patsy", # a dependency of statsmodels From d8111e7a43290b01d80bae13e7d9e2de5d9cd5e3 Mon Sep 17 00:00:00 2001 From: Bas des Tombe Date: Fri, 28 Jul 2023 12:34:07 +0200 Subject: [PATCH 3/6] Update pyproject.toml requires-python = ">=3.9, <3.12" --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index b796de8b..b16f6333 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -22,7 +22,7 @@ name = "dtscalibration" description = "A Python package to load raw DTS files, perform a calibration, and plot the result." readme = "README.rst" license = "BSD-3-Clause" -requires-python = ">=3.9, <=3.11" +requires-python = ">=3.9, <3.12" authors = [ {email = "bdestombe@gmail.com"}, {name = "Bas des Tombe, Bart Schilperoort"} From cf2a2b2efcdce79fc74415e97bc64574dccaa58d Mon Sep 17 00:00:00 2001 From: Bas des Tombe Date: Fri, 28 Jul 2023 14:45:38 +0200 Subject: [PATCH 4/6] Compression not supported for variable length strings --- src/dtscalibration/datastore.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/dtscalibration/datastore.py b/src/dtscalibration/datastore.py index 6e1b0579..533fe650 100644 --- a/src/dtscalibration/datastore.py +++ b/src/dtscalibration/datastore.py @@ -662,6 +662,11 @@ def get_default_encoding(self, time_chunks_from_key=None): v['dtype'] = 'int32' # v['_FillValue'] = -9999 # Int does not support NaN + if np.issubdtype(self[k].dtype, str): + # Compression not supported for variable length strings + # https://github.com/Unidata/netcdf4-python/issues/1205 + v["zlib"] = False + if time_chunks_from_key is not None: # obtain optimal chunk sizes in time and x dim if self[time_chunks_from_key].dims == ('x', 'time'): From 18b4caf6038235c4805ce57c553194f5faaae30e Mon Sep 17 00:00:00 2001 From: Bas des Tombe Date: Fri, 28 Jul 2023 15:14:11 +0200 Subject: [PATCH 5/6] Fixed to_mf_netcdf() encodings --- src/dtscalibration/datastore.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/dtscalibration/datastore.py b/src/dtscalibration/datastore.py index 533fe650..156c8bab 100644 --- a/src/dtscalibration/datastore.py +++ b/src/dtscalibration/datastore.py @@ -662,7 +662,7 @@ def get_default_encoding(self, time_chunks_from_key=None): v['dtype'] = 'int32' # v['_FillValue'] = -9999 # Int does not support NaN - if np.issubdtype(self[k].dtype, str): + if np.issubdtype(self[k].dtype, str) or np.issubdtype(self[k].dtype, object): # Compression not supported for variable length strings # https://github.com/Unidata/netcdf4-python/issues/1205 v["zlib"] = False From c457f5379502088c87c3f0b38dddf2db64e7d9bd Mon Sep 17 00:00:00 2001 From: Bas des Tombe Date: Fri, 28 Jul 2023 15:57:16 +0200 Subject: [PATCH 6/6] Reorganized changelog --- CHANGELOG.rst | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 99128993..8bbbc317 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -4,24 +4,25 @@ Changelog dev --- -New features +Added * Improved the functionality of `merge_double_ended`, by adding a check that handles measurements missing in one channel while present in the other ([#171](https://github.com/dtscalibration/python-dts-calibration/pull/171)) * Support for Python 3.11 -* Requiring netcdf4 >= 1.6.4 -Bug fixes +Fixed * Single-ended measurements with `fix_alpha` failed due to a bug introduced in v2.0.0 ([#173](https://github.com/dtscalibration/python-dts-calibration/pull/173)). -* Flox included in requirements to speed up resampling via xarray ([Xarray #5734](https://github.com/pydata/xarray/pull/5734)). -Introduced limitations +Changed * Standardized parameter names. Reduced the freedom in choosing parameter names and dimension names in favor of simplifying the code. +* Requiring netcdf4 >= 1.6.4 +* Flox included in requirements to speed up resampling via xarray ([Xarray #5734](https://github.com/pydata/xarray/pull/5734)). Removed * Removed ds.resample_datastore() in favor of using xarray's resample function. See example notebook 2. +* Removed support for Python 3.8 2.0.0 (2023-05-24) ------------------