Skip to content

Commit

Permalink
apply black+isort; add imports and docs
Browse files Browse the repository at this point in the history
  • Loading branch information
MuellerSeb committed Aug 1, 2024
1 parent 1155393 commit c27a1ba
Show file tree
Hide file tree
Showing 28 changed files with 107 additions and 158 deletions.
1 change: 1 addition & 0 deletions examples/01_call_theis.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
Reference: `Theis 1935 <https://doi.org/10.1029/TR016i002p00519>`__
"""

import numpy as np
from matplotlib import pyplot as plt

Expand Down
9 changes: 3 additions & 6 deletions examples/02_call_ext_theis2d.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
Reference: `Zech et. al. 2016 <http://dx.doi.org/10.1002/2015WR018509>`__
"""

import numpy as np
from matplotlib import pyplot as plt

Expand Down Expand Up @@ -51,12 +52,8 @@
label_TG = "Theis($T_G$)" if i == 0 else None
label_TH = "Theis($T_H$)" if i == 0 else None
label_ef = "extended Theis" if i == 0 else None
plt.plot(
rad, head_TG[i], label=label_TG, color="C" + str(i), linestyle="--"
)
plt.plot(
rad, head_TH[i], label=label_TH, color="C" + str(i), linestyle=":"
)
plt.plot(rad, head_TG[i], label=label_TG, color="C" + str(i), linestyle="--")
plt.plot(rad, head_TH[i], label=label_TH, color="C" + str(i), linestyle=":")
plt.plot(rad, head_ef[i], label=label_ef, color="C" + str(i))
time_ticks.append(head_ef[i][-1])

Expand Down
9 changes: 3 additions & 6 deletions examples/03_call_ext_theis3d.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
Reference: `Müller 2015 <http://dx.doi.org/10.13140/RG.2.2.34074.24002>`__
"""

import numpy as np
from matplotlib import pyplot as plt

Expand Down Expand Up @@ -59,12 +60,8 @@
label_TG = "Theis($K_{efu}$)" if i == 0 else None
label_TH = "Theis($K_H$)" if i == 0 else None
label_ef = "extended Theis 3D" if i == 0 else None
plt.plot(
rad, head_Kefu[i], label=label_TG, color="C" + str(i), linestyle="--"
)
plt.plot(
rad, head_KH[i], label=label_TH, color="C" + str(i), linestyle=":"
)
plt.plot(rad, head_Kefu[i], label=label_TG, color="C" + str(i), linestyle="--")
plt.plot(rad, head_KH[i], label=label_TH, color="C" + str(i), linestyle=":")
plt.plot(rad, head_ef[i], label=label_ef, color="C" + str(i))
time_ticks.append(head_ef[i][-1])

Expand Down
9 changes: 3 additions & 6 deletions examples/04_call_ext_theis_tpl.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
Reference: (not yet published)
"""

import numpy as np
from matplotlib import pyplot as plt

Expand Down Expand Up @@ -62,12 +63,8 @@
label_TG = "Theis($K_G$)" if i == 0 else None
label_TH = "Theis($K_H$)" if i == 0 else None
label_ef = "extended Theis TPL 2D" if i == 0 else None
plt.plot(
rad, head_KG[i], label=label_TG, color="C" + str(i), linestyle="--"
)
plt.plot(
rad, head_KH[i], label=label_TH, color="C" + str(i), linestyle=":"
)
plt.plot(rad, head_KG[i], label=label_TG, color="C" + str(i), linestyle="--")
plt.plot(rad, head_KH[i], label=label_TH, color="C" + str(i), linestyle=":")
plt.plot(rad, head_ef[i], label=label_ef, color="C" + str(i))
time_ticks.append(head_ef[i][-1])

Expand Down
9 changes: 3 additions & 6 deletions examples/05_call_neuman2004.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
Reference: `Neuman 2004 <https://doi.org/10.1029/2003WR002405>`__
"""

import numpy as np
from matplotlib import pyplot as plt

Expand Down Expand Up @@ -61,12 +62,8 @@
label_TG = "Theis($T_G$)" if i == 0 else None
label_TH = "Theis($T_H$)" if i == 0 else None
label_ef = "transient Neuman [2004]" if i == 0 else None
plt.plot(
rad, head_TG[i], label=label_TG, color="C" + str(i), linestyle="--"
)
plt.plot(
rad, head_TH[i], label=label_TH, color="C" + str(i), linestyle=":"
)
plt.plot(rad, head_TG[i], label=label_TG, color="C" + str(i), linestyle="--")
plt.plot(rad, head_TH[i], label=label_TH, color="C" + str(i), linestyle=":")
plt.plot(rad, head_ef[i], label=label_ef, color="C" + str(i))
time_ticks.append(head_ef[i][-1])

Expand Down
1 change: 1 addition & 0 deletions examples/06_compare_extthiem2d_grfsteady.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
- `Schneider & Attinger 2008 <https://doi.org/10.1029/2007WR005898>`__
- `Zech & Attinger 2016 <https://doi.org/10.5194/hess-20-1655-2016>`__
"""

import numpy as np
from matplotlib import pyplot as plt

Expand Down
1 change: 1 addition & 0 deletions examples/07_compare_extthiem3d_grfsteady.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
Reference: `Zech et. al. 2012 <https://doi.org/10.1029/2012WR011852>`__
"""

import numpy as np
from matplotlib import pyplot as plt

Expand Down
1 change: 1 addition & 0 deletions examples/08_compare_extthiem2d_neuman.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
- `Neuman 2004 <https://doi.org/10.1029/2003WR002405>`__
- `Zech & Attinger 2016 <https://doi.org/10.5194/hess-20-1655-2016>`__
"""

import numpy as np
from matplotlib import pyplot as plt

Expand Down
5 changes: 2 additions & 3 deletions examples/09_compare_exttheis2d_neuman.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
- `Neuman 2004 <https://doi.org/10.1029/2003WR002405>`__
- `Zech et. al. 2016 <http://dx.doi.org/10.1002/2015WR018509>`__
"""

import numpy as np
from matplotlib import pyplot as plt

Expand Down Expand Up @@ -40,9 +41,7 @@
plt.plot(rad, head2[i], label=label2, color="C" + str(i), linestyle="--")
time_ticks.append(head1[i][-1])

plt.title(
"$T_G={}$, $\sigma^2={}$, $\ell={}$, $S={}$".format(TG, var, len_scale, S)
)
plt.title("$T_G={}$, $\sigma^2={}$, $\ell={}$, $S={}$".format(TG, var, len_scale, S))
plt.xlabel("r in [m]")
plt.ylabel("h in [m]")
plt.legend()
Expand Down
5 changes: 2 additions & 3 deletions examples/10_convergence_ext_theis_tpl.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
Reference: (not yet published)
"""

import numpy as np
from matplotlib import pyplot as plt

Expand All @@ -25,9 +26,7 @@
S = 1e-4 # storativity
rate = -1e-4 # pumping rate

head1 = ext_thiem_tpl(
rad, r_ref, KG, len_scale, hurst, var, dim=dim, rate=rate
)
head1 = ext_thiem_tpl(rad, r_ref, KG, len_scale, hurst, var, dim=dim, rate=rate)
head2 = ext_theis_tpl(
time, rad, S, KG, len_scale, hurst, var, dim=dim, rate=rate, r_bound=r_ref
)
Expand Down
5 changes: 2 additions & 3 deletions examples/11_convergence_ext_grf.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
Reference: `Barker 1988 <https://doi.org/10.1029/WR024i010p01796>`__
"""

import numpy as np
from matplotlib import pyplot as plt

Expand All @@ -30,9 +31,7 @@

plt.plot(rad, head1, label="Ext GRF steady")
plt.plot(rad, head2, label="Ext GRF (t={})".format(time), linestyle="--")
plt.plot(
rad, head3, label="GRF quasi-steady (t={})".format(time), linestyle=":"
)
plt.plot(rad, head3, label="GRF quasi-steady (t={})".format(time), linestyle=":")

plt.xlabel("r in [m]")
plt.ylabel("h in [m]")
Expand Down
9 changes: 3 additions & 6 deletions examples/12_compare_theis_quasi_steady.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
The quasi steady is reached, when the radial shape of the drawdown in not
changing anymore.
"""

import numpy as np
from matplotlib import pyplot as plt

Expand All @@ -21,12 +22,8 @@
transmissivity=1e-4,
rate=-1e-4,
)
head1 = (
theis(time, rad, storage=1e-3, transmissivity=1e-4, rate=-1e-4) - head_ref
)
head2 = theis(
time, rad, storage=1e-3, transmissivity=1e-4, rate=-1e-4, r_bound=r_ref
)
head1 = theis(time, rad, storage=1e-3, transmissivity=1e-4, rate=-1e-4) - head_ref
head2 = theis(time, rad, storage=1e-3, transmissivity=1e-4, rate=-1e-4, r_bound=r_ref)
head3 = thiem(rad, r_ref, transmissivity=1e-4, rate=-1e-4)

for i, step in enumerate(time):
Expand Down
5 changes: 2 additions & 3 deletions examples/13_self_defined_transmissivity.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
Reference: (not yet published)
"""

import matplotlib.gridspec as gridspec
import numpy as np
from matplotlib import pyplot as plt
Expand Down Expand Up @@ -78,9 +79,7 @@ def cond(rad, K_far, K_well, len_scale):

rad_lin = np.linspace(rad[0], rad[-1], 1000)
ax1.plot(rad_lin, step_f(rad_lin, R_part, K_part), label="step Conductivity")
ax1.plot(
rad_lin, cond(rad_lin, K_far, K_well, len_scale), label="Conductivity"
)
ax1.plot(rad_lin, cond(rad_lin, K_far, K_well, len_scale), label="Conductivity")
ax1.set_yticks([K_well, K_far])
ax1.set_ylabel(r"$K$ in $[\frac{m}{s}]$")
plt.setp(ax1.get_xticklabels(), visible=False)
Expand Down
1 change: 1 addition & 0 deletions examples/14_interval_theis.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
Unfortunatly the Stehfest algorithm is not suitable for this kind of solution,
which is demonstrated in the following script.
"""

import numpy as np
from matplotlib import pyplot as plt

Expand Down
1 change: 1 addition & 0 deletions examples/15_accruing_theis.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
This could be interpreted as that the water pump needs a certain time to
reach its constant rate state.
"""

import matplotlib.gridspec as gridspec
import numpy as np
from matplotlib import pyplot as plt
Expand Down
2 changes: 0 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,9 @@ fallback_version = "0.0.0.dev0"
[tool.isort]
profile = "black"
multi_line_output = 3
line_length = 79

[tool.black]
exclude = "_version.py"
line-length = 79
target-version = ["py37"]

[tool.coverage]
Expand Down
21 changes: 14 additions & 7 deletions src/anaflow/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,14 @@
ext_thiem_3d
ext_thiem_tpl
ext_thiem_tpl_3d
ext_thiem_int
ext_thiem_int_3d
ext_theis_2d
ext_theis_3d
ext_theis_tpl
ext_thiem_tpl_3d
ext_theis_int
ext_thiem_int_3d
neuman2004
neuman2004_steady
Expand Down Expand Up @@ -78,15 +82,20 @@
specialrange
specialrange_cut
"""

from anaflow.flow import (
ext_grf,
ext_grf_steady,
ext_theis_2d,
ext_theis_3d,
ext_theis_int,
ext_theis_int_3d,
ext_theis_tpl,
ext_theis_tpl_3d,
ext_thiem_2d,
ext_thiem_3d,
ext_thiem_int,
ext_thiem_int_3d,
ext_thiem_tpl,
ext_thiem_tpl_3d,
grf,
Expand All @@ -95,13 +104,7 @@
theis,
thiem,
)
from anaflow.tools import (
get_lap,
get_lap_inv,
specialrange,
specialrange_cut,
step_f,
)
from anaflow.tools import get_lap, get_lap_inv, specialrange, specialrange_cut, step_f

try:
from anaflow._version import __version__
Expand All @@ -117,10 +120,14 @@
"ext_thiem_3d",
"ext_thiem_tpl",
"ext_thiem_tpl_3d",
"ext_thiem_int",
"ext_thiem_int_3d",
"ext_theis_2d",
"ext_theis_3d",
"ext_theis_tpl",
"ext_theis_tpl_3d",
"ext_theis_int",
"ext_theis_int_3d",
"neuman2004",
"neuman2004_steady",
"grf",
Expand Down
13 changes: 13 additions & 0 deletions src/anaflow/flow/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,14 @@
ext_thiem_3d
ext_thiem_tpl
ext_thiem_tpl_3d
ext_thiem_int
ext_thiem_int_3d
ext_theis_2d
ext_theis_3d
ext_theis_tpl
ext_theis_tpl_3d
ext_theis_int
ext_theis_int_3d
neuman2004
neuman2004_steady
Expand All @@ -56,14 +60,19 @@
ext_grf
ext_grf_steady
"""

from anaflow.flow.ext_grf_model import ext_grf, ext_grf_steady
from anaflow.flow.heterogeneous import (
ext_theis_2d,
ext_theis_3d,
ext_theis_int,
ext_theis_int_3d,
ext_theis_tpl,
ext_theis_tpl_3d,
ext_thiem_2d,
ext_thiem_3d,
ext_thiem_int,
ext_thiem_int_3d,
ext_thiem_tpl,
ext_thiem_tpl_3d,
neuman2004,
Expand All @@ -78,10 +87,14 @@
"ext_thiem_3d",
"ext_thiem_tpl",
"ext_thiem_tpl_3d",
"ext_thiem_int",
"ext_thiem_int_3d",
"ext_theis_2d",
"ext_theis_3d",
"ext_theis_tpl",
"ext_theis_tpl_3d",
"ext_theis_int",
"ext_theis_int_3d",
"neuman2004",
"neuman2004_steady",
"grf",
Expand Down
5 changes: 2 additions & 3 deletions src/anaflow/flow/ext_grf_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
ext_grf
ext_grf_steady
"""

# pylint: disable=C0103
import numpy as np
from scipy.integrate import quad as integ
Expand Down Expand Up @@ -200,9 +201,7 @@ def integrand(val):
if np.isclose(dim, 2):
res = np.log(r_ref / Input.rad) / con
else:
res = (
(r_ref ** (2 - dim) - Input.rad ** (2 - dim)) / (2 - dim) / con
)
res = (r_ref ** (2 - dim) - Input.rad ** (2 - dim)) / (2 - dim) / con

res = Input.reshape(res)
# rescale by pumping rate
Expand Down
Loading

0 comments on commit c27a1ba

Please sign in to comment.