From f8d67a148a102ac8799c407381d0ebe6dee88c1a Mon Sep 17 00:00:00 2001 From: KriWay Date: Thu, 30 Apr 2026 07:33:55 +0200 Subject: [PATCH 01/10] expect float16 in stead of float32 --- tests/test_raster_index_util.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/test_raster_index_util.py b/tests/test_raster_index_util.py index 12e3e0a..8f6ac23 100644 --- a/tests/test_raster_index_util.py +++ b/tests/test_raster_index_util.py @@ -236,20 +236,20 @@ def test_calc_index_s2(tmp_path, index, pixel_type): [ ("ndvi", "BYTE", gdal.GDT_UInt16, 32676, ["B04", "B08", "b1"], "uint8", 255), ("ndvi", "BYTE", gdal.GDT_Float32, np.nan, ["B04", "B08"], "uint8", 255), - ("ndvi", "FLOAT16", gdal.GDT_UInt16, 32676, ["B04", "B08"], "float32", np.nan), + ("ndvi", "FLOAT16", gdal.GDT_UInt16, 32676, ["B04", "B08"], "float16", np.nan), ( "ndvi", "FLOAT16", gdal.GDT_Float32, np.nan, ["B04", "B08"], - "float32", + "float16", np.nan, ), ("dprvi", "BYTE", gdal.GDT_UInt16, 32676, ["VH", "VV"], "uint8", 255), ("dprvi", "BYTE", gdal.GDT_Float32, np.nan, ["VH", "VV"], "uint8", 255), - ("dprvi", "FLOAT16", gdal.GDT_UInt16, 32676, ["VH", "VV"], "float32", np.nan), - ("dprvi", "FLOAT16", gdal.GDT_Float32, np.nan, ["VH", "VV"], "float32", np.nan), + ("dprvi", "FLOAT16", gdal.GDT_UInt16, 32676, ["VH", "VV"], "float16", np.nan), + ("dprvi", "FLOAT16", gdal.GDT_Float32, np.nan, ["VH", "VV"], "float16", np.nan), ], ) def test_calc_index_by_gdal_raster( From 0811a8a121561ebcd61f0f3ac324449e0da11fd3 Mon Sep 17 00:00:00 2001 From: KriWay Date: Thu, 30 Apr 2026 07:56:47 +0200 Subject: [PATCH 02/10] undo the changes --- tests/test_raster_index_util.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/test_raster_index_util.py b/tests/test_raster_index_util.py index 8f6ac23..12e3e0a 100644 --- a/tests/test_raster_index_util.py +++ b/tests/test_raster_index_util.py @@ -236,20 +236,20 @@ def test_calc_index_s2(tmp_path, index, pixel_type): [ ("ndvi", "BYTE", gdal.GDT_UInt16, 32676, ["B04", "B08", "b1"], "uint8", 255), ("ndvi", "BYTE", gdal.GDT_Float32, np.nan, ["B04", "B08"], "uint8", 255), - ("ndvi", "FLOAT16", gdal.GDT_UInt16, 32676, ["B04", "B08"], "float16", np.nan), + ("ndvi", "FLOAT16", gdal.GDT_UInt16, 32676, ["B04", "B08"], "float32", np.nan), ( "ndvi", "FLOAT16", gdal.GDT_Float32, np.nan, ["B04", "B08"], - "float16", + "float32", np.nan, ), ("dprvi", "BYTE", gdal.GDT_UInt16, 32676, ["VH", "VV"], "uint8", 255), ("dprvi", "BYTE", gdal.GDT_Float32, np.nan, ["VH", "VV"], "uint8", 255), - ("dprvi", "FLOAT16", gdal.GDT_UInt16, 32676, ["VH", "VV"], "float16", np.nan), - ("dprvi", "FLOAT16", gdal.GDT_Float32, np.nan, ["VH", "VV"], "float16", np.nan), + ("dprvi", "FLOAT16", gdal.GDT_UInt16, 32676, ["VH", "VV"], "float32", np.nan), + ("dprvi", "FLOAT16", gdal.GDT_Float32, np.nan, ["VH", "VV"], "float32", np.nan), ], ) def test_calc_index_by_gdal_raster( From 6e8b0b97a9a19fa90ca6acb22b019a5121c03fc4 Mon Sep 17 00:00:00 2001 From: KriWay Date: Mon, 4 May 2026 10:39:45 +0200 Subject: [PATCH 03/10] redo changes --- tests/test_raster_index_util.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/test_raster_index_util.py b/tests/test_raster_index_util.py index 12e3e0a..8f6ac23 100644 --- a/tests/test_raster_index_util.py +++ b/tests/test_raster_index_util.py @@ -236,20 +236,20 @@ def test_calc_index_s2(tmp_path, index, pixel_type): [ ("ndvi", "BYTE", gdal.GDT_UInt16, 32676, ["B04", "B08", "b1"], "uint8", 255), ("ndvi", "BYTE", gdal.GDT_Float32, np.nan, ["B04", "B08"], "uint8", 255), - ("ndvi", "FLOAT16", gdal.GDT_UInt16, 32676, ["B04", "B08"], "float32", np.nan), + ("ndvi", "FLOAT16", gdal.GDT_UInt16, 32676, ["B04", "B08"], "float16", np.nan), ( "ndvi", "FLOAT16", gdal.GDT_Float32, np.nan, ["B04", "B08"], - "float32", + "float16", np.nan, ), ("dprvi", "BYTE", gdal.GDT_UInt16, 32676, ["VH", "VV"], "uint8", 255), ("dprvi", "BYTE", gdal.GDT_Float32, np.nan, ["VH", "VV"], "uint8", 255), - ("dprvi", "FLOAT16", gdal.GDT_UInt16, 32676, ["VH", "VV"], "float32", np.nan), - ("dprvi", "FLOAT16", gdal.GDT_Float32, np.nan, ["VH", "VV"], "float32", np.nan), + ("dprvi", "FLOAT16", gdal.GDT_UInt16, 32676, ["VH", "VV"], "float16", np.nan), + ("dprvi", "FLOAT16", gdal.GDT_Float32, np.nan, ["VH", "VV"], "float16", np.nan), ], ) def test_calc_index_by_gdal_raster( From b4b70b994ea3007a4341f49d6761caf7452a295d Mon Sep 17 00:00:00 2001 From: KriWay Date: Mon, 4 May 2026 13:15:39 +0200 Subject: [PATCH 04/10] pinned version rasterio and tests with minimal python 3.12 --- .github/workflows/tests.yml | 4 ++-- ci/envs/latest.yml | 2 +- ci/envs/minimal.yml | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 3e7c226..17443b7 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -28,7 +28,7 @@ jobs: matrix: os: [ubuntu-latest] dev: [false] - python: ["3.10", "3.11", "3.12"] + python: ["3.12"] env: ["latest"] # Use openblas instead of mkl saves 600 MB. Linux OK, 50% slower on Windows and OSX! extra: ["nomkl"] @@ -36,7 +36,7 @@ jobs: - env: minimal os: ubuntu-latest dev: false - python: "3.10" + python: "3.12" - env: latest os: macos-latest dev: false diff --git a/ci/envs/latest.yml b/ci/envs/latest.yml index 5cc83c7..336634f 100644 --- a/ci/envs/latest.yml +++ b/ci/envs/latest.yml @@ -15,7 +15,7 @@ dependencies: - pandas - psutil - pyproj - - rasterio + - rasterio >=1.5 - rasterstats - rioxarray - scikit-learn diff --git a/ci/envs/minimal.yml b/ci/envs/minimal.yml index 9d8f287..2d5d1f7 100644 --- a/ci/envs/minimal.yml +++ b/ci/envs/minimal.yml @@ -15,7 +15,7 @@ dependencies: - pandas - psutil - pyproj - - rasterio + - rasterio =1.5 - rasterstats - rioxarray - scikit-learn From 94645468352ed7dfa057e1c3c07d62566d99f675 Mon Sep 17 00:00:00 2001 From: KriWay Date: Tue, 5 May 2026 10:04:19 +0200 Subject: [PATCH 05/10] use python 3.13 for macos-latest test --- .github/workflows/tests.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 17443b7..96f92e3 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -28,7 +28,7 @@ jobs: matrix: os: [ubuntu-latest] dev: [false] - python: ["3.12"] + python: ["3.10", "3.11", "3.12", "3.13"] env: ["latest"] # Use openblas instead of mkl saves 600 MB. Linux OK, 50% slower on Windows and OSX! extra: ["nomkl"] @@ -40,7 +40,7 @@ jobs: - env: latest os: macos-latest dev: false - python: "3.12" + python: "3.13" - env: latest os: windows-latest dev: false From 16c7b7402e97b648f167c6eaa5a6faff4442c514 Mon Sep 17 00:00:00 2001 From: KriWay Date: Tue, 5 May 2026 10:05:02 +0200 Subject: [PATCH 06/10] skip tests when certain rasterio version --- environment-dev.yml | 2 +- tests/test_raster_index_util.py | 92 +++++++++++++++++++++++++++++++-- 2 files changed, 89 insertions(+), 5 deletions(-) diff --git a/environment-dev.yml b/environment-dev.yml index be31ac4..93f95db 100644 --- a/environment-dev.yml +++ b/environment-dev.yml @@ -16,7 +16,7 @@ dependencies: - pandas - psutil - pyproj - - rasterio + - rasterio <1.5 - rasterstats - requests - rioxarray diff --git a/tests/test_raster_index_util.py b/tests/test_raster_index_util.py index 8f6ac23..197e286 100644 --- a/tests/test_raster_index_util.py +++ b/tests/test_raster_index_util.py @@ -236,8 +236,19 @@ def test_calc_index_s2(tmp_path, index, pixel_type): [ ("ndvi", "BYTE", gdal.GDT_UInt16, 32676, ["B04", "B08", "b1"], "uint8", 255), ("ndvi", "BYTE", gdal.GDT_Float32, np.nan, ["B04", "B08"], "uint8", 255), - ("ndvi", "FLOAT16", gdal.GDT_UInt16, 32676, ["B04", "B08"], "float16", np.nan), - ( + pytest.param( + "ndvi", + "FLOAT16", + gdal.GDT_UInt16, + 32676, + ["B04", "B08"], + "float16", + np.nan, + marks=pytest.mark.skipif( + rasterio.__version__ < "1.5", reason="Requires rasterio 1.5 or higher" + ), + ), + pytest.param( "ndvi", "FLOAT16", gdal.GDT_Float32, @@ -245,11 +256,84 @@ def test_calc_index_s2(tmp_path, index, pixel_type): ["B04", "B08"], "float16", np.nan, + marks=pytest.mark.skipif( + rasterio.__version__ < "1.5", reason="Requires rasterio 1.5 or higher" + ), + ), + pytest.param( + "ndvi", + "FLOAT16", + gdal.GDT_UInt16, + 32676, + ["B04", "B08"], + "float32", + np.nan, + marks=pytest.mark.skipif( + rasterio.__version__ >= "1.5", reason="Requires rasterio < 1.5" + ), + ), + pytest.param( + "ndvi", + "FLOAT16", + gdal.GDT_Float32, + np.nan, + ["B04", "B08"], + "float32", + np.nan, + marks=pytest.mark.skipif( + rasterio.__version__ >= "1.5", reason="Requires rasterio < 1.5" + ), ), ("dprvi", "BYTE", gdal.GDT_UInt16, 32676, ["VH", "VV"], "uint8", 255), ("dprvi", "BYTE", gdal.GDT_Float32, np.nan, ["VH", "VV"], "uint8", 255), - ("dprvi", "FLOAT16", gdal.GDT_UInt16, 32676, ["VH", "VV"], "float16", np.nan), - ("dprvi", "FLOAT16", gdal.GDT_Float32, np.nan, ["VH", "VV"], "float16", np.nan), + pytest.param( + "dprvi", + "FLOAT16", + gdal.GDT_UInt16, + 32676, + ["VH", "VV"], + "float16", + np.nan, + marks=pytest.mark.skipif( + rasterio.__version__ < "1.5", reason="Requires rasterio 1.5 or higher" + ), + ), + pytest.param( + "dprvi", + "FLOAT16", + gdal.GDT_Float32, + np.nan, + ["VH", "VV"], + "float16", + np.nan, + marks=pytest.mark.skipif( + rasterio.__version__ < "1.5", reason="Requires rasterio 1.5 or higher" + ), + ), + pytest.param( + "dprvi", + "FLOAT16", + gdal.GDT_UInt16, + 32676, + ["VH", "VV"], + "float32", + np.nan, + marks=pytest.mark.skipif( + rasterio.__version__ >= "1.5", reason="Requires rasterio < 1.5" + ), + ), + pytest.param( + "dprvi", + "FLOAT16", + gdal.GDT_Float32, + np.nan, + ["VH", "VV"], + "float32", + np.nan, + marks=pytest.mark.skipif( + rasterio.__version__ >= "1.5", reason="Requires rasterio < 1.5" + ), + ), ], ) def test_calc_index_by_gdal_raster( From 77090f6d3e94f8219aa9666497a25880088d638d Mon Sep 17 00:00:00 2001 From: KriWay Date: Tue, 5 May 2026 10:45:22 +0200 Subject: [PATCH 07/10] rasterio not pinned --- ci/envs/latest.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci/envs/latest.yml b/ci/envs/latest.yml index 336634f..5cc83c7 100644 --- a/ci/envs/latest.yml +++ b/ci/envs/latest.yml @@ -15,7 +15,7 @@ dependencies: - pandas - psutil - pyproj - - rasterio >=1.5 + - rasterio - rasterstats - rioxarray - scikit-learn From 0b61113902f6fa2da028bd3e3cca4ec2f5073399 Mon Sep 17 00:00:00 2001 From: KriWay Date: Tue, 5 May 2026 10:52:43 +0200 Subject: [PATCH 08/10] set minimal python version to 3.10 --- .github/workflows/tests.yml | 2 +- ci/envs/minimal.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 96f92e3..b5fc907 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -36,7 +36,7 @@ jobs: - env: minimal os: ubuntu-latest dev: false - python: "3.12" + python: "3.10" - env: latest os: macos-latest dev: false diff --git a/ci/envs/minimal.yml b/ci/envs/minimal.yml index 2d5d1f7..9d8f287 100644 --- a/ci/envs/minimal.yml +++ b/ci/envs/minimal.yml @@ -15,7 +15,7 @@ dependencies: - pandas - psutil - pyproj - - rasterio =1.5 + - rasterio - rasterstats - rioxarray - scikit-learn From e7507089a14a49cceacfbd68f532c93b98c828f7 Mon Sep 17 00:00:00 2001 From: KriWay Date: Tue, 5 May 2026 12:20:36 +0200 Subject: [PATCH 09/10] refactor yml --- .github/workflows/tests.yml | 4 +-- environment-dev.yml | 2 +- tests/test_raster_index_util.py | 45 ++++++++++++++++++++++++++++----- 3 files changed, 41 insertions(+), 10 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index b5fc907..a010a07 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -40,11 +40,11 @@ jobs: - env: latest os: macos-latest dev: false - python: "3.13" + python: "3.12" - env: latest os: windows-latest dev: false - python: "3.12" + python: "3.13" steps: - uses: actions/checkout@v6 diff --git a/environment-dev.yml b/environment-dev.yml index 93f95db..be31ac4 100644 --- a/environment-dev.yml +++ b/environment-dev.yml @@ -16,7 +16,7 @@ dependencies: - pandas - psutil - pyproj - - rasterio <1.5 + - rasterio - rasterstats - requests - rioxarray diff --git a/tests/test_raster_index_util.py b/tests/test_raster_index_util.py index 197e286..fd6d8c2 100644 --- a/tests/test_raster_index_util.py +++ b/tests/test_raster_index_util.py @@ -126,11 +126,38 @@ def test_calc_index_invalid(tmp_path): "index, pixel_type, process_options, expected_bands", [ ("dprvi", "BYTE", {}, ["dprvi"]), - ("dprvi", "FLOAT16", None, ["dprvi"]), + pytest.param( + "dprvi", + "FLOAT16", + None, + ["dprvi"], + marks=pytest.mark.skipif( + rasterio.__version__ == "1.4.4", + reason="Requires rasterio <> 1.4.4", + ), + ), ("dprvi", "FLOAT32", {}, ["dprvi"]), ("rvi", "BYTE", {}, ["rvi"]), - ("vvdvh", "FLOAT16", {}, ["vvdvh"]), - ("sarrgb", "FLOAT16", {}, ["vv", "vh", "vvdvh"]), + pytest.param( + "vvdvh", + "FLOAT16", + {}, + ["vvdvh"], + marks=pytest.mark.skipif( + rasterio.__version__ == "1.4.4", + reason="Requires rasterio <> 1.4.4", + ), + ), + pytest.param( + "sarrgb", + "FLOAT16", + {}, + ["vv", "vh", "vvdvh"], + marks=pytest.mark.skipif( + rasterio.__version__ == "1.4.4", + reason="Requires rasterio <> 1.4.4", + ), + ), ("sarrgb", "FLOAT32", {"log10": True}, ["vvdb", "vhdb", "vvdvhdb"]), ("sarrgb", "BYTE", {"log10": True}, ["vvdb", "vhdb", "vvdvhdb"]), ( @@ -269,7 +296,8 @@ def test_calc_index_s2(tmp_path, index, pixel_type): "float32", np.nan, marks=pytest.mark.skipif( - rasterio.__version__ >= "1.5", reason="Requires rasterio < 1.5" + rasterio.__version__ >= "1.5" or rasterio.__version__ == "1.4.4", + reason="Requires rasterio < 1.5", ), ), pytest.param( @@ -281,7 +309,8 @@ def test_calc_index_s2(tmp_path, index, pixel_type): "float32", np.nan, marks=pytest.mark.skipif( - rasterio.__version__ >= "1.5", reason="Requires rasterio < 1.5" + rasterio.__version__ >= "1.5" or rasterio.__version__ == "1.4.4", + reason="Requires rasterio < 1.5", ), ), ("dprvi", "BYTE", gdal.GDT_UInt16, 32676, ["VH", "VV"], "uint8", 255), @@ -319,7 +348,8 @@ def test_calc_index_s2(tmp_path, index, pixel_type): "float32", np.nan, marks=pytest.mark.skipif( - rasterio.__version__ >= "1.5", reason="Requires rasterio < 1.5" + rasterio.__version__ >= "1.5" or rasterio.__version__ == "1.4.4", + reason="Requires rasterio < 1.5", ), ), pytest.param( @@ -331,7 +361,8 @@ def test_calc_index_s2(tmp_path, index, pixel_type): "float32", np.nan, marks=pytest.mark.skipif( - rasterio.__version__ >= "1.5", reason="Requires rasterio < 1.5" + rasterio.__version__ >= "1.5" or rasterio.__version__ == "1.4.4", + reason="Requires rasterio < 1.5", ), ), ], From 6f2bdc6c61b4f6ff4eb8037f5b30ec1977c39c61 Mon Sep 17 00:00:00 2001 From: KriWay Date: Tue, 5 May 2026 12:38:41 +0200 Subject: [PATCH 10/10] refactor yml --- tests/test_raster_index_util.py | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/tests/test_raster_index_util.py b/tests/test_raster_index_util.py index fd6d8c2..b7e6402 100644 --- a/tests/test_raster_index_util.py +++ b/tests/test_raster_index_util.py @@ -238,7 +238,26 @@ def test_calc_index_s1_error( @pytest.mark.parametrize( - "index, pixel_type", [("ndvi", "BYTE"), ("ndvi", "FLOAT16"), ("bsi", "FLOAT16")] + "index, pixel_type", + [ + ("ndvi", "BYTE"), + pytest.param( + "ndvi", + "FLOAT16", + marks=pytest.mark.skipif( + rasterio.__version__ == "1.4.4", + reason="Requires rasterio <> 1.4.4", + ), + ), + pytest.param( + "bsi", + "FLOAT16", + marks=pytest.mark.skipif( + rasterio.__version__ == "1.4.4", + reason="Requires rasterio <> 1.4.4", + ), + ), + ], ) def test_calc_index_s2(tmp_path, index, pixel_type): # Prepare test data