-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement groundwater coupling changes in BMI (#101)
* Implement groundwater coupling changes in BMI * Implement new groundwater coupling variables * Programatically get/set values * Remove outdated test * Pin dependencies to working versions * Fix issues related to variables containing all timesteps * Add notebook demonstrating the groundwater coupling through BMI * Load docker image from test config file instead of hardcoded * Add checks for set_value to ensure arrays are right size * Add tests for new set_value input checks * stemmus_scope:1.6.0 image is now available * Skip notebooks in linting for now
- Loading branch information
1 parent
8adc6a1
commit d2e9186
Showing
10 changed files
with
530 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
FROM ghcr.io/ecoextreml/stemmus_scope:1.5.0 | ||
FROM ghcr.io/ecoextreml/stemmus_scope:1.6.0 | ||
|
||
LABEL maintainer="Bart Schilperoort <[email protected]>" | ||
LABEL org.opencontainers.image.source = "https://github.com/EcoExtreML/STEMMUS_SCOPE_Processing" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,154 @@ | ||
"""Variable reference to inform the BMI implementation.""" | ||
from dataclasses import dataclass | ||
|
||
|
||
@dataclass | ||
class BmiVariable: | ||
"""Holds all info to inform the BMI implementation.""" | ||
|
||
name: str | ||
dtype: str | ||
input: bool | ||
output: bool | ||
units: str | ||
grid: int | ||
keys: list[str] | ||
all_timesteps: bool = False | ||
|
||
|
||
VARIABLES: tuple[BmiVariable, ...] = ( | ||
# atmospheric vars: | ||
BmiVariable( | ||
name="respiration", | ||
dtype="float64", | ||
input=False, | ||
output=True, | ||
units="cm s-1", | ||
grid=0, | ||
keys=["fluxes", "Resp"], | ||
), | ||
BmiVariable( | ||
name="evaporation_total", | ||
dtype="float64", | ||
input=False, | ||
output=True, | ||
units="cm s-1", | ||
grid=0, | ||
keys=["EVAP"], | ||
all_timesteps=True, | ||
), | ||
# soil vars: | ||
BmiVariable( | ||
name="soil_temperature", | ||
dtype="float64", | ||
input=True, | ||
output=True, | ||
units="degC", | ||
grid=1, | ||
keys=["TT"], | ||
), | ||
BmiVariable( | ||
name="soil_moisture", | ||
dtype="float64", | ||
input=True, | ||
output=True, | ||
units="m3 m-3", | ||
grid=1, | ||
keys=["SoilVariables", "Theta_U"], | ||
), | ||
BmiVariable( | ||
name="soil_root_water_uptake", | ||
dtype="float64", | ||
input=False, | ||
output=True, | ||
units="cm s-1", | ||
grid=0, | ||
keys=["RWUs"], | ||
), | ||
# surface runoff | ||
BmiVariable( | ||
name="surface_runoff_total", | ||
dtype="float64", | ||
input=False, | ||
output=True, | ||
units="cm s-1", | ||
grid=0, | ||
keys=["RS"], | ||
), | ||
BmiVariable( | ||
name="surface_runoff_hortonian", | ||
dtype="float64", | ||
input=False, | ||
output=True, | ||
units="cm s-1", | ||
grid=0, | ||
keys=["ForcingData", "R_Dunn"], | ||
all_timesteps=True, | ||
), | ||
BmiVariable( | ||
name="surface_runoff_dunnian", | ||
dtype="float64", | ||
input=False, | ||
output=True, | ||
units="cm s-1", | ||
grid=0, | ||
keys=["ForcingData", "R_Hort"], | ||
all_timesteps=True, | ||
), | ||
# groundwater vars (STEMMUS_SCOPE) | ||
BmiVariable( | ||
name="groundwater_root_water_uptake", | ||
dtype="float64", | ||
input=False, | ||
output=True, | ||
units="cm s-1", | ||
grid=0, | ||
keys=["RWUg"], | ||
), | ||
BmiVariable( | ||
name="groundwater_recharge", | ||
dtype="float64", | ||
input=False, | ||
output=True, | ||
units="cm s-1", | ||
grid=0, | ||
keys=["gwfluxes", "recharge"], | ||
), | ||
# groundwater (coupling) vars | ||
BmiVariable( | ||
name="groundwater_coupling_enabled", | ||
dtype="bool", | ||
input=True, | ||
output=False, | ||
units="-", | ||
grid=0, | ||
keys=["GroundwaterSettings", "GroundwaterCoupling"], | ||
), | ||
BmiVariable( | ||
name="groundwater_head_bottom_layer", | ||
dtype="float64", | ||
input=True, | ||
output=False, | ||
units="cm", | ||
grid=0, | ||
keys=["GroundwaterSettings", "headBotmLayer"], | ||
), | ||
BmiVariable( | ||
name="groundwater_temperature", | ||
dtype="float64", | ||
input=True, | ||
output=False, | ||
units="degC", | ||
grid=0, | ||
keys=["GroundwaterSettings", "tempBotm"], | ||
), | ||
BmiVariable( | ||
name="groundwater_elevation_top_aquifer", | ||
dtype="float64", | ||
input=True, | ||
output=False, | ||
units="cm", | ||
grid=0, | ||
keys=["GroundwaterSettings", "topLevel"], | ||
), | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.