Skip to content

Commit

Permalink
add tests for h and gardner
Browse files Browse the repository at this point in the history
  • Loading branch information
martinvonk committed Oct 4, 2023
1 parent 4efeb0e commit bbe8b4c
Showing 1 changed file with 36 additions and 1 deletion.
37 changes: 36 additions & 1 deletion tests/test_soilmodel.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import pytest
from numpy import logspace
from numpy import array, logspace

import pedon as pe
from pedon._typing import FloatArray

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

theta = array([0.1, 0.2, 0.3, 0.4])


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


@pytest.fixture
def gar() -> pe.soilmodel.SoilModel:
return pe.Gardner(k_s=10, theta_r=0.01, theta_s=0.43, a=0.02, b=1.0, m=1.1)


def test_theta_genuchten(gen: pe.soilmodel.SoilModel, h: FloatArray = h) -> None:
gen.theta(h=h)

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


def test_h_genuchten(gen: pe.soilmodel.SoilModel, theta: FloatArray = theta) -> None:
gen.h(theta=theta)


def test_theta_brooks(bro: pe.soilmodel.SoilModel, h: FloatArray = h) -> None:
bro.theta(h=h)

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


def test_h_brooks(bro: pe.soilmodel.SoilModel, theta: FloatArray = theta) -> None:
bro.h(theta=theta)


def test_theta_panday(sor: pe.soilmodel.SoilModel, h: FloatArray = h) -> None:
sor.theta(h=h)

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

def test_k_panday(sor: pe.soilmodel.SoilModel, h: FloatArray = h) -> None:
sor.k(h=h)


def test_h_panday(sor: pe.soilmodel.SoilModel, theta: FloatArray = theta) -> None:
sor.h(theta=theta)


def test_theta_gardner(gar: pe.soilmodel.SoilModel, h: FloatArray = h) -> None:
gar.theta(h=h)


def test_s_gardner(gar: pe.soilmodel.SoilModel, h: FloatArray = h) -> None:
gar.s(h=h)


def test_k_gardner(gar: pe.soilmodel.SoilModel, h: FloatArray = h) -> None:
gar.k(h=h)


def test_h_gardner(gar: pe.soilmodel.SoilModel, theta: FloatArray = theta) -> None:
gar.h(theta=theta)

0 comments on commit bbe8b4c

Please sign in to comment.