Skip to content

Commit

Permalink
Merge pull request #67 from mbakker7/dev
Browse files Browse the repository at this point in the history
Release 0.6.7
  • Loading branch information
dbrakenhoff authored Sep 26, 2024
2 parents 297343e + 31e3ca2 commit 66cbb16
Show file tree
Hide file tree
Showing 63 changed files with 3,310 additions and 6,811 deletions.
5 changes: 4 additions & 1 deletion .git-blame-ignore-revs
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
# Migrate code style to black
a8aa6904034da74b91f8046e2440ebb4359d63e2
a8aa6904034da74b91f8046e2440ebb4359d63e2

# Migrate code style to ruff
c1e21219503158d714f2bc8a582b098ed97852f4
19 changes: 10 additions & 9 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.8, 3.9, "3.10", "3.11"]
python-version: ["3.10", "3.11", "3.12"]
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

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

Expand All @@ -31,12 +31,13 @@ jobs:
python -m pip install --upgrade pip
pip install -e .[ci]
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=80 --statistics
- name: ruff-lint
uses: chartboost/ruff-action@v1

- name: ruff-format
uses: chartboost/ruff-action@v1
with:
args: "format --check"

- name: Run tests
run: |
Expand Down
9 changes: 6 additions & 3 deletions docs/01howto/howto_pumpingtest.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,9 @@
"metadata": {},
"outputs": [],
"source": [
"import numpy as np\n",
"import matplotlib.pyplot as plt\n",
"import numpy as np\n",
"\n",
"import ttim as ttm\n",
"\n",
"#\n",
Expand Down Expand Up @@ -71,15 +72,17 @@
"ho1 = -data[:, 1]\n",
"ro1 = 30\n",
"print(\n",
" f\"first measurement time: {np.min(to1):.2e}, last measurement time: {np.max(to1):.2e} d\"\n",
" f\"first measurement time: {np.min(to1):.2e}, \"\n",
" f\"last measurement time: {np.max(to1):.2e} d\"\n",
")\n",
"\n",
"drawdown = np.loadtxt(\"data/oudekorendijk_h90.dat\")\n",
"to2 = drawdown[:, 0] / 60 / 24\n",
"ho2 = -drawdown[:, 1]\n",
"ro2 = 90\n",
"print(\n",
" f\"first measurement time: {np.min(to2):.2e}, last measurement time: {np.max(to2):.2e} d\"\n",
" f\"first measurement time: {np.min(to2):.2e}, \"\n",
" f\"last measurement time: {np.max(to2):.2e} d\"\n",
")\n",
"\n",
"plt.plot(to1, ho1, \"C0.\", label=\"r=30 m\")\n",
Expand Down
15 changes: 8 additions & 7 deletions docs/03examples/aem_ttim_sol.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@
"outputs": [],
"source": [
"%matplotlib inline\n",
"import numpy as np\n",
"import matplotlib.pyplot as plt\n",
"import numpy as np\n",
"\n",
"import ttim"
]
},
Expand Down Expand Up @@ -39,14 +40,14 @@
" tmin=0.001,\n",
" tmax=100,\n",
" )\n",
" w = ttim.Well(ml, 0, 0, rw=0.3, tsandQ=[(0, 800)])\n",
" ttim.Well(ml, 0, 0, rw=0.3, tsandQ=[(0, 800)])\n",
" ml.solve()\n",
" t = np.logspace(-2, 1, 100)\n",
" h = ml.head(10, 0, t)\n",
" plt.figure()\n",
" r = 0.01 * np.random.randn(100)\n",
" r = 0.01 * rnd.random(100)\n",
" n = np.zeros_like(r)\n",
" alpha = 0.8\n",
" # alpha = 0.8\n",
" for i in range(1, len(n)):\n",
" n[i] = 0.8 * n[i - 1] + r[i]\n",
" ho = h[0] + n\n",
Expand Down Expand Up @@ -83,7 +84,7 @@
}
],
"source": [
"np.random.seed(11)\n",
"rnd = np.random.default_rng(11)\n",
"data = generate_data()\n",
"to = data[:, 0]\n",
"ho = data[:, 1]"
Expand All @@ -99,7 +100,7 @@
" k = p[0]\n",
" S = p[1]\n",
" ml = ttim.ModelMaq(kaq=k, z=[0, -20], Saq=S, tmin=0.001, tmax=100)\n",
" w = ttim.Well(ml, 0, 0, rw=0.3, tsandQ=[(0, 800)])\n",
" ttim.Well(ml, 0, 0, rw=0.3, tsandQ=[(0, 800)])\n",
" ml.solve(silent=True)\n",
" if returnmodel:\n",
" return ml\n",
Expand Down Expand Up @@ -283,7 +284,7 @@
" ml = ttim.ModelMaq(\n",
" kaq=k, z=[2, 0, -20], Saq=S, c=c, topboundary=\"semi\", tmin=0.001, tmax=100\n",
" )\n",
" w = ttim.Well(ml, 0, 0, rw=0.3, tsandQ=[(0, 800)])\n",
" ttim.Well(ml, 0, 0, rw=0.3, tsandQ=[(0, 800)])\n",
" ml.solve(silent=True)\n",
" if returnmodel:\n",
" return ml\n",
Expand Down
3 changes: 2 additions & 1 deletion docs/03examples/circareasink_example.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@
"outputs": [],
"source": [
"%matplotlib inline\n",
"import numpy as np\n",
"import matplotlib.pyplot as plt\n",
"import numpy as np\n",
"\n",
"import ttim"
]
},
Expand Down
4 changes: 2 additions & 2 deletions docs/03examples/compare_wells_linesink.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
"metadata": {},
"outputs": [],
"source": [
"%matplotlib inline\n",
"import numpy as np\n",
"import matplotlib.pyplot as plt\n",
"import numpy as np\n",
"\n",
"import ttim"
]
},
Expand Down
9 changes: 5 additions & 4 deletions docs/03examples/line-sink-ditch.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,8 @@
"metadata": {},
"outputs": [],
"source": [
"%matplotlib inline\n",
"import numpy as np\n",
"import matplotlib.pyplot as plt\n",
"\n",
"import ttim"
]
},
Expand All @@ -38,7 +37,7 @@
"ml = ttim.ModelMaq(kaq=10, z=[10, 0], Saq=1e-4, tmin=0.01, tmax=10)\n",
"x = np.linspace(-100, 100, 21)\n",
"y = np.zeros(len(x))\n",
"lsd = ttim.LineSinkDitchString(ml, xy=list(zip(x, y)), tsandQ=[(0, 100)])\n",
"lsd = ttim.LineSinkDitchString(ml, xy=list(zip(x, y, strict=False)), tsandQ=[(0, 100)])\n",
"ml.solve()"
]
},
Expand Down Expand Up @@ -115,7 +114,9 @@
"ml = ttim.ModelMaq(kaq=10, z=[10, 0], Saq=1e-4, tmin=0.01, tmax=10)\n",
"x = np.linspace(-100, 100, 21)\n",
"y = np.zeros(len(x))\n",
"lsd = ttim.LineSinkDitchString(ml, xy=list(zip(x, y)), tsandQ=[(0, 100)], Astorage=100)\n",
"lsd = ttim.LineSinkDitchString(\n",
" ml, xy=list(zip(x, y, strict=False)), tsandQ=[(0, 100)], Astorage=100\n",
")\n",
"ml.solve()"
]
},
Expand Down
7 changes: 4 additions & 3 deletions docs/03examples/line_sink_well_sol.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@
"metadata": {},
"outputs": [],
"source": [
"import numpy as np\n",
"import matplotlib.pyplot as plt\n",
"import numpy as np\n",
"\n",
"import ttim"
]
},
Expand Down Expand Up @@ -76,7 +77,7 @@
"yls = [-500, -300, -200, -100, -50, 0, 50, 100, 200, 300, 500]\n",
"xls = 50 * np.ones(len(yls))\n",
"ls1 = ttim.HeadLineSinkString(\n",
" ml, list(zip(xls, yls)), tsandh=\"fixed\", layers=0, label=\"river\"\n",
" ml, list(zip(xls, yls, strict=False)), tsandh=\"fixed\", layers=0, label=\"river\"\n",
")\n",
"ml.solve()\n",
"ml.xsection(x1=-200, x2=200, npoints=100, t=100, layers=[0, 1, 2], sstart=-200)"
Expand Down Expand Up @@ -226,7 +227,7 @@
"yls = [-500, -300, -200, -100, -50, 0, 50, 100, 200, 300, 500]\n",
"xls = 50 * np.ones(len(yls))\n",
"ls1 = ttim.HeadLineSinkString(\n",
" ml, list(zip(xls, yls)), tsandh=\"fixed\", layers=0, label=\"river\"\n",
" ml, list(zip(xls, yls, strict=False)), tsandh=\"fixed\", layers=0, label=\"river\"\n",
")\n",
"ml.solve()\n",
"\n",
Expand Down
2 changes: 1 addition & 1 deletion docs/03examples/meandering_river.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
"metadata": {},
"outputs": [],
"source": [
"%matplotlib inline\n",
"import numpy as np\n",
"\n",
"import ttim"
]
},
Expand Down
3 changes: 2 additions & 1 deletion docs/03examples/pathline_trace.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@
"metadata": {},
"outputs": [],
"source": [
"import numpy as np\n",
"import matplotlib.pyplot as plt\n",
"import numpy as np\n",
"\n",
"import ttim as tt"
]
},
Expand Down
3 changes: 1 addition & 2 deletions docs/03examples/pumpingtest.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,9 @@
"metadata": {},
"outputs": [],
"source": [
"import numpy as np\n",
"import matplotlib.pyplot as plt\n",
"import numpy as np\n",
"\n",
"%matplotlib inline\n",
"import ttim"
]
},
Expand Down
12 changes: 6 additions & 6 deletions docs/03examples/pumpingtest_hypothetical.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
"metadata": {},
"outputs": [],
"source": [
"%matplotlib inline\n",
"import numpy as np\n",
"import matplotlib.pyplot as plt\n",
"import numpy as np\n",
"\n",
"import ttim"
]
},
Expand Down Expand Up @@ -63,8 +63,8 @@
"ml = ttim.ModelMaq(kaq=60, z=(-18, -25), Saq=1e-4, tmin=1e-5, tmax=1)\n",
"w = ttim.Well(ml, xw=0, yw=0, rw=0.1, tsandQ=[(0, 788)], layers=0)\n",
"ml.solve()\n",
"np.random.seed(2)\n",
"hobs = ml.head(robs, 0, tobs)[0] + 0.05 * np.random.randn(len(tobs))"
"rnd = np.random.default_rng(2)\n",
"hobs = ml.head(robs, 0, tobs)[0] + 0.05 * rnd.random(len(tobs))"
]
},
{
Expand Down Expand Up @@ -609,8 +609,8 @@
"ml = ttim.ModelMaq(kaq=60, z=(-18, -25), Saq=1e-4, tmin=1e-5, tmax=1)\n",
"w = ttim.Well(ml, xw=0, yw=0, rw=0.3, res=0.02, tsandQ=[(0, 788), (0.6, 0)], layers=0)\n",
"ml.solve()\n",
"np.random.seed(2)\n",
"hobs2 = w.headinside(tobs2)[0] + 0.05 * np.random.randn(len(tobs2))"
"rnd = np.random.default_rng(2)\n",
"hobs2 = w.headinside(tobs2)[0] + 0.05 * rnd.random(len(tobs2))"
]
},
{
Expand Down
5 changes: 2 additions & 3 deletions docs/03examples/theis_storage.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,8 @@
"outputs": [],
"source": [
"import numpy as np\n",
"import matplotlib.pyplot as plt\n",
"from scipy.special import exp1\n",
"from scipy.integrate import solve_ivp, quad"
"from scipy.integrate import quad, solve_ivp\n",
"from scipy.special import exp1"
]
},
{
Expand Down
4 changes: 2 additions & 2 deletions docs/03examples/ttim_exercise1_sol.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
"metadata": {},
"outputs": [],
"source": [
"%matplotlib inline\n",
"import numpy as np\n",
"import matplotlib.pyplot as plt\n",
"import numpy as np\n",
"\n",
"import ttim"
]
},
Expand Down
Loading

0 comments on commit 66cbb16

Please sign in to comment.