Skip to content

Commit

Permalink
Move BMI code to bmi module
Browse files Browse the repository at this point in the history
  • Loading branch information
BSchilperoort committed Jan 11, 2024
1 parent 88ec40b commit 71c06aa
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 17 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@ WORKDIR /
ENV STEMMUS_SCOPE ./STEMMUS_SCOPE

# Start grpc4bmi server
CMD run-bmi-server --name "PyStemmusScope.bmi.StemmusScopeBmi" --port 55555 --debug
CMD run-bmi-server --name "PyStemmusScope.bmi.implementation.StemmusScopeBmi" --port 55555 --debug
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import h5py
import numpy as np
from bmipy.bmi import Bmi
from PyStemmusScope.bmi_utils import InapplicableBmiMethods
from PyStemmusScope.bmi.utils import InapplicableBmiMethods
from PyStemmusScope.config_io import read_config


Expand Down Expand Up @@ -176,15 +176,15 @@ def load_process(mode: Literal["exe", "docker"]) -> type[StemmusScopeProcess]:
"""Load the right STEMMUS_SCOPE process."""
if mode == "docker":
try:
from PyStemmusScope.docker_process import StemmusScopeDocker as Process
from PyStemmusScope.bmi.docker_process import StemmusScopeDocker as Process
except ImportError as err:
msg = (
"The docker python package is not available."
" Please install before continuing."
)
raise ImportError(msg) from err
elif mode == "exe":
from PyStemmusScope.local_process import LocalStemmusScope as Process
from PyStemmusScope.bmi.local_process import LocalStemmusScope as Process
else:
msg = "Unknown mode."
raise ValueError(msg)
Expand Down
File renamed without changes.
File renamed without changes.
27 changes: 14 additions & 13 deletions docs/notebooks/BMI_demo.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
"metadata": {},
"outputs": [],
"source": [
"#cfg_file = \"/home/bart/tmp/stemmus_scope/config_docker.txt\"\n",
"cfg_file = \"/home/bart/tmp/stemmus_scope/config_exe.txt\""
"cfg_file = \"/home/bart/tmp/stemmus_scope/config_docker.txt\"\n",
"# cfg_file = \"/home/bart/tmp/stemmus_scope/config_exe.txt\""
]
},
{
Expand All @@ -42,7 +42,8 @@
" \"/home/bart/matlab_runtime/R2023a/sys/os/glnxa64:\"\n",
" \"/home/bart/matlab_runtime/R2023a/extern/bin/glnxa64:\"\n",
" \"/home/bart/matlab_runtime/R2023a/sys/opengl/lib/glnxa64\"\n",
" )"
" )\n",
" os.environ[\"STEMMUS_SCOPE\"] = \"/home/bart/Downloads/STEMMUS_SCOPE\""
]
},
{
Expand All @@ -58,7 +59,7 @@
"metadata": {},
"outputs": [],
"source": [
"from PyStemmusScope.bmi import StemmusScopeBmi\n",
"from PyStemmusScope.bmi.implementation import StemmusScopeBmi\n",
"from cftime import num2pydate\n",
"from rich import print\n",
"import numpy as np\n",
Expand Down Expand Up @@ -157,7 +158,7 @@
},
{
"cell_type": "code",
"execution_count": 6,
"execution_count": 7,
"metadata": {},
"outputs": [
{
Expand All @@ -166,7 +167,7 @@
"array([22.74423625])"
]
},
"execution_count": 6,
"execution_count": 7,
"metadata": {},
"output_type": "execute_result"
}
Expand All @@ -187,7 +188,7 @@
},
{
"cell_type": "code",
"execution_count": 7,
"execution_count": 8,
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -221,7 +222,7 @@
},
{
"cell_type": "code",
"execution_count": 8,
"execution_count": 9,
"metadata": {},
"outputs": [],
"source": [
Expand Down Expand Up @@ -254,7 +255,7 @@
},
{
"cell_type": "code",
"execution_count": 9,
"execution_count": 10,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -271,16 +272,16 @@
},
{
"cell_type": "code",
"execution_count": 10,
"execution_count": 11,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"<matplotlib.collections.QuadMesh at 0x7fe86f0ab190>"
"<matplotlib.collections.QuadMesh at 0x7f881ab5f010>"
]
},
"execution_count": 10,
"execution_count": 11,
"metadata": {},
"output_type": "execute_result"
},
Expand Down Expand Up @@ -308,7 +309,7 @@
},
{
"cell_type": "code",
"execution_count": 11,
"execution_count": 6,
"metadata": {},
"outputs": [],
"source": [
Expand Down

0 comments on commit 71c06aa

Please sign in to comment.