Skip to content

Commit

Permalink
Merge pull request #104 from EcoExtreML/bmi-MODFLOW-coupling
Browse files Browse the repository at this point in the history
Add a BMI MODFLOW coupling notebook
  • Loading branch information
SarahAlidoost authored Sep 27, 2024
2 parents d2e9186 + e9268ce commit 33adb9e
Show file tree
Hide file tree
Showing 9 changed files with 6,865 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ghcr.io/ecoextreml/stemmus_scope:1.6.0
FROM ghcr.io/ecoextreml/stemmus_scope:1.6.1

LABEL maintainer="Bart Schilperoort <[email protected]>"
LABEL org.opencontainers.image.source = "https://github.com/EcoExtreML/STEMMUS_SCOPE_Processing"
Expand Down
2 changes: 1 addition & 1 deletion PyStemmusScope/bmi/docker_process.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ class StemmusScopeDocker:
"""Communicate with a STEMMUS_SCOPE Docker container."""

# Default image, can be overridden with config:
compatible_tags = ("1.6.0",)
compatible_tags = ("1.6.1",)

_process_ready_phrase = b"Select BMI mode:"
_process_finalized_phrase = b"Finished clean up."
Expand Down
9 changes: 9 additions & 0 deletions PyStemmusScope/bmi/variable_reference.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,15 @@ class BmiVariable:
grid=0,
keys=["gwfluxes", "recharge"],
),
BmiVariable(
name="groundwater_recharge_index",
dtype="int64",
input=False,
output=True,
units="-",
grid=0,
keys=["gwfluxes", "indxRchrg"],
),
# groundwater (coupling) vars
BmiVariable(
name="groundwater_coupling_enabled",
Expand Down
10 changes: 10 additions & 0 deletions PyStemmusScope/config_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,16 @@ def _copy_data(input_dir: Path, config: dict) -> None:

# copy input_data.xlsx
shutil.copy(str(config["input_data"]), str(input_dir))
# copy soil_layers_thickness, this is optional
if "soil_layers_thickness" in config:
if Path(config["soil_layers_thickness"]).is_file():
shutil.copy(str(config["soil_layers_thickness"]), str(input_dir))
else:
raise FileNotFoundError(
"The key `soil_layers_thickness` is provided in the config file, "
f"but file {config['soil_layers_thickness']} not found. "
"Remove the key from the config file or provide the file."
)


def _update_config_file(
Expand Down
6 changes: 3 additions & 3 deletions docs/bmi.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ To use the Docker image, use the `DockerImage` setting in the configuration file
```sh
WorkDir=/home/username/tmp/stemmus_scope
...
DockerImage=ghcr.io/ecoextreml/stemmus_scope:1.6.0
DockerImage=ghcr.io/ecoextreml/stemmus_scope:1.6.1
```

It is best to add the version tag here too (`:1.6.0`), this way the BMI will warn you if the version might be incompatible.
It is best to add the version tag here too (`:1.6.1`), this way the BMI will warn you if the version might be incompatible.

Note that the `docker` package for python is required here. Install this with `pip install PyStemmusScope[docker]`.
Additionally, [Docker](https://docs.docker.com/get-docker/) itself has to be installed.
Expand Down Expand Up @@ -52,7 +52,7 @@ If you need access to other model variables that are not yet available in the BM

A [Docker image is available](https://ghcr.io/ecoextreml/stemmus_scope-grpc4bmi) in which the model as well as the Python BMI have been wrapped in a container. The Docker image is created using the Docker file [here](https://github.com/EcoExtreML/STEMMUS_SCOPE_Processing/blob/main/Dockerfile) and allows communication with a STEMMUS_SCOPE BMI through [grpc4bmi](https://grpc4bmi.readthedocs.io/en/latest/).

Doing so avoids the needs to install PyStemmusScope yourself, only Docker/apptainer and a python environment with grpc4bmi are required. Please note you should not specify `DockerImage` or `ExeFilePath` in the config file if you are using the grpc4bmi interface.
Doing so avoids the needs to install PyStemmusScope yourself, only Docker/apptainer and a python environment with grpc4bmi are required. Please note you should not specify `DockerImage` or `ExeFilePath` in the config file if you are using the grpc4bmi interface.

A demonstration is available [here](notebooks/grpc4bmi_demo.ipynb)

Expand Down
Loading

0 comments on commit 33adb9e

Please sign in to comment.