Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add integral model solutions #13

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 21 additions & 16 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,34 +12,33 @@ on:
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

env:
# needed by coveralls
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

jobs:
source_check:
name: source check
runs-on: ubuntu-latest
strategy:
fail-fast: false

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: Set up Python 3.9
uses: actions/setup-python@v2
uses: actions/setup-python@v5
with:
python-version: 3.9

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install --editable .[check]
pip install --editable .[check,test]
pip install "coveralls>=3.0.0"

- name: black check
run: |
python -m black --check --diff --color .

- name: black preview
run: |
python -m black --preview --diff --color .

- name: isort check
run: |
python -m isort --check --diff --color .
Expand All @@ -48,22 +47,29 @@ jobs:
run: |
python -m pylint src/anaflow/

- name: coveralls check
run: |
python -m pytest --cov anaflow --cov-report term-missing -v tests/
python -m coveralls --service=github
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

build_sdist:
name: sdist on ${{ matrix.os }} with py ${{ matrix.python-version }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11']
os: [ubuntu-latest, windows-latest, macos-13]
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
fetch-depth: '0'

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

Expand All @@ -76,13 +82,12 @@ jobs:
- name: Run tests
run: |
python -m pytest --cov anaflow --cov-report term-missing -v tests/
python -m coveralls --service=github

- name: Build sdist
run: |
python -m build

- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v3
if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.9'
with:
path: dist
Expand All @@ -92,7 +97,7 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/download-artifact@v2
- uses: actions/download-artifact@v3
with:
name: artifact
path: dist
Expand Down
8 changes: 6 additions & 2 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
version: 2

build:
os: ubuntu-22.04
tools:
python: "3.11"

sphinx:
configuration: docs/source/conf.py

formats: all
formats: [pdf]

python:
version: 3.7
install:
- method: pip
path: .
Expand Down
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
8 changes: 3 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,9 @@ doc = [
]
test = ["pytest-cov>=3"]
check = [
"black>=23,<24",
"black>=24,<25",
"isort[colors]<6",
"pylint<3",
"pylint",
]

[project.urls]
Expand All @@ -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 Expand Up @@ -120,7 +118,7 @@ target-version = ["py37"]
output-format = "colorized"

[tool.pylint.design]
max-args = 20
max-args = 25
max-locals = 50
max-branches = 30
max-statements = 80
Expand Down
Loading
Loading