Skip to content

Commit 6d57e0c

Browse files
committed
Merge branch 'main' into update_docs
2 parents 75f5ad0 + 43c5e60 commit 6d57e0c

6 files changed

Lines changed: 40 additions & 11 deletions

File tree

Dockerfile

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
FROM ghcr.io/ecoextreml/stemmus_scope:1.6.1
1+
FROM ghcr.io/ecoextreml/stemmus_scope:1.6.2
22

33
LABEL maintainer="Bart Schilperoort <b.schilperoort@esciencecenter.nl>"
4-
LABEL org.opencontainers.image.source = "https://github.com/EcoExtreML/STEMMUS_SCOPE_Processing"
4+
LABEL org.opencontainers.image.source="https://github.com/EcoExtreML/STEMMUS_SCOPE_Processing"
55

66
# Requirements for building Python 3.10
77
RUN apt-get update && apt-get -y upgrade
@@ -26,8 +26,8 @@ RUN pip3.10 install grpc4bmi==0.5.0
2626

2727
# # Set the STEMMUS_SCOPE environmental variable, so the BMI can find the executable
2828
WORKDIR /
29-
ENV STEMMUS_SCOPE /STEMMUS_SCOPE
29+
ENV STEMMUS_SCOPE=/STEMMUS_SCOPE
3030

3131
EXPOSE 55555
3232
# Start grpc4bmi server
33-
CMD run-bmi-server --name "PyStemmusScope.bmi.implementation.StemmusScopeBmi" --port 55555 --debug
33+
CMD ["run-bmi-server", "--name", "PyStemmusScope.bmi.implementation.StemmusScopeBmi", "--port", "55555", "--debug"]

PyStemmusScope/bmi/docker_process.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ class StemmusScopeDocker:
8383
"""Communicate with a STEMMUS_SCOPE Docker container."""
8484

8585
# Default image, can be overridden with config:
86-
compatible_tags = ("1.6.1",)
86+
compatible_tags = ("1.6.2",)
8787

8888
_process_ready_phrase = b"Select BMI mode:"
8989
_process_finalized_phrase = b"Finished clean up."

PyStemmusScope/bmi/local_process.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ def __init__(self, cfg_file: str) -> None:
8686
"""Initialize the process."""
8787
self.cfg_file = cfg_file
8888
config = read_config(cfg_file)
89+
self.sleep_duration = int(config.get("SleepDuration", 10))
8990

9091
exe_file = find_exe(config)
9192
args = [exe_file, cfg_file, "bmi"]
@@ -154,7 +155,7 @@ def finalize(self) -> None:
154155
"""Finalize the model."""
155156
self.process = alive_process(self.process)
156157
self.process.stdin.write(b"finalize\n") # type: ignore
157-
sleep(10)
158+
sleep(self.sleep_duration)
158159
if self.process.poll() != 0:
159160
try:
160161
self.process.terminate()

PyStemmusScope/bmi/variable_reference.py

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,43 @@ class BmiVariable:
2828
keys=["fluxes", "Resp"],
2929
),
3030
BmiVariable(
31-
name="evaporation_total",
31+
name="precipitation",
32+
dtype="float64",
33+
input=True,
34+
output=False,
35+
units="cm s-1",
36+
grid=0,
37+
keys=["ForcingData", "Precip_msr"],
38+
all_timesteps=True,
39+
),
40+
BmiVariable(
41+
name="applied_infiltration",
3242
dtype="float64",
3343
input=False,
3444
output=True,
3545
units="cm s-1",
3646
grid=0,
37-
keys=["EVAP"],
47+
keys=["ForcingData", "applied_inf"],
3848
all_timesteps=True,
3949
),
50+
BmiVariable(
51+
name="soil_evaporation",
52+
dtype="float64",
53+
input=False,
54+
output=True,
55+
units="cm s-1",
56+
grid=0,
57+
keys=["Evap"],
58+
),
59+
BmiVariable(
60+
name="transpiration",
61+
dtype="float64",
62+
input=False,
63+
output=True,
64+
units="cm s-1",
65+
grid=0,
66+
keys=["Trap"],
67+
),
4068
# soil vars:
4169
BmiVariable(
4270
name="soil_temperature",

docs/bmi.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@ To use the Docker image, use the `DockerImage` setting in the configuration file
2121
```sh
2222
WorkDir=/home/username/tmp/stemmus_scope
2323
...
24-
DockerImage=ghcr.io/ecoextreml/stemmus_scope:1.6.1
24+
DockerImage=ghcr.io/ecoextreml/stemmus_scope:1.6.2
2525
```
2626

27-
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.
27+
It is best to add the version tag here too (`:1.6.2`), this way the BMI will warn you if the version might be incompatible.
2828

2929
Note that the `docker` package for python is required here. Install this with `pip install PyStemmusScope[docker]`.
3030
Additionally, [Docker](https://docs.docker.com/get-docker/) itself has to be installed.

tests/test_data/config_file_docker.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@ StartTime=1996-01-01T00:00
1313
EndTime=1996-01-01T02:00
1414
InputPath=
1515
OutputPath=
16-
DockerImage=ghcr.io/ecoextreml/stemmus_scope:1.6.1
16+
DockerImage=ghcr.io/ecoextreml/stemmus_scope:1.6.2

0 commit comments

Comments
 (0)