From cf66db722bd86779619f4914859619c97b363911 Mon Sep 17 00:00:00 2001 From: LSchueler Date: Mon, 30 Jun 2025 23:10:59 +0200 Subject: [PATCH 01/15] Update gstools-core dep. to support py38 & py39 --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 3e09aaf6..cdcc6339 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -71,7 +71,7 @@ plotting = [ "matplotlib>=3.7", "pyvista>=0.40", ] -rust = ["gstools_core>=1.0.0"] +rust = ["gstools_core>=1.1.0"] test = ["pytest-cov>=3"] lint = [ "black>=24", From 520cfb713eaa18092fef67743af04e17f0f6c1d9 Mon Sep 17 00:00:00 2001 From: LSchueler Date: Mon, 30 Jun 2025 23:14:01 +0200 Subject: [PATCH 02/15] Drop meshzoo dep. to support py38 --- examples/01_random_field/05_mesh_ensemble.py | 10 +- examples/01_random_field/hexagon.mesh | 167 +++++++++++++++++++ pyproject.toml | 1 - 3 files changed, 171 insertions(+), 7 deletions(-) create mode 100644 examples/01_random_field/hexagon.mesh diff --git a/examples/01_random_field/05_mesh_ensemble.py b/examples/01_random_field/05_mesh_ensemble.py index 1e2f0da8..8a1d0c63 100755 --- a/examples/01_random_field/05_mesh_ensemble.py +++ b/examples/01_random_field/05_mesh_ensemble.py @@ -13,21 +13,19 @@ - `points="points"` will generate a field on the mesh points - `points="centroids"` will generate a field on the cell centroids - -In this example, we will generate a simple mesh with the aid of -`meshzoo `_. """ import matplotlib.pyplot as plt import matplotlib.tri as tri import meshio -import meshzoo import numpy as np import gstools as gs -# generate a triangulated hexagon with meshzoo -points, cells = meshzoo.ngon(6, 4) +# read a triangulated hexagon with meshio +mesh_input = meshio.read("hexagon.mesh") +points = mesh_input.points +cells = mesh_input.cells[0].data mesh = meshio.Mesh(points, {"triangle": cells}) ############################################################################### diff --git a/examples/01_random_field/hexagon.mesh b/examples/01_random_field/hexagon.mesh new file mode 100644 index 00000000..d2fc348d --- /dev/null +++ b/examples/01_random_field/hexagon.mesh @@ -0,0 +1,167 @@ +MeshVersionFormatted 2 +Dimension 2 + +Vertices +61 +0.0000000000000000e+00 0.0000000000000000e+00 1 +6.1232339957367660e-17 1.0000000000000000e+00 1 +-8.6602540378443849e-01 5.0000000000000033e-01 1 +-8.6602540378443882e-01 -4.9999999999999972e-01 1 +-1.8369701987210297e-16 -1.0000000000000000e+00 1 +8.6602540378443837e-01 -5.0000000000000044e-01 1 +8.6602540378443904e-01 4.9999999999999928e-01 1 +1.5308084989341915e-17 2.5000000000000000e-01 1 +3.0616169978683830e-17 5.0000000000000000e-01 1 +4.5924254968025742e-17 7.5000000000000000e-01 1 +-2.1650635094610957e-01 8.7500000000000011e-01 1 +-4.3301270189221919e-01 7.5000000000000022e-01 1 +-6.4951905283832889e-01 6.2500000000000022e-01 1 +-4.5924254968025742e-17 -2.5000000000000000e-01 1 +-9.1848509936051484e-17 -5.0000000000000000e-01 1 +-1.3777276490407724e-16 -7.5000000000000000e-01 1 +-6.4951905283832911e-01 -6.2499999999999978e-01 1 +-4.3301270189221952e-01 -7.4999999999999989e-01 1 +-2.1650635094610984e-01 -8.7499999999999989e-01 1 +-2.1650635094610970e-01 -1.2499999999999993e-01 1 +-4.3301270189221941e-01 -2.4999999999999986e-01 1 +-6.4951905283832911e-01 -3.7499999999999978e-01 1 +2.1650635094610976e-01 1.2499999999999982e-01 1 +4.3301270189221952e-01 2.4999999999999964e-01 1 +6.4951905283832922e-01 3.7499999999999944e-01 1 +-8.6602540378443860e-01 2.5000000000000028e-01 1 +-8.6602540378443860e-01 3.0531133177191805e-16 1 +-8.6602540378443871e-01 -2.4999999999999969e-01 1 +-2.1650635094610962e-01 1.2500000000000008e-01 1 +-4.3301270189221924e-01 2.5000000000000017e-01 1 +-6.4951905283832889e-01 3.7500000000000022e-01 1 +2.1650635094610945e-01 -8.7500000000000011e-01 1 +4.3301270189221908e-01 -7.5000000000000022e-01 1 +6.4951905283832878e-01 -6.2500000000000033e-01 1 +8.6602540378443860e-01 -2.5000000000000050e-01 1 +8.6602540378443871e-01 -5.8286708792820718e-16 1 +8.6602540378443882e-01 2.4999999999999933e-01 1 +2.1650635094610959e-01 -1.2500000000000011e-01 1 +4.3301270189221919e-01 -2.5000000000000022e-01 1 +6.4951905283832878e-01 -3.7500000000000033e-01 1 +2.1650635094610982e-01 8.7499999999999978e-01 1 +4.3301270189221958e-01 7.4999999999999967e-01 1 +6.4951905283832922e-01 6.2499999999999944e-01 1 +-2.1650635094610959e-01 3.7500000000000011e-01 1 +-2.1650635094610959e-01 6.2500000000000011e-01 1 +-4.3301270189221924e-01 5.0000000000000022e-01 1 +-4.3301270189221930e-01 1.5265566588595902e-16 1 +-6.4951905283832900e-01 1.2500000000000022e-01 1 +-6.4951905283832900e-01 -1.2499999999999978e-01 1 +-2.1650635094610976e-01 -3.7499999999999994e-01 1 +-4.3301270189221946e-01 -4.9999999999999989e-01 1 +-2.1650635094610979e-01 -6.2499999999999989e-01 1 +2.1650635094610954e-01 -3.7500000000000011e-01 1 +2.1650635094610951e-01 -6.2500000000000011e-01 1 +4.3301270189221913e-01 -5.0000000000000022e-01 1 +4.3301270189221935e-01 -2.9143354396410359e-16 1 +6.4951905283832900e-01 -1.2500000000000039e-01 1 +6.4951905283832911e-01 1.2499999999999953e-01 1 +2.1650635094610979e-01 3.7499999999999983e-01 1 +4.3301270189221952e-01 4.9999999999999967e-01 1 +2.1650635094610979e-01 6.2499999999999978e-01 1 + +Triangles +96 +1 8 29 1 +8 9 44 1 +9 10 45 1 +10 2 11 1 +8 44 29 1 +9 45 44 1 +10 11 45 1 +29 44 30 1 +44 45 46 1 +45 11 12 1 +44 46 30 1 +45 12 46 1 +30 46 31 1 +46 12 13 1 +46 13 31 1 +31 13 3 1 +1 29 20 1 +29 30 47 1 +30 31 48 1 +31 3 26 1 +29 47 20 1 +30 48 47 1 +31 26 48 1 +20 47 21 1 +47 48 49 1 +48 26 27 1 +47 49 21 1 +48 27 49 1 +21 49 22 1 +49 27 28 1 +49 28 22 1 +22 28 4 1 +1 20 14 1 +20 21 50 1 +21 22 51 1 +22 4 17 1 +20 50 14 1 +21 51 50 1 +22 17 51 1 +14 50 15 1 +50 51 52 1 +51 17 18 1 +50 52 15 1 +51 18 52 1 +15 52 16 1 +52 18 19 1 +52 19 16 1 +16 19 5 1 +1 14 38 1 +14 15 53 1 +15 16 54 1 +16 5 32 1 +14 53 38 1 +15 54 53 1 +16 32 54 1 +38 53 39 1 +53 54 55 1 +54 32 33 1 +53 55 39 1 +54 33 55 1 +39 55 40 1 +55 33 34 1 +55 34 40 1 +40 34 6 1 +1 38 23 1 +38 39 56 1 +39 40 57 1 +40 6 35 1 +38 56 23 1 +39 57 56 1 +40 35 57 1 +23 56 24 1 +56 57 58 1 +57 35 36 1 +56 58 24 1 +57 36 58 1 +24 58 25 1 +58 36 37 1 +58 37 25 1 +25 37 7 1 +1 23 8 1 +23 24 59 1 +24 25 60 1 +25 7 43 1 +23 59 8 1 +24 60 59 1 +25 43 60 1 +8 59 9 1 +59 60 61 1 +60 43 42 1 +59 61 9 1 +60 42 61 1 +9 61 10 1 +61 42 41 1 +61 41 10 1 +10 41 2 1 + +End diff --git a/pyproject.toml b/pyproject.toml index cdcc6339..c91da2e4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -58,7 +58,6 @@ dependencies = [ doc = [ "myst_parser", "matplotlib>=3.7", - "meshzoo>=0.7", "numpydoc>=1.1", "pykrige>=1.5,<2", "pyvista>=0.40", From f25facac1ff517d72927d647b05df2421ef134a8 Mon Sep 17 00:00:00 2001 From: LSchueler Date: Tue, 8 Jul 2025 17:44:19 +0200 Subject: [PATCH 03/15] Improve mesh input of example --- examples/01_random_field/05_mesh_ensemble.py | 7 +- examples/01_random_field/hexagon.mesh | 167 ------------------- examples/01_random_field/hexagon_cells.npy | Bin 0 -> 2432 bytes examples/01_random_field/hexagon_points.npy | Bin 0 -> 1104 bytes 4 files changed, 3 insertions(+), 171 deletions(-) delete mode 100644 examples/01_random_field/hexagon.mesh create mode 100644 examples/01_random_field/hexagon_cells.npy create mode 100644 examples/01_random_field/hexagon_points.npy diff --git a/examples/01_random_field/05_mesh_ensemble.py b/examples/01_random_field/05_mesh_ensemble.py index 8a1d0c63..2ae9a760 100755 --- a/examples/01_random_field/05_mesh_ensemble.py +++ b/examples/01_random_field/05_mesh_ensemble.py @@ -22,10 +22,9 @@ import gstools as gs -# read a triangulated hexagon with meshio -mesh_input = meshio.read("hexagon.mesh") -points = mesh_input.points -cells = mesh_input.cells[0].data +# read a triangulated hexagon +points = np.load("hexagon_points.npy") +cells = np.load("hexagon_cells.npy") mesh = meshio.Mesh(points, {"triangle": cells}) ############################################################################### diff --git a/examples/01_random_field/hexagon.mesh b/examples/01_random_field/hexagon.mesh deleted file mode 100644 index d2fc348d..00000000 --- a/examples/01_random_field/hexagon.mesh +++ /dev/null @@ -1,167 +0,0 @@ -MeshVersionFormatted 2 -Dimension 2 - -Vertices -61 -0.0000000000000000e+00 0.0000000000000000e+00 1 -6.1232339957367660e-17 1.0000000000000000e+00 1 --8.6602540378443849e-01 5.0000000000000033e-01 1 --8.6602540378443882e-01 -4.9999999999999972e-01 1 --1.8369701987210297e-16 -1.0000000000000000e+00 1 -8.6602540378443837e-01 -5.0000000000000044e-01 1 -8.6602540378443904e-01 4.9999999999999928e-01 1 -1.5308084989341915e-17 2.5000000000000000e-01 1 -3.0616169978683830e-17 5.0000000000000000e-01 1 -4.5924254968025742e-17 7.5000000000000000e-01 1 --2.1650635094610957e-01 8.7500000000000011e-01 1 --4.3301270189221919e-01 7.5000000000000022e-01 1 --6.4951905283832889e-01 6.2500000000000022e-01 1 --4.5924254968025742e-17 -2.5000000000000000e-01 1 --9.1848509936051484e-17 -5.0000000000000000e-01 1 --1.3777276490407724e-16 -7.5000000000000000e-01 1 --6.4951905283832911e-01 -6.2499999999999978e-01 1 --4.3301270189221952e-01 -7.4999999999999989e-01 1 --2.1650635094610984e-01 -8.7499999999999989e-01 1 --2.1650635094610970e-01 -1.2499999999999993e-01 1 --4.3301270189221941e-01 -2.4999999999999986e-01 1 --6.4951905283832911e-01 -3.7499999999999978e-01 1 -2.1650635094610976e-01 1.2499999999999982e-01 1 -4.3301270189221952e-01 2.4999999999999964e-01 1 -6.4951905283832922e-01 3.7499999999999944e-01 1 --8.6602540378443860e-01 2.5000000000000028e-01 1 --8.6602540378443860e-01 3.0531133177191805e-16 1 --8.6602540378443871e-01 -2.4999999999999969e-01 1 --2.1650635094610962e-01 1.2500000000000008e-01 1 --4.3301270189221924e-01 2.5000000000000017e-01 1 --6.4951905283832889e-01 3.7500000000000022e-01 1 -2.1650635094610945e-01 -8.7500000000000011e-01 1 -4.3301270189221908e-01 -7.5000000000000022e-01 1 -6.4951905283832878e-01 -6.2500000000000033e-01 1 -8.6602540378443860e-01 -2.5000000000000050e-01 1 -8.6602540378443871e-01 -5.8286708792820718e-16 1 -8.6602540378443882e-01 2.4999999999999933e-01 1 -2.1650635094610959e-01 -1.2500000000000011e-01 1 -4.3301270189221919e-01 -2.5000000000000022e-01 1 -6.4951905283832878e-01 -3.7500000000000033e-01 1 -2.1650635094610982e-01 8.7499999999999978e-01 1 -4.3301270189221958e-01 7.4999999999999967e-01 1 -6.4951905283832922e-01 6.2499999999999944e-01 1 --2.1650635094610959e-01 3.7500000000000011e-01 1 --2.1650635094610959e-01 6.2500000000000011e-01 1 --4.3301270189221924e-01 5.0000000000000022e-01 1 --4.3301270189221930e-01 1.5265566588595902e-16 1 --6.4951905283832900e-01 1.2500000000000022e-01 1 --6.4951905283832900e-01 -1.2499999999999978e-01 1 --2.1650635094610976e-01 -3.7499999999999994e-01 1 --4.3301270189221946e-01 -4.9999999999999989e-01 1 --2.1650635094610979e-01 -6.2499999999999989e-01 1 -2.1650635094610954e-01 -3.7500000000000011e-01 1 -2.1650635094610951e-01 -6.2500000000000011e-01 1 -4.3301270189221913e-01 -5.0000000000000022e-01 1 -4.3301270189221935e-01 -2.9143354396410359e-16 1 -6.4951905283832900e-01 -1.2500000000000039e-01 1 -6.4951905283832911e-01 1.2499999999999953e-01 1 -2.1650635094610979e-01 3.7499999999999983e-01 1 -4.3301270189221952e-01 4.9999999999999967e-01 1 -2.1650635094610979e-01 6.2499999999999978e-01 1 - -Triangles -96 -1 8 29 1 -8 9 44 1 -9 10 45 1 -10 2 11 1 -8 44 29 1 -9 45 44 1 -10 11 45 1 -29 44 30 1 -44 45 46 1 -45 11 12 1 -44 46 30 1 -45 12 46 1 -30 46 31 1 -46 12 13 1 -46 13 31 1 -31 13 3 1 -1 29 20 1 -29 30 47 1 -30 31 48 1 -31 3 26 1 -29 47 20 1 -30 48 47 1 -31 26 48 1 -20 47 21 1 -47 48 49 1 -48 26 27 1 -47 49 21 1 -48 27 49 1 -21 49 22 1 -49 27 28 1 -49 28 22 1 -22 28 4 1 -1 20 14 1 -20 21 50 1 -21 22 51 1 -22 4 17 1 -20 50 14 1 -21 51 50 1 -22 17 51 1 -14 50 15 1 -50 51 52 1 -51 17 18 1 -50 52 15 1 -51 18 52 1 -15 52 16 1 -52 18 19 1 -52 19 16 1 -16 19 5 1 -1 14 38 1 -14 15 53 1 -15 16 54 1 -16 5 32 1 -14 53 38 1 -15 54 53 1 -16 32 54 1 -38 53 39 1 -53 54 55 1 -54 32 33 1 -53 55 39 1 -54 33 55 1 -39 55 40 1 -55 33 34 1 -55 34 40 1 -40 34 6 1 -1 38 23 1 -38 39 56 1 -39 40 57 1 -40 6 35 1 -38 56 23 1 -39 57 56 1 -40 35 57 1 -23 56 24 1 -56 57 58 1 -57 35 36 1 -56 58 24 1 -57 36 58 1 -24 58 25 1 -58 36 37 1 -58 37 25 1 -25 37 7 1 -1 23 8 1 -23 24 59 1 -24 25 60 1 -25 7 43 1 -23 59 8 1 -24 60 59 1 -25 43 60 1 -8 59 9 1 -59 60 61 1 -60 43 42 1 -59 61 9 1 -60 42 61 1 -9 61 10 1 -61 42 41 1 -61 41 10 1 -10 41 2 1 - -End diff --git a/examples/01_random_field/hexagon_cells.npy b/examples/01_random_field/hexagon_cells.npy new file mode 100644 index 0000000000000000000000000000000000000000..b04f21cc0a12d8a13c66f755d8a781955e047eed GIT binary patch literal 2432 zcmbW(%T7}P6ouh}A_{m{L{T_i4`{t`k((Vm!#Hu^$TU(T2@%s0C&s7Xg{jH9ZnLr4ZT>aq{mgXona+Gz^5x`Lnevt7Zl*kuOw8+^pU1sDk9&J} zxJUUO8TYz87td_raXjvEbuTZ)Bje{vFXK)9WO&2--A*BUzBlP*zPIUR-uuPlo}b6P zJ&${Pcep$8%eZ&xWu6Cx$MN8CbuZtIN5(IfUdEgH3*im#cQu9V`PS0QeCz3D-W$c^ zo}b6PJ&${Pcercu%eam7GSAJz<9P76x|grVBjazCUdEgHi{TCL_dJE{`8LzbeDBlC zyvxPoo}b6PJ&${Pceoev%ebxdGEY-@91k8>_i`JLjDK8u8E@*R!W-UiK85W0w$sae zJLzTKC&lBQpU1sDk9&J}xO?%-xZU(J&(p%=c<{KomlxuZ@y|*x<4ygg@P_xBP9b}~ zz4S8Qhx9V<%i?j*&*R>n$GyEfoZoL5*UR_HJge#PI37H%?q&ZEWc*6}dKqu({ZBaq DTG>Eu literal 0 HcmV?d00001 diff --git a/examples/01_random_field/hexagon_points.npy b/examples/01_random_field/hexagon_points.npy new file mode 100644 index 0000000000000000000000000000000000000000..0179d4ff7b152972b64ed7e101b6d01b4bb8d56d GIT binary patch literal 1104 zcmbV~y=zlp6vk7(?cn4ea3`-qC|E&S2^?^6s>MZ65G2?X2eEA;1r`QT3Q zziT-6&)R?K@QEYUhXrhJ$@7T|>8W>ulE7_47UhkJZXi_f{)USd(9JwKj_+P%^ zzN{iI-D~y5o(*&Bg%>>kYWEw8{zU9go&9p;*yn?Ov}6VK2=mmcu@mO0cj*WH?kfGr zLHJSrFYxoe#(9twe%POg{jYN#969#-`%IvvYxINs`|^f9 k3G;Kz?_G`m%OUv5=0`T+hj~PTJeq!fe%N{2pL2fYFK Date: Wed, 9 Jul 2025 22:14:48 +0200 Subject: [PATCH 04/15] Drop all local pylint commands --- src/gstools/config.py | 1 - src/gstools/covmodel/base.py | 1 - src/gstools/covmodel/fit.py | 1 - src/gstools/covmodel/models.py | 1 - src/gstools/covmodel/plot.py | 1 - src/gstools/covmodel/sum_tools.py | 1 - src/gstools/covmodel/tools.py | 1 - src/gstools/covmodel/tpl_models.py | 1 - src/gstools/field/base.py | 1 - src/gstools/field/cond_srf.py | 1 - src/gstools/field/generator.py | 18 ++++++++---------- src/gstools/field/pgs.py | 1 - src/gstools/field/plot.py | 1 - src/gstools/field/srf.py | 1 - src/gstools/field/tools.py | 1 - src/gstools/field/upscaling.py | 1 - src/gstools/krige/base.py | 26 ++++++++++++-------------- src/gstools/krige/methods.py | 1 - src/gstools/krige/tools.py | 1 - src/gstools/normalizer/base.py | 1 - src/gstools/normalizer/methods.py | 1 - src/gstools/random/rng.py | 1 - src/gstools/tools/export.py | 1 - src/gstools/tools/geometric.py | 1 - src/gstools/tools/misc.py | 1 - src/gstools/tools/special.py | 1 - src/gstools/transform/array.py | 1 - src/gstools/transform/field.py | 1 - src/gstools/variogram/variogram.py | 28 +++++++++++++--------------- 29 files changed, 33 insertions(+), 65 deletions(-) diff --git a/src/gstools/config.py b/src/gstools/config.py index 9c399f68..f72456ae 100644 --- a/src/gstools/config.py +++ b/src/gstools/config.py @@ -7,7 +7,6 @@ NUM_THREADS = None -# pylint: disable=W0611 try: # pragma: no cover import gstools_core diff --git a/src/gstools/covmodel/base.py b/src/gstools/covmodel/base.py index 53a925f0..8e3b2ae3 100644 --- a/src/gstools/covmodel/base.py +++ b/src/gstools/covmodel/base.py @@ -10,7 +10,6 @@ SumModel """ -# pylint: disable=C0103, R0201, E1101, C0302, W0613, W0231 import copy import numpy as np diff --git a/src/gstools/covmodel/fit.py b/src/gstools/covmodel/fit.py index 8ad510de..bb882bf0 100755 --- a/src/gstools/covmodel/fit.py +++ b/src/gstools/covmodel/fit.py @@ -9,7 +9,6 @@ fit_variogram """ -# pylint: disable=C0103, W0632 import numpy as np from scipy.optimize import curve_fit diff --git a/src/gstools/covmodel/models.py b/src/gstools/covmodel/models.py index cb495751..3c47b351 100644 --- a/src/gstools/covmodel/models.py +++ b/src/gstools/covmodel/models.py @@ -22,7 +22,6 @@ JBessel """ -# pylint: disable=C0103, C0302, E1101, R0201 import warnings import numpy as np diff --git a/src/gstools/covmodel/plot.py b/src/gstools/covmodel/plot.py index f7fa58db..ce35f9bf 100644 --- a/src/gstools/covmodel/plot.py +++ b/src/gstools/covmodel/plot.py @@ -25,7 +25,6 @@ plot_spectral_rad_pdf """ -# pylint: disable=C0103, C0415, E1130 import numpy as np from gstools.tools.geometric import generate_grid diff --git a/src/gstools/covmodel/sum_tools.py b/src/gstools/covmodel/sum_tools.py index 253ee5a4..37bdb98e 100644 --- a/src/gstools/covmodel/sum_tools.py +++ b/src/gstools/covmodel/sum_tools.py @@ -17,7 +17,6 @@ sum_model_repr """ -# pylint: disable=W0212 import numpy as np from gstools.tools import RADIAN_SCALE diff --git a/src/gstools/covmodel/tools.py b/src/gstools/covmodel/tools.py index cfba8259..1d26d062 100644 --- a/src/gstools/covmodel/tools.py +++ b/src/gstools/covmodel/tools.py @@ -22,7 +22,6 @@ model_repr """ -# pylint: disable=C0103, W0212 import warnings import numpy as np diff --git a/src/gstools/covmodel/tpl_models.py b/src/gstools/covmodel/tpl_models.py index 40ed4ec8..46472d1b 100644 --- a/src/gstools/covmodel/tpl_models.py +++ b/src/gstools/covmodel/tpl_models.py @@ -12,7 +12,6 @@ TPLSimple """ -# pylint: disable=C0103, E1101 import warnings import numpy as np diff --git a/src/gstools/field/base.py b/src/gstools/field/base.py index 2006b858..247d17e7 100755 --- a/src/gstools/field/base.py +++ b/src/gstools/field/base.py @@ -9,7 +9,6 @@ Field """ -# pylint: disable=C0103, C0415 from collections.abc import Iterable from copy import copy from functools import partial diff --git a/src/gstools/field/cond_srf.py b/src/gstools/field/cond_srf.py index c3e03fe2..e74ded2b 100644 --- a/src/gstools/field/cond_srf.py +++ b/src/gstools/field/cond_srf.py @@ -9,7 +9,6 @@ CondSRF """ -# pylint: disable=C0103, W0231, W0221, W0222, E1102 import numpy as np diff --git a/src/gstools/field/generator.py b/src/gstools/field/generator.py index a260163c..096e880c 100755 --- a/src/gstools/field/generator.py +++ b/src/gstools/field/generator.py @@ -14,7 +14,6 @@ Fourier """ -# pylint: disable=C0103, W0222, C0412, W0231 import warnings from abc import ABC, abstractmethod from copy import deepcopy as dcp @@ -29,8 +28,7 @@ from gstools.random.rng import RNG from gstools.tools.geometric import generate_grid -if config._GSTOOLS_CORE_AVAIL: # pylint: disable=W0212; # pragma: no cover - # pylint: disable=E0401 +if config._GSTOOLS_CORE_AVAIL: # pragma: no cover from gstools_core import summate as summate_gsc from gstools_core import summate_fourier as summate_fourier_gsc from gstools_core import summate_incompr as summate_incompr_gsc @@ -45,9 +43,9 @@ def _summate(cov_samples, z_1, z_2, pos, num_threads=None): """A wrapper function for calling the randomization algorithms.""" if ( config.USE_GSTOOLS_CORE - and config._GSTOOLS_CORE_AVAIL # pylint: disable=W0212 + and config._GSTOOLS_CORE_AVAIL ): - summate_fct = summate_gsc # pylint: disable=E0606 + summate_fct = summate_gsc else: summate_fct = summate_c return summate_fct(cov_samples, z_1, z_2, pos, num_threads) @@ -64,9 +62,9 @@ def _summate_incompr( if ( config.USE_GSTOOLS_CORE - and config._GSTOOLS_CORE_AVAIL # pylint: disable=W0212 + and config._GSTOOLS_CORE_AVAIL ): - summate_incompr_fct = summate_incompr_gsc # pylint: disable=E0606 + summate_incompr_fct = summate_incompr_gsc else: summate_incompr_fct = summate_incompr_c return summate_incompr_fct(cov_samples, z_1, z_2, pos, num_threads) @@ -76,9 +74,9 @@ def _summate_fourier(spectrum_factor, modes, z_1, z_2, pos, num_threads=None): """A wrapper function for calling the Fourier algorithms.""" if ( config.USE_GSTOOLS_CORE - and config._GSTOOLS_CORE_AVAIL # pylint: disable=W0212 + and config._GSTOOLS_CORE_AVAIL ): - summate_fourier_fct = summate_fourier_gsc # pylint: disable=E0606 + summate_fourier_fct = summate_fourier_gsc else: summate_fourier_fct = summate_fourier_c return summate_fourier_fct( @@ -832,7 +830,7 @@ def reset_seed(self, seed=np.nan): def _fill_to_dim( self, values, dim, dtype=float, default_value=None - ): # pylint: disable=R6301 + ): """Fill an array with last element up to len(dim).""" r = np.atleast_1d(values) if values is None: diff --git a/src/gstools/field/pgs.py b/src/gstools/field/pgs.py index 2ab7b226..fde734ce 100644 --- a/src/gstools/field/pgs.py +++ b/src/gstools/field/pgs.py @@ -11,7 +11,6 @@ PGS """ -# pylint: disable=C0103 import numpy as np # very clunky way of supporting both np 1.x and 2.x exceptions diff --git a/src/gstools/field/plot.py b/src/gstools/field/plot.py index b17cfc71..b36b048a 100644 --- a/src/gstools/field/plot.py +++ b/src/gstools/field/plot.py @@ -10,7 +10,6 @@ plot_vec_field """ -# pylint: disable=C0103, W0613, E1101, E0606 import numpy as np from scipy import interpolate as inter from scipy.spatial import ConvexHull diff --git a/src/gstools/field/srf.py b/src/gstools/field/srf.py index c1d5081e..a43591de 100755 --- a/src/gstools/field/srf.py +++ b/src/gstools/field/srf.py @@ -9,7 +9,6 @@ SRF """ -# pylint: disable=C0103, W0221, E1102 import numpy as np diff --git a/src/gstools/field/tools.py b/src/gstools/field/tools.py index dfa2e3c6..0f528f5e 100644 --- a/src/gstools/field/tools.py +++ b/src/gstools/field/tools.py @@ -11,7 +11,6 @@ generate_on_mesh """ -# pylint: disable=W0212, C0415 import meshio import numpy as np diff --git a/src/gstools/field/upscaling.py b/src/gstools/field/upscaling.py index 857bfc45..586596e1 100644 --- a/src/gstools/field/upscaling.py +++ b/src/gstools/field/upscaling.py @@ -12,7 +12,6 @@ var_no_scaling """ -# pylint: disable=W0613 import warnings import numpy as np diff --git a/src/gstools/krige/base.py b/src/gstools/krige/base.py index e14830fe..7763fb1d 100755 --- a/src/gstools/krige/base.py +++ b/src/gstools/krige/base.py @@ -9,7 +9,6 @@ Krige """ -# pylint: disable=C0103, W0221, E1102, R0201, C0412 import collections import numpy as np @@ -27,13 +26,12 @@ from gstools.tools.misc import eval_func from gstools.variogram import vario_estimate -if config._GSTOOLS_CORE_AVAIL: # pylint: disable=W0212; # pragma: no cover - # pylint: disable=E0401 +if config._GSTOOLS_CORE_AVAIL: # pragma: no cover from gstools_core import ( - calc_field_krige as calc_field_krige_gsc, # pylint: disable=E0606 + calc_field_krige as calc_field_krige_gsc, ) from gstools_core import ( - calc_field_krige_and_variance as calc_field_krige_and_variance_gsc, # pylint: disable=E0606 + calc_field_krige_and_variance as calc_field_krige_and_variance_gsc, ) __all__ = ["Krige"] @@ -47,13 +45,13 @@ def _calc_field_krige(krig_mat, krig_vecs, cond, num_threads=None): """A wrapper function for calling the krige algorithms.""" if ( config.USE_GSTOOLS_CORE - and config._GSTOOLS_CORE_AVAIL # pylint: disable=W0212 - ): # pylint: disable=W0212 - calc_field_krige_fct = ( # pylint: disable=W0201 - calc_field_krige_gsc # pylint: disable=E0606 + and config._GSTOOLS_CORE_AVAIL + ): + calc_field_krige_fct = ( + calc_field_krige_gsc ) else: - calc_field_krige_fct = calc_field_krige_c # pylint: disable=W0201 + calc_field_krige_fct = calc_field_krige_c return calc_field_krige_fct(krig_mat, krig_vecs, cond, num_threads) @@ -63,13 +61,13 @@ def _calc_field_krige_and_variance( """A wrapper function for calling the krige algorithms.""" if ( config.USE_GSTOOLS_CORE - and config._GSTOOLS_CORE_AVAIL # pylint: disable=W0212 + and config._GSTOOLS_CORE_AVAIL ): - calc_field_krige_and_variance_fct = ( # pylint: disable=W0201 - calc_field_krige_and_variance_gsc # pylint: disable=E0606 + calc_field_krige_and_variance_fct = ( + calc_field_krige_and_variance_gsc ) else: - calc_field_krige_and_variance_fct = ( # pylint: disable=W0201 + calc_field_krige_and_variance_fct = ( calc_field_krige_and_variance_c ) return calc_field_krige_and_variance_fct( diff --git a/src/gstools/krige/methods.py b/src/gstools/krige/methods.py index 19ffed56..e1cbffa9 100644 --- a/src/gstools/krige/methods.py +++ b/src/gstools/krige/methods.py @@ -13,7 +13,6 @@ Detrended """ -# pylint: disable=C0103 from gstools.krige.base import Krige __all__ = ["Simple", "Ordinary", "Universal", "ExtDrift", "Detrended"] diff --git a/src/gstools/krige/tools.py b/src/gstools/krige/tools.py index 62926595..e6d13f97 100644 --- a/src/gstools/krige/tools.py +++ b/src/gstools/krige/tools.py @@ -10,7 +10,6 @@ get_drift_functions """ -# pylint: disable=C0103 from itertools import combinations_with_replacement import numpy as np diff --git a/src/gstools/normalizer/base.py b/src/gstools/normalizer/base.py index 52c88053..2aedd4d9 100644 --- a/src/gstools/normalizer/base.py +++ b/src/gstools/normalizer/base.py @@ -9,7 +9,6 @@ Normalizer """ -# pylint: disable=R0201 import warnings import numpy as np diff --git a/src/gstools/normalizer/methods.py b/src/gstools/normalizer/methods.py index a46dc230..ded75eb7 100644 --- a/src/gstools/normalizer/methods.py +++ b/src/gstools/normalizer/methods.py @@ -14,7 +14,6 @@ Manly """ -# pylint: disable=E1101 import numpy as np from gstools.normalizer.base import Normalizer diff --git a/src/gstools/random/rng.py b/src/gstools/random/rng.py index ad07c6aa..db4baef9 100644 --- a/src/gstools/random/rng.py +++ b/src/gstools/random/rng.py @@ -9,7 +9,6 @@ RNG """ -# pylint: disable=E1101 import emcee as mc import numpy as np import numpy.random as rand diff --git a/src/gstools/tools/export.py b/src/gstools/tools/export.py index 38254ceb..9965a244 100644 --- a/src/gstools/tools/export.py +++ b/src/gstools/tools/export.py @@ -14,7 +14,6 @@ to_vtk_unstructured """ -# pylint: disable=C0103, E1101 import numpy as np from pyevtk.hl import gridToVTK, pointsToVTK diff --git a/src/gstools/tools/geometric.py b/src/gstools/tools/geometric.py index 55408965..5ba80127 100644 --- a/src/gstools/tools/geometric.py +++ b/src/gstools/tools/geometric.py @@ -30,7 +30,6 @@ great_circle_to_chordal """ -# pylint: disable=C0103 import numpy as np __all__ = [ diff --git a/src/gstools/tools/misc.py b/src/gstools/tools/misc.py index aaba1501..3fe44678 100755 --- a/src/gstools/tools/misc.py +++ b/src/gstools/tools/misc.py @@ -11,7 +11,6 @@ eval_func """ -# pylint: disable=C0103, C0415 import numpy as np from gstools.tools.geometric import format_struct_pos_dim, generate_grid diff --git a/src/gstools/tools/special.py b/src/gstools/tools/special.py index 1457b736..5e6374ac 100644 --- a/src/gstools/tools/special.py +++ b/src/gstools/tools/special.py @@ -15,7 +15,6 @@ tpl_gau_spec_dens """ -# pylint: disable=C0103, E1101 import numpy as np from scipy import special as sps diff --git a/src/gstools/transform/array.py b/src/gstools/transform/array.py index 87564edf..16fd07f7 100644 --- a/src/gstools/transform/array.py +++ b/src/gstools/transform/array.py @@ -19,7 +19,6 @@ array_to_uquad """ -# pylint: disable=C0103, C0123, R0911 from warnings import warn import numpy as np diff --git a/src/gstools/transform/field.py b/src/gstools/transform/field.py index a123e798..52bf8a55 100644 --- a/src/gstools/transform/field.py +++ b/src/gstools/transform/field.py @@ -27,7 +27,6 @@ normal_to_uquad """ -# pylint: disable=C0103, C0123, R0911, R1735 import numpy as np from gstools.normalizer import ( diff --git a/src/gstools/variogram/variogram.py b/src/gstools/variogram/variogram.py index 96a5597a..2f62fc15 100644 --- a/src/gstools/variogram/variogram.py +++ b/src/gstools/variogram/variogram.py @@ -10,7 +10,6 @@ vario_estimate_axis """ -# pylint: disable=C0412 import numpy as np from gstools_cython.variogram import directional as directional_c from gstools_cython.variogram import ma_structured as ma_structured_c @@ -28,8 +27,7 @@ ) from gstools.variogram.binning import standard_bins -if config._GSTOOLS_CORE_AVAIL: # pylint: disable=W0212; # pragma: no cover - # pylint: disable=E0401 +if config._GSTOOLS_CORE_AVAIL: # pragma: no cover from gstools_core import variogram_directional as directional_gsc from gstools_core import variogram_ma_structured as ma_structured_gsc from gstools_core import variogram_structured as structured_gsc @@ -61,9 +59,9 @@ def _directional( """A wrapper function for calling the directional variogram algorithms.""" if ( config.USE_GSTOOLS_CORE - and config._GSTOOLS_CORE_AVAIL # pylint: disable=W0212 - ): # pylint: disable=W0212 - directional_fct = directional_gsc # pylint: disable=E0606 + and config._GSTOOLS_CORE_AVAIL + ): + directional_fct = directional_gsc else: directional_fct = directional_c return directional_fct( @@ -90,9 +88,9 @@ def _unstructured( """A wrapper function for calling the unstructured variogram algorithms.""" if ( config.USE_GSTOOLS_CORE - and config._GSTOOLS_CORE_AVAIL # pylint: disable=W0212 - ): # pylint: disable=W0212 - unstructured_fct = unstructured_gsc # pylint: disable=E0606 + and config._GSTOOLS_CORE_AVAIL + ): + unstructured_fct = unstructured_gsc else: unstructured_fct = unstructured_c return unstructured_fct( @@ -113,9 +111,9 @@ def _structured( """A wrapper function for calling the structured variogram algorithms.""" if ( config.USE_GSTOOLS_CORE - and config._GSTOOLS_CORE_AVAIL # pylint: disable=W0212 - ): # pylint: disable=W0212 - structured_fct = structured_gsc # pylint: disable=E0606 + and config._GSTOOLS_CORE_AVAIL + ): + structured_fct = structured_gsc else: structured_fct = structured_c return structured_fct(field, estimator_type, num_threads) @@ -130,9 +128,9 @@ def _ma_structured( """A wrapper function for calling the masked struct. variogram algorithms.""" if ( config.USE_GSTOOLS_CORE - and config._GSTOOLS_CORE_AVAIL # pylint: disable=W0212 - ): # pylint: disable=W0212 - ma_structured_fct = ma_structured_gsc # pylint: disable=E0606 + and config._GSTOOLS_CORE_AVAIL + ): + ma_structured_fct = ma_structured_gsc else: ma_structured_fct = ma_structured_c return ma_structured_fct(field, mask, estimator_type, num_threads) From ca1fc490e612387878b385ff1aedc44d29a81690 Mon Sep 17 00:00:00 2001 From: LSchueler Date: Wed, 9 Jul 2025 22:16:05 +0200 Subject: [PATCH 05/15] Replace pylint with rust in project --- .github/workflows/main.yml | 4 ++-- pyproject.toml | 31 +------------------------------ 2 files changed, 3 insertions(+), 32 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 2365ccd0..51fcebf8 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -45,9 +45,9 @@ jobs: run: | python -m isort --check --diff --color . - - name: pylint check + - name: ruff check run: | - python -m pylint src/gstools/ + python -m ruff check src/gstools/ - name: coveralls check run: | diff --git a/pyproject.toml b/pyproject.toml index c91da2e4..6f9e34e7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -74,7 +74,7 @@ rust = ["gstools_core>=1.1.0"] test = ["pytest-cov>=3"] lint = [ "black>=24", - "pylint", + "ruff", "isort[colors]", ] @@ -139,32 +139,3 @@ target-version = [ "def __repr__", "def __str__", ] - -[tool.pylint] - [tool.pylint.main] - extension-pkg-whitelist = [ - "numpy", - "scipy", - "gstools_core", - ] - ignore = "_version.py" - load-plugins = [ - "pylint.extensions.no_self_use", - ] - - [tool.pylint.message_control] - disable = [ - "R0801", - ] - - [tool.pylint.reports] - output-format = "colorized" - - [tool.pylint.design] - max-args = 20 - max-locals = 50 - max-branches = 30 - max-statements = 85 - max-attributes = 30 - max-public-methods = 80 - max-positional-arguments=20 From 58a0cc368783d4ed98e17377bcd3e035f38ec5bd Mon Sep 17 00:00:00 2001 From: LSchueler Date: Wed, 9 Jul 2025 22:17:36 +0200 Subject: [PATCH 06/15] Fix ruff checks --- src/gstools/__init__.py | 1 + src/gstools/config.py | 2 +- src/gstools/field/pgs.py | 2 +- src/gstools/transform/field.py | 2 +- 4 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/gstools/__init__.py b/src/gstools/__init__.py index c13f3e5a..4d12007c 100644 --- a/src/gstools/__init__.py +++ b/src/gstools/__init__.py @@ -236,6 +236,7 @@ "Krige", "SRF", "CondSRF", + "PGS", "rotated_main_axes", "generate_grid", "generate_st_grid", diff --git a/src/gstools/config.py b/src/gstools/config.py index f72456ae..3870ac1e 100644 --- a/src/gstools/config.py +++ b/src/gstools/config.py @@ -8,7 +8,7 @@ NUM_THREADS = None try: # pragma: no cover - import gstools_core + import gstools_core # noqa: F401 _GSTOOLS_CORE_AVAIL = True USE_GSTOOLS_CORE = True diff --git a/src/gstools/field/pgs.py b/src/gstools/field/pgs.py index fde734ce..40fcef7a 100644 --- a/src/gstools/field/pgs.py +++ b/src/gstools/field/pgs.py @@ -128,7 +128,7 @@ def calc_lithotype_axes(self, lithotypes_shape): # unstructured grid centroid = self._fields.mean(axis=1) for d in range(self._dim): - l = np.floor(self._fields[d].min()) - 1 + l = np.floor(self._fields[d].min()) - 1 # noqa: E741 h = np.ceil(self._fields[d].max()) + 1 m = (h + l) / 2.0 dist = max(np.abs(h - m), np.abs(l - m)) diff --git a/src/gstools/transform/field.py b/src/gstools/transform/field.py index 52bf8a55..659d1725 100644 --- a/src/gstools/transform/field.py +++ b/src/gstools/transform/field.py @@ -87,7 +87,7 @@ def _post_process(fld, data, keep_mean): def _check_for_default_normal(fld): - if not type(fld.normalizer) == Normalizer: + if type(fld.normalizer) is not Normalizer: raise ValueError( "transform: need a normal field but there is a normalizer defined" ) From 4960bf131e5b5d0ce721e9b81ff4c3e31b98ca15 Mon Sep 17 00:00:00 2001 From: LSchueler Date: Wed, 9 Jul 2025 22:24:07 +0200 Subject: [PATCH 07/15] Black --- src/gstools/field/cond_srf.py | 1 - src/gstools/field/generator.py | 19 ++++--------------- src/gstools/field/srf.py | 1 - src/gstools/krige/base.py | 26 ++++++-------------------- src/gstools/variogram/variogram.py | 20 ++++---------------- 5 files changed, 14 insertions(+), 53 deletions(-) diff --git a/src/gstools/field/cond_srf.py b/src/gstools/field/cond_srf.py index e74ded2b..aad26dba 100644 --- a/src/gstools/field/cond_srf.py +++ b/src/gstools/field/cond_srf.py @@ -9,7 +9,6 @@ CondSRF """ - import numpy as np from gstools.field.base import Field diff --git a/src/gstools/field/generator.py b/src/gstools/field/generator.py index 096e880c..d65cc3cd 100755 --- a/src/gstools/field/generator.py +++ b/src/gstools/field/generator.py @@ -41,10 +41,7 @@ def _summate(cov_samples, z_1, z_2, pos, num_threads=None): """A wrapper function for calling the randomization algorithms.""" - if ( - config.USE_GSTOOLS_CORE - and config._GSTOOLS_CORE_AVAIL - ): + if config.USE_GSTOOLS_CORE and config._GSTOOLS_CORE_AVAIL: summate_fct = summate_gsc else: summate_fct = summate_c @@ -60,10 +57,7 @@ def _summate_incompr( ): """A wrapper function for calling the incompr. randomization algorithms.""" - if ( - config.USE_GSTOOLS_CORE - and config._GSTOOLS_CORE_AVAIL - ): + if config.USE_GSTOOLS_CORE and config._GSTOOLS_CORE_AVAIL: summate_incompr_fct = summate_incompr_gsc else: summate_incompr_fct = summate_incompr_c @@ -72,10 +66,7 @@ def _summate_incompr( def _summate_fourier(spectrum_factor, modes, z_1, z_2, pos, num_threads=None): """A wrapper function for calling the Fourier algorithms.""" - if ( - config.USE_GSTOOLS_CORE - and config._GSTOOLS_CORE_AVAIL - ): + if config.USE_GSTOOLS_CORE and config._GSTOOLS_CORE_AVAIL: summate_fourier_fct = summate_fourier_gsc else: summate_fourier_fct = summate_fourier_c @@ -828,9 +819,7 @@ def reset_seed(self, seed=np.nan): self._model.spectrum(k_norm) * np.prod(self._delta_k) ) - def _fill_to_dim( - self, values, dim, dtype=float, default_value=None - ): + def _fill_to_dim(self, values, dim, dtype=float, default_value=None): """Fill an array with last element up to len(dim).""" r = np.atleast_1d(values) if values is None: diff --git a/src/gstools/field/srf.py b/src/gstools/field/srf.py index a43591de..0646251d 100755 --- a/src/gstools/field/srf.py +++ b/src/gstools/field/srf.py @@ -9,7 +9,6 @@ SRF """ - import numpy as np from gstools.field.base import Field diff --git a/src/gstools/krige/base.py b/src/gstools/krige/base.py index 7763fb1d..a1887434 100755 --- a/src/gstools/krige/base.py +++ b/src/gstools/krige/base.py @@ -27,9 +27,7 @@ from gstools.variogram import vario_estimate if config._GSTOOLS_CORE_AVAIL: # pragma: no cover - from gstools_core import ( - calc_field_krige as calc_field_krige_gsc, - ) + from gstools_core import calc_field_krige as calc_field_krige_gsc from gstools_core import ( calc_field_krige_and_variance as calc_field_krige_and_variance_gsc, ) @@ -43,13 +41,8 @@ def _calc_field_krige(krig_mat, krig_vecs, cond, num_threads=None): """A wrapper function for calling the krige algorithms.""" - if ( - config.USE_GSTOOLS_CORE - and config._GSTOOLS_CORE_AVAIL - ): - calc_field_krige_fct = ( - calc_field_krige_gsc - ) + if config.USE_GSTOOLS_CORE and config._GSTOOLS_CORE_AVAIL: + calc_field_krige_fct = calc_field_krige_gsc else: calc_field_krige_fct = calc_field_krige_c return calc_field_krige_fct(krig_mat, krig_vecs, cond, num_threads) @@ -59,17 +52,10 @@ def _calc_field_krige_and_variance( krig_mat, krig_vecs, cond, num_threads=None ): """A wrapper function for calling the krige algorithms.""" - if ( - config.USE_GSTOOLS_CORE - and config._GSTOOLS_CORE_AVAIL - ): - calc_field_krige_and_variance_fct = ( - calc_field_krige_and_variance_gsc - ) + if config.USE_GSTOOLS_CORE and config._GSTOOLS_CORE_AVAIL: + calc_field_krige_and_variance_fct = calc_field_krige_and_variance_gsc else: - calc_field_krige_and_variance_fct = ( - calc_field_krige_and_variance_c - ) + calc_field_krige_and_variance_fct = calc_field_krige_and_variance_c return calc_field_krige_and_variance_fct( krig_mat, krig_vecs, cond, num_threads ) diff --git a/src/gstools/variogram/variogram.py b/src/gstools/variogram/variogram.py index 2f62fc15..4dc9983a 100644 --- a/src/gstools/variogram/variogram.py +++ b/src/gstools/variogram/variogram.py @@ -57,10 +57,7 @@ def _directional( num_threads=None, ): """A wrapper function for calling the directional variogram algorithms.""" - if ( - config.USE_GSTOOLS_CORE - and config._GSTOOLS_CORE_AVAIL - ): + if config.USE_GSTOOLS_CORE and config._GSTOOLS_CORE_AVAIL: directional_fct = directional_gsc else: directional_fct = directional_c @@ -86,10 +83,7 @@ def _unstructured( num_threads=None, ): """A wrapper function for calling the unstructured variogram algorithms.""" - if ( - config.USE_GSTOOLS_CORE - and config._GSTOOLS_CORE_AVAIL - ): + if config.USE_GSTOOLS_CORE and config._GSTOOLS_CORE_AVAIL: unstructured_fct = unstructured_gsc else: unstructured_fct = unstructured_c @@ -109,10 +103,7 @@ def _structured( num_threads=None, ): """A wrapper function for calling the structured variogram algorithms.""" - if ( - config.USE_GSTOOLS_CORE - and config._GSTOOLS_CORE_AVAIL - ): + if config.USE_GSTOOLS_CORE and config._GSTOOLS_CORE_AVAIL: structured_fct = structured_gsc else: structured_fct = structured_c @@ -126,10 +117,7 @@ def _ma_structured( num_threads=None, ): """A wrapper function for calling the masked struct. variogram algorithms.""" - if ( - config.USE_GSTOOLS_CORE - and config._GSTOOLS_CORE_AVAIL - ): + if config.USE_GSTOOLS_CORE and config._GSTOOLS_CORE_AVAIL: ma_structured_fct = ma_structured_gsc else: ma_structured_fct = ma_structured_c From 03842325bff948457b81084e692cc6ea1631210e Mon Sep 17 00:00:00 2001 From: LSchueler Date: Sat, 19 Jul 2025 00:07:17 +0200 Subject: [PATCH 08/15] Replace black and isort with ruff --- .github/workflows/main.yml | 14 +++++--------- pyproject.toml | 22 +++------------------- 2 files changed, 8 insertions(+), 28 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 51fcebf8..83f05c6b 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -33,19 +33,15 @@ jobs: pip install -v --editable '.[lint,test]' pip install "coveralls>=3.0.0" - - name: black check + - name: ruff linter run: | - python -m black --check --diff --color . - - - name: black preview - run: | - python -m black --preview --diff --color . + python -m ruff check src/gstools/ - - name: isort check + - name: ruff import check run: | - python -m isort --check --diff --color . + python -m ruff check --select I --diff src/gstools/ - - name: ruff check + - name: ruff format check run: | python -m ruff check src/gstools/ diff --git a/pyproject.toml b/pyproject.toml index 6f9e34e7..27b2c53b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -72,11 +72,7 @@ plotting = [ ] rust = ["gstools_core>=1.1.0"] test = ["pytest-cov>=3"] -lint = [ - "black>=24", - "ruff", - "isort[colors]", -] +lint = ["ruff"] [project.urls] Changelog = "https://github.com/GeoStat-Framework/GSTools/blob/main/CHANGELOG.md" @@ -106,21 +102,9 @@ include = [ [tool.hatch.build.targets.wheel] packages = ["src/gstools"] -[tool.isort] -profile = "black" -multi_line_output = 3 -line_length = 79 - -[tool.black] +[tool.ruff] line-length = 79 -target-version = [ - "py38", - "py39", - "py310", - "py311", - "py312", - "py313", -] +target-version = "py38" [tool.coverage] [tool.coverage.run] From c970c2799ce264dae9beb108091fac2f3ef1624a Mon Sep 17 00:00:00 2001 From: LSchueler Date: Sat, 19 Jul 2025 00:13:08 +0200 Subject: [PATCH 09/15] Test ruff for sorting imports --- src/gstools/variogram/variogram.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gstools/variogram/variogram.py b/src/gstools/variogram/variogram.py index 4dc9983a..72b40ab3 100644 --- a/src/gstools/variogram/variogram.py +++ b/src/gstools/variogram/variogram.py @@ -10,8 +10,8 @@ vario_estimate_axis """ -import numpy as np from gstools_cython.variogram import directional as directional_c +import numpy as np from gstools_cython.variogram import ma_structured as ma_structured_c from gstools_cython.variogram import structured as structured_c from gstools_cython.variogram import unstructured as unstructured_c From 1ce7b75936803aac7f3054ef785a6a14163a3db8 Mon Sep 17 00:00:00 2001 From: LSchueler Date: Sat, 19 Jul 2025 00:14:50 +0200 Subject: [PATCH 10/15] Test ruff linter --- src/gstools/variogram/variogram.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/gstools/variogram/variogram.py b/src/gstools/variogram/variogram.py index 72b40ab3..bb90fe2f 100644 --- a/src/gstools/variogram/variogram.py +++ b/src/gstools/variogram/variogram.py @@ -10,8 +10,8 @@ vario_estimate_axis """ -from gstools_cython.variogram import directional as directional_c import numpy as np +from gstools_cython.variogram import directional as directional_c from gstools_cython.variogram import ma_structured as ma_structured_c from gstools_cython.variogram import structured as structured_c from gstools_cython.variogram import unstructured as unstructured_c @@ -60,6 +60,7 @@ def _directional( if config.USE_GSTOOLS_CORE and config._GSTOOLS_CORE_AVAIL: directional_fct = directional_gsc else: + a = 5 directional_fct = directional_c return directional_fct( field, From c874723e09d858077c8166e6196957994bb00379 Mon Sep 17 00:00:00 2001 From: LSchueler Date: Sat, 19 Jul 2025 00:16:04 +0200 Subject: [PATCH 11/15] Test ruff formatter --- src/gstools/variogram/variogram.py | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/src/gstools/variogram/variogram.py b/src/gstools/variogram/variogram.py index bb90fe2f..10c908e1 100644 --- a/src/gstools/variogram/variogram.py +++ b/src/gstools/variogram/variogram.py @@ -60,18 +60,8 @@ def _directional( if config.USE_GSTOOLS_CORE and config._GSTOOLS_CORE_AVAIL: directional_fct = directional_gsc else: - a = 5 directional_fct = directional_c - return directional_fct( - field, - bin_edges, - pos, - direction, - angles_tol, - bandwidth, - separate_dirs, - estimator_type, - num_threads, + return directional_fct( field, bin_edges, pos, direction, angles_tol, bandwidth, separate_dirs, estimator_type, num_threads, ) From 5a063c96b3fd541f24df4f1372fdfd339cc13d72 Mon Sep 17 00:00:00 2001 From: LSchueler Date: Sat, 19 Jul 2025 00:19:07 +0200 Subject: [PATCH 12/15] Call correct ruff command --- .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 83f05c6b..1ccb9fc9 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -43,7 +43,7 @@ jobs: - name: ruff format check run: | - python -m ruff check src/gstools/ + python -m ruff format --diff src/gstools/ - name: coveralls check run: | From 5b46303caef45f92ed63d991c0107593d9f0198f Mon Sep 17 00:00:00 2001 From: LSchueler Date: Sat, 19 Jul 2025 00:23:06 +0200 Subject: [PATCH 13/15] Fix formatting --- src/gstools/field/upscaling.py | 6 +++--- src/gstools/variogram/variogram.py | 11 ++++++++++- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/src/gstools/field/upscaling.py b/src/gstools/field/upscaling.py index 586596e1..1cb24c46 100644 --- a/src/gstools/field/upscaling.py +++ b/src/gstools/field/upscaling.py @@ -74,9 +74,9 @@ def var_coarse_graining(model, point_volumes=0.0): ) # interpret volume as a hypercube and calculate the edge length edge = point_volumes ** (1.0 / model.dim) - var_factor = ( - model.len_scale**2 / (model.len_scale**2 + edge**2 / 4) - ) ** (model.dim / 2.0) + var_factor = (model.len_scale**2 / (model.len_scale**2 + edge**2 / 4)) ** ( + model.dim / 2.0 + ) return model.sill * var_factor diff --git a/src/gstools/variogram/variogram.py b/src/gstools/variogram/variogram.py index 10c908e1..4dc9983a 100644 --- a/src/gstools/variogram/variogram.py +++ b/src/gstools/variogram/variogram.py @@ -61,7 +61,16 @@ def _directional( directional_fct = directional_gsc else: directional_fct = directional_c - return directional_fct( field, bin_edges, pos, direction, angles_tol, bandwidth, separate_dirs, estimator_type, num_threads, + return directional_fct( + field, + bin_edges, + pos, + direction, + angles_tol, + bandwidth, + separate_dirs, + estimator_type, + num_threads, ) From a3e9a45e20c3945c047fa25dff7d4d005024d99d Mon Sep 17 00:00:00 2001 From: LSchueler Date: Sun, 20 Jul 2025 21:57:52 +0200 Subject: [PATCH 14/15] Update linting and formatting instructions --- CONTRIBUTING.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index dd797f0a..dbe9e88e 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -29,8 +29,10 @@ with your idea or suggestion and we'd love to discuss about it. - Fork the repo on [GitHub](https://github.com/GeoStat-Framework/GSTools) - Add yourself to AUTHORS.md (if you want to). -- We use [black](https://github.com/psf/black) and [isort](https://github.com/PyCQA/isort) to format our code. - Please use the scripts `black .` and `isort .` after you have written your code. +- We use [Ruff](https://github.com/psf/black) to check and format the code. + Please use the scripts `ruff check src/gstools`, + `ruff check --select I --fix src/gstools/`, and + `ruff format --diff src/gstools/` after you have written your code. - Add some tests if possible. - Add an example showing your new feature in one of the examples sub-folders if possible. Follow this [Sphinx-Gallary guide](https://sphinx-gallery.github.io/stable/syntax.html#embed-rst-in-your-example-python-files). From 9566589810ea78f31a86c043b49ba0ce60bbd4d5 Mon Sep 17 00:00:00 2001 From: LSchueler Date: Sun, 20 Jul 2025 21:58:45 +0200 Subject: [PATCH 15/15] Update changelog --- CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index e9662a94..ba071314 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,12 @@ All notable changes to **GSTools** will be documented in this file. +## [Unreleased] - ? + +### Changes + +- replace pylint, black, and isort with ruff [#391](https://github.com/GeoStat-Framework/GSTools/pull/391) + ## [1.7.0] - Morphic Mint - 2025-04 ### Enhancements