Skip to content

Commit 07adbef

Browse files
Move to Remote BMI & containerized model (#12)
* Use remotebmi containerized model * Add Dockerfile * Add new demo notebook * Update dockerfile * Update README * Correct entrypoint, set ewatercycle minimum version * Update CMIP forcing notebook * Update formatting * Add link to parameter set download * Modify Dockerfile to allow any user to run the container --------- Co-authored-by: sverhoeven <[email protected]>
1 parent d88623e commit 07adbef

File tree

12 files changed

+387
-731
lines changed

12 files changed

+387
-731
lines changed

Dockerfile

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
FROM ghcr.io/ewatercycle/remotebmi-julia:0.1.0
2+
3+
LABEL org.opencontainers.image.source="https://github.com/eWaterCycle/ewatercycle-wflowjl"
4+
5+
# Install Wflow
6+
RUN julia -e 'using Pkg; Pkg.add(PackageSpec(name="Wflow", version="0.8.1"))'
7+
8+
RUN echo "using Wflow" > run.jl
9+
RUN echo "import RemoteBMI.Server: run_bmi_server" >> run.jl
10+
RUN echo "port = parse(Int, get(ENV, \"BMI_PORT\", \"50051\"))" >> run.jl
11+
RUN echo "run_bmi_server(Wflow.Model, \"0.0.0.0\", port)" >> run.jl
12+
13+
# chmod central depot path so all users can access it
14+
RUN chmod -R 777 ${JULIA_DEPOT_PATH}
15+
16+
# Expose port and start server
17+
EXPOSE 50051
18+
CMD ["julia", "run.jl"]

README.md

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,38 +2,29 @@
22

33
Wflow.jl plugin for [eWatercycle](https://ewatercycle.readthedocs.io/).
44

5-
The Wflow.jl documentation is available at https://deltares.github.io/Wflow.jl/dev/ .
5+
The Wflow.jl documentation is available at https://deltares.github.io/Wflow.jl/ .
66

77
## Installation
88

9-
eWaterCycle must be installed in a [mamba](https://conda-forge.org/miniforge/) environment. The environment can be created with
9+
Please first install ewatercycle, for more info see the [general ewatercycle documentation](https://ewatercycle.readthedocs.io/).
1010

11-
```console
12-
wget https://raw.githubusercontent.com/eWaterCycle/ewatercycle/main/environment.yml
13-
mamba env create --name ewatercycle-wflowjl --file environment.yml
14-
conda activate ewatercycle-wflowjl
15-
```
16-
17-
Install this package alongside your eWaterCycle installation
11+
To install this package alongside your eWaterCycle installation, do:
1812

1913
```console
2014
pip install ewatercycle-wflowjl
2115
```
2216

23-
Then Wflow becomes available as one of the eWaterCycle models
17+
Then Wflow becomes available as one of the eWaterCycle models:
2418

2519
```python
26-
from ewatercycle.models import WflowJl
20+
import ewatercycle.models
21+
ewatercycle.models.sources["WflowJl"]
2722
```
2823

29-
Note that unlike other plugins, the WflowJl eWaterCycle model does not run in a container.
30-
31-
This is due to limitations of the Julia language.
32-
3324
## Usage
3425

3526
Usage of Wflow.jl forcing generation and model execution is shown in
36-
[docs/generate_era5_forcing.ipynb](https://github.com/eWaterCycle/ewatercycle-wflowjl/tree/main/docs/generate_era5_forcing.ipynb) and [docs/wflowjl_local.ipynb](https://github.com/eWaterCycle/ewatercycle-wflow/tree/main/docs/wflowjl_local.ipynb) respectively.
27+
[docs/generate_era5_forcing.ipynb](https://github.com/eWaterCycle/ewatercycle-wflowjl/tree/main/docs/generate_era5_forcing.ipynb) and [docs/demo.ipynb](https://github.com/eWaterCycle/ewatercycle-wflow/tree/main/docs/demo.ipynb) respectively.
3728

3829
## License
3930

docs/demo.ipynb

Lines changed: 264 additions & 0 deletions
Large diffs are not rendered by default.

docs/generate_cmip_forcing.ipynb

Lines changed: 75 additions & 203 deletions
Large diffs are not rendered by default.

docs/wflowjl_local.ipynb

Lines changed: 0 additions & 451 deletions
This file was deleted.

pyproject.toml

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ dynamic = ["version"]
2626

2727
# Include here only the dependencies for the eWaterCycle wrapped model
2828
dependencies = [
29-
"ewatercycle>=2.0.0b2",
30-
"grpc4bmi[julia]",
29+
"ewatercycle>=2.4.0",
30+
"remotebmi",
3131
"toml",
3232
]
3333

@@ -42,9 +42,13 @@ dev = [
4242
WflowJl = "ewatercycle_wflowjl.model:WflowJl"
4343

4444
[project.entry-points."ewatercycle.forcings"]
45-
WflowJlForcing = "ewatercycle_wflow.forcing.forcing:WflowJlForcing"
45+
WflowJlForcing = "ewatercycle_wflowjl.forcing.forcing:WflowJlForcing"
4646

4747
[tool.ruff]
48+
target-version = "py310"
49+
extend-exclude = ["*.ipynb"]
50+
51+
[tool.ruff.lint]
4852
select = ["E", "F", "B", "D", "C90", "I", "N", "UP", "PLE", "PLR", "PLW"]
4953
extend-select = ["D401", "D400", "D404", "TID252"]
5054
ignore = [
@@ -53,12 +57,11 @@ ignore = [
5357
"N813",
5458
]
5559
dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$"
56-
target-version = "py310"
5760

58-
[tool.ruff.pydocstyle]
61+
[tool.ruff.lint.pydocstyle]
5962
convention = "google"
6063

61-
[tool.ruff.isort]
64+
[tool.ruff.lint.isort]
6265
known-first-party = ["ewatercycle_wflow"]
6366
force-single-line = true
6467
lines-after-imports = 2

src/ewatercycle_wflowjl/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
"""eWaterCycle plugin for Wflow.jl."""
2-
__version__ = "0.0.1"
2+
3+
__version__ = "0.2.0"

src/ewatercycle_wflowjl/forcing/diagnostic_script.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""wflow diagnostic."""
2+
23
import logging
34
from pathlib import Path
45

src/ewatercycle_wflowjl/forcing/forcing.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Forcing related functionality for wflow."""
2+
23
from datetime import datetime
34
from pathlib import Path
45

src/ewatercycle_wflowjl/forcing/makkink.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Makkink formula for potential evaporation, implemented for Iris."""
2+
23
import logging
34
from pathlib import Path
45

0 commit comments

Comments
 (0)