Skip to content

Commit

Permalink
test: soil moisture profile
Browse files Browse the repository at this point in the history
  • Loading branch information
aaraney committed Mar 9, 2024
1 parent 9210b7c commit cb5332e
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 0 deletions.
7 changes: 7 additions & 0 deletions python/ngen_conf/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
_pet_config_data_path = _datadir / "init_config_data" / "pet.ini"
_noah_owp_config_data_path = _datadir / "init_config_data" / "noah_owp.namelist"
_soil_freeze_thaw_config_data_path = _datadir / "init_config_data" / "soil_freeze_thaw.txt"
_soil_moisture_profile_config_data_path = _datadir / "init_config_data" / "soil_moisture_profile.txt"


"""
Fixtures for setting up various ngen-conf components for testing
Expand Down Expand Up @@ -165,3 +167,8 @@ def noah_owp_init_config() -> str:
def soil_freeze_thaw_init_config() -> str:
# drop eol char
return _soil_freeze_thaw_config_data_path.read_text().rstrip()

@pytest.fixture
def soil_moisture_profile_init_config() -> str:
# drop eol char
return _soil_moisture_profile_config_data_path.read_text().rstrip()
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
soil_params.smcmax=0.439
soil_params.b=5.25
soil_params.satpsi=0.355
soil_z=0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,1.0,1.1,1.2,1.3,1.4,1.5,1.6,1.7,1.8,1.9,2.0
soil_storage_model=conceptual
soil_storage_depth=2.0
6 changes: 6 additions & 0 deletions python/ngen_conf/tests/test_init_config_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from ngen.config.init_config.pet import PET
from ngen.config.init_config.noahowp import NoahOWP
from ngen.config.init_config.soil_freeze_thaw import SoilFreezeThaw
from ngen.config.init_config.soil_moisture_profile import SoilMoistureProfile


def test_cfe(cfe_init_config: str):
Expand All @@ -27,3 +28,8 @@ def test_noah_owp(noah_owp_init_config: str):
def test_soil_freeze_thaw(soil_freeze_thaw_init_config: str):
o = SoilFreezeThaw.from_ini_str(soil_freeze_thaw_init_config)
assert o.to_ini_str() == soil_freeze_thaw_init_config


def test_soil_moisture_profile(soil_moisture_profile_init_config: str):
o = SoilMoistureProfile.from_ini_str(soil_moisture_profile_init_config)
assert o.to_ini_str() == soil_moisture_profile_init_config

0 comments on commit cb5332e

Please sign in to comment.