Skip to content

Commit 4a1aac7

Browse files
authored
Merge pull request #4 from martinvonk/dev
Update main to v0.0.5
2 parents 00b4214 + 82bcd98 commit 4a1aac7

File tree

6 files changed

+54
-6
lines changed

6 files changed

+54
-6
lines changed

.github/workflows/tests.yaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ on:
77
jobs:
88
test:
99
runs-on: ${{ matrix.os }}
10+
continue-on-error: ${{ matrix.experimental }}
1011
strategy:
1112
fail-fast: false
1213
matrix:
@@ -15,22 +16,32 @@ jobs:
1516
python: "3.10"
1617
os: ubuntu-latest
1718
toxenv: py310
19+
experimental: false
1820
- name: Test suite with py311-ubuntu
1921
python: "3.11"
2022
os: ubuntu-latest
2123
toxenv: py311
24+
experimental: false
25+
- name: Test suite with py312-ubuntu
26+
python: "3.12-dev"
27+
os: ubuntu-latest
28+
toxenv: py312
29+
experimental: true
2230
- name: Type check with mypy
2331
python: "3.10"
2432
os: ubuntu-latest
2533
toxenv: type
34+
experimental: false
2635
- name: Formatting with black + isort
2736
python: "3.10"
2837
os: ubuntu-latest
2938
toxenv: format
39+
experimental: false
3040
- name: Linting with flake8 + ruff
3141
python: "3.10"
3242
os: ubuntu-latest
3343
toxenv: lint
44+
experimental: false
3445

3546
name: ${{ matrix.name }}
3647
env:

pyproject.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ pythonpath = ["src"]
6969
legacy_tox_ini = """
7070
[tox]
7171
requires = tox>=4
72-
env_list = format, type, lint, py{310,311}
72+
env_list = format, type, lint, py{310,311,312}
7373
7474
[testenv]
7575
description = run unit tests
@@ -82,8 +82,8 @@ legacy_tox_ini = """
8282
basepython = python3.10
8383
extras = formatting
8484
commands =
85-
black src
86-
isort src
85+
black src --check --verbose
86+
isort src --check
8787
8888
[testenv:type]
8989
description = run type checks

src/pedon/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
from .soil import Soil as Soil
66
from .soil import SoilSample as SoilSample
77
from .soilmodel import Brooks as Brooks
8+
from .soilmodel import Gardner as Gardner
89
from .soilmodel import Genuchten as Genuchten
910
from .soilmodel import Panday as Panday
1011
from .soilmodel import plot_hcf, plot_swrc

src/pedon/_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "0.0.4"
1+
__version__ = "0.0.5"

src/pedon/soilmodel.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
import matplotlib.pyplot as plt
55
from numpy import abs as npabs
6-
from numpy import exp, full, linspace, log, logspace, log10
6+
from numpy import exp, full, linspace, log, log10, logspace
77

88
from ._typing import FloatArray
99

@@ -201,6 +201,7 @@ class Panday:
201201
sr: float = field(init=False, repr=True)
202202
gamma: float = field(init=False, repr=False) # 1 - 1 / beta
203203
sy: float = field(init=False, repr=False)
204+
ss: float = field(default=1e-6, repr=False)
204205

205206
def __post_init__(self):
206207
self.sr = self.theta_r / self.theta_s # theta_r / theta_s

tests/test_soilmodel.py

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
import pytest
2-
from numpy import logspace
2+
from numpy import array, logspace
33

44
import pedon as pe
55
from pedon._typing import FloatArray
66

77
h = -logspace(-2, 6, num=50)
88

9+
theta = array([0.1, 0.2, 0.3, 0.4])
10+
911

1012
@pytest.fixture
1113
def gen() -> pe.soilmodel.SoilModel:
@@ -22,6 +24,11 @@ def sor() -> pe.soilmodel.SoilModel:
2224
return pe.Panday(k_s=10, theta_r=0.01, theta_s=0.43, alpha=0.02, beta=1.1, brook=3)
2325

2426

27+
@pytest.fixture
28+
def gar() -> pe.soilmodel.SoilModel:
29+
return pe.Gardner(k_s=10, theta_r=0.01, theta_s=0.43, a=0.02, b=1.0, m=1.1)
30+
31+
2532
def test_theta_genuchten(gen: pe.soilmodel.SoilModel, h: FloatArray = h) -> None:
2633
gen.theta(h=h)
2734

@@ -34,6 +41,10 @@ def test_k_genuchten(gen: pe.soilmodel.SoilModel, h: FloatArray = h) -> None:
3441
gen.k(h=h)
3542

3643

44+
def test_h_genuchten(gen: pe.soilmodel.SoilModel, theta: FloatArray = theta) -> None:
45+
gen.h(theta=theta)
46+
47+
3748
def test_theta_brooks(bro: pe.soilmodel.SoilModel, h: FloatArray = h) -> None:
3849
bro.theta(h=h)
3950

@@ -46,6 +57,10 @@ def test_k_brooks(bro: pe.soilmodel.SoilModel, h: FloatArray = h) -> None:
4657
bro.k(h=h)
4758

4859

60+
def test_h_brooks(bro: pe.soilmodel.SoilModel, theta: FloatArray = theta) -> None:
61+
bro.h(theta=theta)
62+
63+
4964
def test_theta_panday(sor: pe.soilmodel.SoilModel, h: FloatArray = h) -> None:
5065
sor.theta(h=h)
5166

@@ -56,3 +71,23 @@ def test_s_panday(sor: pe.soilmodel.SoilModel, h: FloatArray = h) -> None:
5671

5772
def test_k_panday(sor: pe.soilmodel.SoilModel, h: FloatArray = h) -> None:
5873
sor.k(h=h)
74+
75+
76+
def test_h_panday(sor: pe.soilmodel.SoilModel, theta: FloatArray = theta) -> None:
77+
sor.h(theta=theta)
78+
79+
80+
def test_theta_gardner(gar: pe.soilmodel.SoilModel, h: FloatArray = h) -> None:
81+
gar.theta(h=h)
82+
83+
84+
def test_s_gardner(gar: pe.soilmodel.SoilModel, h: FloatArray = h) -> None:
85+
gar.s(h=h)
86+
87+
88+
def test_k_gardner(gar: pe.soilmodel.SoilModel, h: FloatArray = h) -> None:
89+
gar.k(h=h)
90+
91+
92+
def test_h_gardner(gar: pe.soilmodel.SoilModel, theta: FloatArray = theta) -> None:
93+
gar.h(theta=theta)

0 commit comments

Comments
 (0)