From 9596c1f7c1e5f15714c6cefc2e168a885faf5bda Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20M=C3=BCller?= <mueller.seb@posteo.de> Date: Sat, 18 May 2024 20:57:24 +0200 Subject: [PATCH 01/10] finalize changelog for v1.5.2 --- CHANGELOG.md | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 61601c72..d1d6b108 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,13 +2,14 @@ All notable changes to **GSTools** will be documented in this file. -## [Unreleased] - ? +## [1.5.2] - Nifty Neon - 2024-05 ### Enhancements - added global variable `config.NUM_THREADS` to select number of threads for parallel computation ([#336](https://github.com/GeoStat-Framework/GSTools/pull/336)) +- speed up sampling with emcee by setting `vectorize=True` in `EnsembleSampler` ([#346](https://github.com/GeoStat-Framework/GSTools/pull/346)) - prepare numpy 2 support ([#340](https://github.com/GeoStat-Framework/GSTools/pull/340)) - - numpy 2.0.0rc1 for building extensions (for Python 3.9 and above) + - at least numpy 2.0.0rc1 for building extensions (for Python 3.9 and above) - check multiple numpy and scipy versions in CI - fixed minimal versions for numpy - use `np.asarray` everywhere with `np.atleast_(n)d` @@ -16,6 +17,7 @@ All notable changes to **GSTools** will be documented in this file. ### Bugfixes - build docs with latest sphinx version ([#340](https://github.com/GeoStat-Framework/GSTools/pull/340)) +- fixed zero division error in spectral density of Integral model ([#347](https://github.com/GeoStat-Framework/GSTools/pull/347)) ### Changes - require pyvista 0.40 at least ([#340](https://github.com/GeoStat-Framework/GSTools/pull/340)) @@ -435,7 +437,8 @@ See: [#197](https://github.com/GeoStat-Framework/GSTools/issues/197) First release of GSTools. -[Unreleased]: https://github.com/GeoStat-Framework/gstools/compare/v1.5.1...HEAD +[Unreleased]: https://github.com/GeoStat-Framework/gstools/compare/v1.5.2...HEAD +[1.5.2]: https://github.com/GeoStat-Framework/gstools/compare/v1.5.1...v1.5.2 [1.5.1]: https://github.com/GeoStat-Framework/gstools/compare/v1.5.0...v1.5.1 [1.5.0]: https://github.com/GeoStat-Framework/gstools/compare/v1.4.1...v1.5.0 [1.4.1]: https://github.com/GeoStat-Framework/gstools/compare/v1.4.0...v1.4.1 From e35ac2fedef6604214100910a321b51985c4ef98 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20M=C3=BCller?= <mueller.seb@posteo.de> Date: Sat, 18 May 2024 21:36:54 +0200 Subject: [PATCH 02/10] CI: add tests for macos arm64 --- .github/workflows/main.yml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index f8dc74cd..9e4b7f7b 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -87,7 +87,7 @@ jobs: strategy: fail-fast: false matrix: - os: [ubuntu-latest, windows-latest, macos-latest] + os: [ubuntu-latest, windows-latest, macos-latest-large, macos-latest] # https://github.com/scipy/oldest-supported-numpy/blob/main/setup.cfg ver: - {py: '3.8', np: '==1.20.0', sp: '==1.5.4'} @@ -96,6 +96,13 @@ jobs: - {py: '3.11', np: '==1.23.2', sp: '==1.9.2'} - {py: '3.12', np: '==1.26.2', sp: '==1.11.2'} - {py: '3.12', np: '>=2.0.0rc1', sp: '>=1.13.0'} + exclude: + - os: macos-latest + ver: {py: '3.8', np: '==1.20.0', sp: '==1.5.4'} + - os: macos-latest + ver: {py: '3.9', np: '==1.20.0', sp: '==1.5.4'} + - os: macos-latest + ver: {py: '3.10', np: '==1.21.6', sp: '==1.7.2'} steps: - uses: actions/checkout@v4 with: From 2c41982056832653a0879ad2a4498a7afdf7568e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20M=C3=BCller?= <mueller.seb@posteo.de> Date: Sat, 18 May 2024 21:37:38 +0200 Subject: [PATCH 03/10] fix pylint issues for used-before-assignment --- src/gstools/covmodel/fit.py | 2 ++ src/gstools/field/plot.py | 1 + src/gstools/krige/base.py | 1 + src/gstools/transform/field.py | 3 +-- 4 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/gstools/covmodel/fit.py b/src/gstools/covmodel/fit.py index b420be70..8b19f497 100755 --- a/src/gstools/covmodel/fit.py +++ b/src/gstools/covmodel/fit.py @@ -214,6 +214,7 @@ def fit_variogram( def _pre_para(model, para_select, sill, anis): """Preprocess selected parameters.""" var_last = False + var_tmp = 0.0 # init value for par in para_select: if par not in model.arg_bounds: raise ValueError(f"fit: unknown parameter in selection: {par}") @@ -464,6 +465,7 @@ def _post_fitting(model, para, popt, anis, is_dir_vario): fit_para = {} para_skip = 0 opt_skip = 0 + var_tmp = 0.0 # init value for par in DEFAULT_PARA: if para[par]: if par == "var": # set variance last diff --git a/src/gstools/field/plot.py b/src/gstools/field/plot.py index ab28c974..346ef602 100644 --- a/src/gstools/field/plot.py +++ b/src/gstools/field/plot.py @@ -291,6 +291,7 @@ def update_plane(label): s.vline.set_data(2 * [s.valinit], [-0.1, 1.1]) s.reset() im.set_extent(ax_extents[p]) + asp = 1.0 # init value if aspect == "quad": asp = ax_rngs[planes[p][0]] / ax_rngs[planes[p][1]] if aspect is not None: diff --git a/src/gstools/krige/base.py b/src/gstools/krige/base.py index 49a4f62f..78aa2a9f 100755 --- a/src/gstools/krige/base.py +++ b/src/gstools/krige/base.py @@ -337,6 +337,7 @@ def _get_krige_vecs( # determine the chunk size chunk_size = len(pos[0]) if chunk_slice[1] is None else chunk_slice[1] chunk_size -= chunk_slice[0] + chunk_pos = None # init value res = np.empty((self.krige_size, chunk_size), dtype=np.double) if only_mean: # set points to limit of the covariance to only get the mean diff --git a/src/gstools/transform/field.py b/src/gstools/transform/field.py index 4a281564..a123e798 100644 --- a/src/gstools/transform/field.py +++ b/src/gstools/transform/field.py @@ -262,8 +262,7 @@ def binary( """ if not process and divide is None: _check_for_default_normal(fld) - if divide is None: - mean = 0.0 if process and not keep_mean else fld.mean + mean = 0.0 if process and not keep_mean else fld.mean divide = mean if divide is None else divide upper = mean + np.sqrt(fld.model.sill) if upper is None else upper lower = mean - np.sqrt(fld.model.sill) if lower is None else lower From 5ab5b3b7d0b0e0df87d9875848ad70c9bebcc1a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20M=C3=BCller?= <mueller.seb@posteo.de> Date: Sat, 18 May 2024 21:44:59 +0200 Subject: [PATCH 04/10] CI: try macos-13 instead of latest-large --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 9e4b7f7b..9027c035 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -87,7 +87,7 @@ jobs: strategy: fail-fast: false matrix: - os: [ubuntu-latest, windows-latest, macos-latest-large, macos-latest] + os: [ubuntu-latest, windows-latest, macos-13, macos-latest] # https://github.com/scipy/oldest-supported-numpy/blob/main/setup.cfg ver: - {py: '3.8', np: '==1.20.0', sp: '==1.5.4'} From 48ca8a5a4611e9037976eb8a460955f3d9f6a353 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20M=C3=BCller?= <mueller.seb@posteo.de> Date: Sat, 18 May 2024 21:58:31 +0200 Subject: [PATCH 05/10] CI: try cibuildwheel@v2.18.0 and enable tests on macos arm64 --- .github/workflows/main.yml | 2 +- pyproject.toml | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 9027c035..21afca8e 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -71,7 +71,7 @@ jobs: fetch-depth: '0' - name: Build wheels - uses: pypa/cibuildwheel@v2.17.0 + uses: pypa/cibuildwheel@v2.18.0 env: CIBW_ARCHS: ${{ matrix.cfg.arch }} with: diff --git a/pyproject.toml b/pyproject.toml index 17bcb246..64c74e04 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -166,5 +166,3 @@ skip = ["cp36-*", "cp37-*", "pp*", "*-win32", "*-manylinux_i686", "*-musllinux_* # Run the package tests using `pytest` test-extras = "test" test-command = "pytest -v {package}/tests" -# Skip trying to test arm64 builds on Intel Macs -test-skip = "*-macosx_arm64 *-macosx_universal2:arm64" From e20aaf5fac05be3ac345bddf7ca20853dcc8ae36 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20M=C3=BCller?= <mueller.seb@posteo.de> Date: Sat, 18 May 2024 22:08:45 +0200 Subject: [PATCH 06/10] CI: simplify os selection --- .github/workflows/main.yml | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 21afca8e..ad3f561f 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -53,17 +53,13 @@ jobs: cython-lint src/gstools/ build_wheels: - name: wheels for ${{ matrix.cfg.os }} / ${{ matrix.cfg.arch }} + name: wheels for ${{ matrix.cfg.os }} runs-on: ${{ matrix.cfg.os }} strategy: fail-fast: false matrix: - cfg: - - { os: ubuntu-latest, arch: x86_64 } - - { os: windows-latest, arch: AMD64 } - - { os: macos-latest, arch: x86_64 } - - { os: macos-latest, arch: arm64 } - - { os: macos-latest, arch: universal2 } + # macos-13 is an intel runner, macos-14 is apple silicon + os: [ubuntu-latest, windows-latest, macos-13, macos-14] steps: - uses: actions/checkout@v4 @@ -72,8 +68,6 @@ jobs: - name: Build wheels uses: pypa/cibuildwheel@v2.18.0 - env: - CIBW_ARCHS: ${{ matrix.cfg.arch }} with: output-dir: dist @@ -87,7 +81,7 @@ jobs: strategy: fail-fast: false matrix: - os: [ubuntu-latest, windows-latest, macos-13, macos-latest] + os: [ubuntu-latest, windows-latest, macos-13, macos-14] # https://github.com/scipy/oldest-supported-numpy/blob/main/setup.cfg ver: - {py: '3.8', np: '==1.20.0', sp: '==1.5.4'} @@ -97,11 +91,11 @@ jobs: - {py: '3.12', np: '==1.26.2', sp: '==1.11.2'} - {py: '3.12', np: '>=2.0.0rc1', sp: '>=1.13.0'} exclude: - - os: macos-latest + - os: macos-14 ver: {py: '3.8', np: '==1.20.0', sp: '==1.5.4'} - - os: macos-latest + - os: macos-14 ver: {py: '3.9', np: '==1.20.0', sp: '==1.5.4'} - - os: macos-latest + - os: macos-14 ver: {py: '3.10', np: '==1.21.6', sp: '==1.7.2'} steps: - uses: actions/checkout@v4 From 26f300a2f19ad338f4d5a7bbc96fbe395dd3e79f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20M=C3=BCller?= <mueller.seb@posteo.de> Date: Sat, 18 May 2024 22:10:08 +0200 Subject: [PATCH 07/10] CI: bugfix --- .github/workflows/main.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index ad3f561f..7d1c7d01 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -53,8 +53,8 @@ jobs: cython-lint src/gstools/ build_wheels: - name: wheels for ${{ matrix.cfg.os }} - runs-on: ${{ matrix.cfg.os }} + name: wheels for ${{ matrix.os }} + runs-on: ${{ matrix.os }} strategy: fail-fast: false matrix: From a1c6b0fbd5617a4f90a8b8fb3ac87fc831483389 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20M=C3=BCller?= <mueller.seb@posteo.de> Date: Sun, 19 May 2024 00:00:31 +0200 Subject: [PATCH 08/10] dep: increase minimal matplotlib version to 3.7 --- pyproject.toml | 4 ++-- src/gstools/field/plot.py | 7 ------- 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 64c74e04..cd0dc6ed 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -57,7 +57,7 @@ dependencies = [ [project.optional-dependencies] doc = [ "m2r2>=0.2.8", - "matplotlib>=3", + "matplotlib>=3.7", "meshzoo>=0.7", "numpydoc>=1.1", "pykrige>=1.5,<2", @@ -68,7 +68,7 @@ doc = [ "sphinxcontrib-youtube>=1.1", ] plotting = [ - "matplotlib>=3", + "matplotlib>=3.7", "pyvista>=0.40", ] rust = ["gstools_core>=0.2.0,<1"] diff --git a/src/gstools/field/plot.py b/src/gstools/field/plot.py index 346ef602..49e3bb45 100644 --- a/src/gstools/field/plot.py +++ b/src/gstools/field/plot.py @@ -232,13 +232,6 @@ def plot_nd( ) rax.set_title(" Plane", loc="left") radio = RadioButtons(rax, plane_names, activecolor="grey") - # make radio buttons circular - rpos = rax.get_position().get_points() - fh, fw = fig.get_figheight(), fig.get_figwidth() - rscale = (rpos[:, 1].ptp() / rpos[:, 0].ptp()) * (fh / fw) - for circ in radio.circles: - circ.set_radius(0.06) - circ.height /= rscale elif mesh_type == "unstructured" and convex_hull: # show convex hull in 2D hull = ConvexHull(pos.T) From 73e2871dd18c65acdb40c59b0a1c422831110e67 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20M=C3=BCller?= <mueller.seb@posteo.de> Date: Sun, 19 May 2024 00:10:04 +0200 Subject: [PATCH 09/10] Pylint: ignore possibly-used-before-assignment for radio buttons --- src/gstools/field/plot.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gstools/field/plot.py b/src/gstools/field/plot.py index 49e3bb45..b17cfc71 100644 --- a/src/gstools/field/plot.py +++ b/src/gstools/field/plot.py @@ -10,7 +10,7 @@ plot_vec_field """ -# pylint: disable=C0103, W0613, E1101 +# pylint: disable=C0103, W0613, E1101, E0606 import numpy as np from scipy import interpolate as inter from scipy.spatial import ConvexHull From 8ad73c767b1030ab5368d484416e13083acd74e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20M=C3=BCller?= <mueller.seb@posteo.de> Date: Sun, 19 May 2024 00:26:05 +0200 Subject: [PATCH 10/10] update changelog --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index d1d6b108..20fb771b 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,9 +18,12 @@ All notable changes to **GSTools** will be documented in this file. ### Bugfixes - build docs with latest sphinx version ([#340](https://github.com/GeoStat-Framework/GSTools/pull/340)) - fixed zero division error in spectral density of Integral model ([#347](https://github.com/GeoStat-Framework/GSTools/pull/347)) +- minor pylint fixes for used-before-assignment issues ([#350](https://github.com/GeoStat-Framework/GSTools/pull/350)) ### Changes - require pyvista 0.40 at least ([#340](https://github.com/GeoStat-Framework/GSTools/pull/340)) +- require matplotlib 3.7 at least ([#350](https://github.com/GeoStat-Framework/GSTools/pull/350)) +- remove universal2 wheels for macos (we already provide separate intel and arm64 wheels) ([#350](https://github.com/GeoStat-Framework/GSTools/pull/350)) ## [1.5.1] - Nifty Neon - 2023-11