Skip to content

Commit a7e58a2

Browse files
committed
pylint: fixes
1 parent c9a129b commit a7e58a2

5 files changed

Lines changed: 66 additions & 67 deletions

File tree

src/anaflow/flow/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,6 @@
7474
__all__ = [
7575
"thiem",
7676
"theis",
77-
"grf_model",
7877
"ext_thiem_2d",
7978
"ext_thiem_3d",
8079
"ext_thiem_tpl",

src/anaflow/flow/ext_grf_model.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -175,13 +175,13 @@ def ext_grf_steady(
175175
kwargs.update(arg_dict)
176176
Input = Shaper(rad=rad)
177177
q_fac = rate / (sph_surf(dim) * lat_ext ** (3.0 - dim)) # pumping factor
178-
if not r_ref > 0.0:
178+
if r_ref <= 0.0:
179179
raise ValueError("The reference radius needs to be positive.")
180-
if not Input.rad_min > 0.0:
180+
if Input.rad_min <= 0.0:
181181
raise ValueError("The given radii need to be positive.")
182-
if not dim > 0.0 or dim > 3.0:
182+
if dim <= 0.0 or dim > 3.0:
183183
raise ValueError("The dimension needs to be positiv and <= 3.")
184-
if not lat_ext > 0.0:
184+
if lat_ext <= 0.0:
185185
raise ValueError("The lateral extend needs to be positiv.")
186186

187187
if callable(conductivity):
@@ -195,7 +195,7 @@ def integrand(val):
195195
res[ri] = integ(integrand, re, r_ref)[0]
196196
else:
197197
con = float(conductivity)
198-
if not con > 0:
198+
if con <= 0:
199199
raise ValueError("The Conductivity needs to be positive.")
200200
if np.isclose(dim, 2):
201201
res = np.log(r_ref / Input.rad) / con

src/anaflow/flow/heterogeneous.py

Lines changed: 50 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
neuman2004
1818
neuman2004_steady
1919
"""
20-
# pylint: disable=C0103
20+
# pylint: disable=C0103,C0302
2121
import functools as ft
2222

2323
import numpy as np
@@ -239,27 +239,27 @@ def ext_thiem_3d(
239239
"""
240240
rad = np.array(rad, dtype=float)
241241
# check the input
242-
if not r_ref > 0.0:
242+
if r_ref <= 0.0:
243243
raise ValueError("The reference radius needs to be positive.")
244-
if not np.min(rad) > 0.0:
244+
if np.min(rad) <= 0.0:
245245
raise ValueError("The given radii need to be positive.")
246246
if K_well != "KA" and K_well != "KH" and not isinstance(K_well, float):
247247
raise ValueError(
248248
"The well-conductivity should be given as float or 'KA' resp 'KH'"
249249
)
250250
if isinstance(K_well, float) and K_well <= 0.0:
251251
raise ValueError("The well-conductivity needs to be positive.")
252-
if not cond_gmean > 0.0:
252+
if cond_gmean <= 0.0:
253253
raise ValueError("The gmean conductivity needs to be positive.")
254254
if var < 0.0:
255255
raise ValueError("The variance needs to be positive.")
256-
if not len_scale > 0.0:
256+
if len_scale <= 0.0:
257257
raise ValueError("The correlationlength needs to be positive.")
258-
if not lat_ext > 0.0:
258+
if lat_ext <= 0.0:
259259
raise ValueError("The aquifer-thickness needs to be positive.")
260260
if not 0.0 < anis <= 1.0:
261261
raise ValueError("The anisotropy-ratio must be > 0 and <= 1")
262-
if not prop > 0.0:
262+
if prop <= 0.0:
263263
raise ValueError("The proportionalityfactor needs to be positive.")
264264

265265
# define some substitions to shorten the result
@@ -390,19 +390,19 @@ def ext_theis_2d(
390390
# check the input
391391
if r_well < 0.0:
392392
raise ValueError("The wellradius needs to be >= 0")
393-
if not r_bound > r_well:
393+
if r_bound <= r_well:
394394
raise ValueError("The upper boundary needs to be > well radius")
395-
if not storage > 0.0:
395+
if storage <= 0.0:
396396
raise ValueError("The Storage needs to be positive.")
397-
if not trans_gmean > 0.0:
397+
if trans_gmean <= 0.0:
398398
raise ValueError("The Transmissivity needs to be positive.")
399399
if var < 0.0:
400400
raise ValueError("The variance needs to be positive.")
401-
if not len_scale > 0.0:
401+
if len_scale <= 0.0:
402402
raise ValueError("The correlationlength needs to be positive.")
403-
if T_well is not None and not T_well > 0.0:
403+
if T_well is not None and T_well <= 0.0:
404404
raise ValueError("The well Transmissivity needs to be positive.")
405-
if not prop > 0.0:
405+
if prop <= 0.0:
406406
raise ValueError("The proportionality factor needs to be positive.")
407407
if parts <= 1:
408408
raise ValueError("The numbor of partitions needs to be at least 2")
@@ -546,25 +546,25 @@ def ext_theis_3d(
546546
# check the input
547547
if r_well < 0.0:
548548
raise ValueError("The wellradius needs to be >= 0")
549-
if not r_bound > r_well:
549+
if r_bound <= r_well:
550550
raise ValueError("The upper boundary needs to be > well radius")
551-
if not storage > 0.0:
551+
if storage <= 0.0:
552552
raise ValueError("The storage needs to be positive.")
553-
if not cond_gmean > 0.0:
553+
if cond_gmean <= 0.0:
554554
raise ValueError("The gmean conductivity needs to be positive.")
555555
if var < 0.0:
556556
raise ValueError("The variance needs to be positive.")
557-
if not len_scale > 0.0:
557+
if len_scale <= 0.0:
558558
raise ValueError("The correlationlength needs to be positive.")
559559
if K_well != "KA" and K_well != "KH" and not isinstance(K_well, float):
560560
raise ValueError(
561561
"The well-conductivity should be given as float or 'KA' resp 'KH'"
562562
)
563-
if isinstance(K_well, float) and not K_well > 0.0:
563+
if isinstance(K_well, float) and K_well <= 0.0:
564564
raise ValueError("The well-conductivity needs to be positive.")
565-
if not cond_gmean > 0.0:
565+
if cond_gmean <= 0.0:
566566
raise ValueError("The conductivity needs to be positive.")
567-
if not prop > 0.0:
567+
if prop <= 0.0:
568568
raise ValueError("The proportionality factor needs to be positive.")
569569
if parts <= 1:
570570
raise ValueError("The numbor of partitions needs to be at least 2")
@@ -728,27 +728,27 @@ def ext_theis_tpl(
728728
# check the input
729729
if r_well < 0.0:
730730
raise ValueError("The wellradius needs to be >= 0")
731-
if not r_bound > r_well:
731+
if r_bound <= r_well:
732732
raise ValueError("The upper boundary needs to be > well radius")
733-
if not storage > 0.0:
733+
if storage <= 0.0:
734734
raise ValueError("The storage needs to be positive.")
735-
if not cond_gmean > 0.0:
735+
if cond_gmean <= 0.0:
736736
raise ValueError("The gmean conductivity needs to be positive.")
737-
if not len_scale > 0.0:
737+
if len_scale <= 0.0:
738738
raise ValueError("The correlationlength needs to be positive.")
739739
if not 0 < hurst < 1:
740740
raise ValueError("Hurst coefficient needs to be in (0,1)")
741741
if var is not None and var < 0.0:
742742
raise ValueError("The variance needs to be positive.")
743-
if var is None and not c > 0.0:
743+
if var is None and c <= 0.0:
744744
raise ValueError("The intensity of variation needs to be positive.")
745745
if K_well != "KA" and K_well != "KH" and not isinstance(K_well, float):
746746
raise ValueError(
747747
"The well-conductivity should be given as float or 'KA' resp 'KH'"
748748
)
749-
if isinstance(K_well, float) and not K_well > 0.0:
749+
if isinstance(K_well, float) and K_well <= 0.0:
750750
raise ValueError("The well-conductivity needs to be positive.")
751-
if not prop > 0.0:
751+
if prop <= 0.0:
752752
raise ValueError("The proportionality factor needs to be positive.")
753753
if parts <= 1:
754754
raise ValueError("The numbor of partitions needs to be at least 2")
@@ -907,27 +907,27 @@ def ext_theis_tpl_3d(
907907
# check the input
908908
if r_well < 0.0:
909909
raise ValueError("The wellradius needs to be >= 0")
910-
if not r_bound > r_well:
910+
if r_bound <= r_well:
911911
raise ValueError("The upper boundary needs to be > well radius")
912-
if not storage > 0.0:
912+
if storage <= 0.0:
913913
raise ValueError("The storage needs to be positive.")
914-
if not cond_gmean > 0.0:
914+
if cond_gmean <= 0.0:
915915
raise ValueError("The gmean conductivity needs to be positive.")
916-
if not len_scale > 0.0:
916+
if len_scale <= 0.0:
917917
raise ValueError("The correlationlength needs to be positive.")
918918
if not 0 < hurst < 1:
919919
raise ValueError("Hurst coefficient needs to be in (0,1)")
920920
if var is not None and var < 0.0:
921921
raise ValueError("The variance needs to be positive.")
922-
if var is None and not c > 0.0:
922+
if var is None and c <= 0.0:
923923
raise ValueError("The intensity of variation needs to be positive.")
924924
if K_well != "KA" and K_well != "KH" and not isinstance(K_well, float):
925925
raise ValueError(
926926
"The well-conductivity should be given as float or 'KA' resp 'KH'"
927927
)
928-
if isinstance(K_well, float) and not K_well > 0.0:
928+
if isinstance(K_well, float) and K_well <= 0.0:
929929
raise ValueError("The well-conductivity needs to be positive.")
930-
if not prop > 0.0:
930+
if prop <= 0.0:
931931
raise ValueError("The proportionality factor needs to be positive.")
932932
if parts <= 1:
933933
raise ValueError("The numbor of partitions needs to be at least 2")
@@ -1059,23 +1059,23 @@ def ext_thiem_tpl(
10591059
``r = sqrt(x**2 + y**2)``
10601060
"""
10611061
# check the input
1062-
if not cond_gmean > 0.0:
1062+
if cond_gmean <= 0.0:
10631063
raise ValueError("The gmean conductivity needs to be positive.")
1064-
if not len_scale > 0.0:
1064+
if len_scale <= 0.0:
10651065
raise ValueError("The correlationlength needs to be positive.")
10661066
if not 0 < hurst < 1:
10671067
raise ValueError("Hurst coefficient needs to be in (0,1)")
10681068
if var is not None and var < 0.0:
10691069
raise ValueError("The variance needs to be positive.")
1070-
if var is None and not c > 0.0:
1070+
if var is None and c <= 0.0:
10711071
raise ValueError("The intensity of variation needs to be positive.")
10721072
if K_well != "KA" and K_well != "KH" and not isinstance(K_well, float):
10731073
raise ValueError(
10741074
"The well-conductivity should be given as float or 'KA' resp 'KH'"
10751075
)
1076-
if isinstance(K_well, float) and not K_well > 0.0:
1076+
if isinstance(K_well, float) and K_well <= 0.0:
10771077
raise ValueError("The well-conductivity needs to be positive.")
1078-
if not prop > 0.0:
1078+
if prop <= 0.0:
10791079
raise ValueError("The proportionality factor needs to be positive.")
10801080
cond = ft.partial(
10811081
TPL_CG,
@@ -1199,23 +1199,23 @@ def ext_thiem_tpl_3d(
11991199
``r = sqrt(x**2 + y**2)``
12001200
"""
12011201
# check the input
1202-
if not cond_gmean > 0.0:
1202+
if cond_gmean <= 0.0:
12031203
raise ValueError("The gmean conductivity needs to be positive.")
1204-
if not len_scale > 0.0:
1204+
if len_scale <= 0.0:
12051205
raise ValueError("The correlationlength needs to be positive.")
12061206
if not 0 < hurst < 1:
12071207
raise ValueError("Hurst coefficient needs to be in (0,1)")
12081208
if var is not None and var < 0.0:
12091209
raise ValueError("The variance needs to be positive.")
1210-
if var is None and not c > 0.0:
1210+
if var is None and c <= 0.0:
12111211
raise ValueError("The intensity of variation needs to be positive.")
12121212
if K_well != "KA" and K_well != "KH" and not isinstance(K_well, float):
12131213
raise ValueError(
12141214
"The well-conductivity should be given as float or 'KA' resp 'KH'"
12151215
)
1216-
if isinstance(K_well, float) and not K_well > 0.0:
1216+
if isinstance(K_well, float) and K_well <= 0.0:
12171217
raise ValueError("The well-conductivity needs to be positive.")
1218-
if not prop > 0.0:
1218+
if prop <= 0.0:
12191219
raise ValueError("The proportionality factor needs to be positive.")
12201220
cond = ft.partial(
12211221
TPL_CG,
@@ -1320,15 +1320,15 @@ def neuman2004(
13201320
# check the input
13211321
if r_well < 0.0:
13221322
raise ValueError("The wellradius needs to be >= 0")
1323-
if not r_bound > r_well:
1323+
if r_bound <= r_well:
13241324
raise ValueError("The upper boundary needs to be > well radius")
1325-
if not storage > 0.0:
1325+
if storage <= 0.0:
13261326
raise ValueError("The Storage needs to be positive.")
1327-
if not trans_gmean > 0.0:
1327+
if trans_gmean <= 0.0:
13281328
raise ValueError("The Transmissivity needs to be positive.")
13291329
if var < 0.0:
13301330
raise ValueError("The variance needs to be positive.")
1331-
if not len_scale > 0.0:
1331+
if len_scale <= 0.0:
13321332
raise ValueError("The correlationlength needs to be positive.")
13331333
if parts <= 1:
13341334
raise ValueError("The numbor of partitions needs to be at least 2")
@@ -1404,11 +1404,11 @@ def neuman2004_steady(
14041404
Water resources research 40.4, 2004
14051405
"""
14061406
# check the input
1407-
if not trans_gmean > 0.0:
1407+
if trans_gmean <= 0.0:
14081408
raise ValueError("The Transmissivity needs to be positive.")
14091409
if var < 0.0:
14101410
raise ValueError("The variance needs to be positive.")
1411-
if not len_scale > 0.0:
1411+
if len_scale <= 0.0:
14121412
raise ValueError("The correlationlength needs to be positive.")
14131413

14141414
return ext_grf_steady(

src/anaflow/flow/laplace.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
1111
grf_laplace
1212
"""
13-
# pylint: disable=C0103
13+
# pylint: disable=C0103,R0915
1414
import warnings
1515

1616
import numpy as np
@@ -152,19 +152,19 @@ def grf_laplace(
152152
raise ValueError("R_part, S_part and K_part need matching lengths.")
153153
if R_part[0] < 0.0:
154154
raise ValueError("The wellradius needs to be >= 0.")
155-
if not all([r1 < r2 for r1, r2 in zip(R_part[:-1], R_part[1:])]):
155+
if not all(r1 < r2 for r1, r2 in zip(R_part[:-1], R_part[1:])):
156156
raise ValueError("The radii values need to be sorted.")
157157
if not np.min(rad) > R_part[0] or np.max(rad) > R_part[-1]:
158158
raise ValueError("The given radii need to be in the given range.")
159-
if not all([con > 0 for con in K_part]):
159+
if not all(con > 0 for con in K_part):
160160
raise ValueError("The Conductivity needs to be positiv.")
161-
if not all([stor > 0 for stor in S_part]):
161+
if not all(stor > 0 for stor in S_part):
162162
raise ValueError("The Storage needs to be positiv.")
163-
if not dim > 0.0 or dim > 3.0:
163+
if dim <= 0.0 or dim > 3.0:
164164
raise ValueError("The dimension needs to be positiv and <= 3.")
165-
if not lat_ext > 0.0:
165+
if lat_ext <= 0.0:
166166
raise ValueError("The lateral extend needs to be positiv.")
167-
if not K_well > 0:
167+
if K_well <= 0:
168168
raise ValueError("The well conductivity needs to be positiv.")
169169

170170
# initialize the result

src/anaflow/tools/special.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
tpl_hyp
2121
neuman2004_trans
2222
"""
23-
23+
# pylint: disable=C0103,R0903
2424
import numpy as np
2525
from scipy.special import exp1, expn, gamma, gammaincc, hyp2f1
2626

@@ -39,7 +39,7 @@
3939
]
4040

4141

42-
class Shaper(object):
42+
class Shaper:
4343
"""
4444
A class to reshape radius-time input-output in a good way.
4545
@@ -84,7 +84,7 @@ def __init__(self, time=0, rad=0, struc_grid=True):
8484
np.ones_like(self.time[self.time_gz]), self.rad
8585
)
8686

87-
if not self.struc_grid and not self.rad_shape == self.time_shape:
87+
if not self.struc_grid and self.rad_shape != self.time_shape:
8888
raise ValueError("No struc_grid: shape of time & radius differ")
8989
if np.any(self.time < 0.0):
9090
raise ValueError("The given times need to be positive.")
@@ -183,7 +183,7 @@ def specialrange(val_min, val_max, steps, typ="exp"):
183183
)
184184
) ** typ
185185
else:
186-
print("specialrange: unknown typ '{}'. Using linear range".format(typ))
186+
print(f"specialrange: unknown typ '{typ}'. Using linear range")
187187
rng = np.linspace(val_min, val_max, steps)
188188

189189
return rng

0 commit comments

Comments
 (0)