Skip to content

Commit a0824c2

Browse files
committed
Made Sarah's suggested modifications to the notebooks
1 parent 2ca3454 commit a0824c2

4 files changed

Lines changed: 17 additions & 14 deletions

File tree

PyStemmusScope/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
import logging
33
from .iostreamer import create_io_dir
44
from .iostreamer import read_config
5-
5+
from . import iostreamer
6+
from . import forcing_io
67

78
logging.getLogger(__name__).addHandler(logging.NullHandler())
89

notebooks/run_model_in_notebook.ipynb

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@
1717
"import os\n",
1818
"from pathlib import Path\n",
1919
"import subprocess\n",
20-
"import PyStemmusScope"
20+
"from PyStemmusScope import forcing_io\n",
21+
"from PyStemmusScope import iostreamer"
2122
]
2223
},
2324
{
@@ -46,7 +47,7 @@
4647
"# path to config file\n",
4748
"path_to_config_file = \"path_to_config_file\"\n",
4849
"# Instantiate working directories handler from PyStemmusScope\n",
49-
"config_template = PyStemmusScope.read_config(path_to_config_file)"
50+
"config_template = iostreamer.read_config(path_to_config_file)"
5051
]
5152
},
5253
{
@@ -151,11 +152,11 @@
151152
"config_path_dict = {}\n",
152153
"input_dir_dict = {}\n",
153154
"for nc_file in forcing_filenames_list:\n",
154-
" input_dir, output_dir, config_path = PyStemmusScope.create_io_dir(nc_file, config_template)\n",
155+
" input_dir, output_dir, config_path = iostreamer.create_io_dir(nc_file, config_template)\n",
155156
" config_path_dict[nc_file] = config_path\n",
156157
" input_dir_dict[nc_file] = input_dir\n",
157158
" \n",
158-
" config_run = PyStemmusScope.read_config(config_path)\n",
159+
" config_run = iostreamer.read_config(config_path)\n",
159160
"\n",
160161
" forcing_io.prepare_forcing(input_dir, Path(config_run[\"ForcingPath\"]) / nc_file, config_run)\n",
161162
" \n",

notebooks/run_model_in_notebook_dev.ipynb

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@
1717
"import os\n",
1818
"from pathlib import Path\n",
1919
"import subprocess\n",
20-
"import PyStemmusScope"
20+
"from PyStemmusScope import forcing_io \n",
21+
"from PyStemmusScope import iostreamer"
2122
]
2223
},
2324
{
@@ -98,7 +99,7 @@
9899
"# path to config file\n",
99100
"path_to_config_file = \"path_to_config_file\"\n",
100101
"# Instantiate working directories handler from PyStemmusScope\n",
101-
"config_template = PyStemmusScope.read_config(path_to_config_file)"
102+
"config_template = iostreamer.read_config(path_to_config_file)"
102103
]
103104
},
104105
{
@@ -192,7 +193,7 @@
192193
"source": [
193194
"# specify the forcing filename\n",
194195
"forcing_filename = config_template[\"ForcingFileName\"]\n",
195-
"input_dir, output_dir, config_run_path = PyStemmusScope.create_io_dir(forcing_filename, config_template)\n",
196+
"input_dir, output_dir, config_run_path = iostreamer.create_io_dir(forcing_filename, config_template)\n",
196197
"print(input_dir, output_dir, config_run_path)"
197198
]
198199
},
@@ -202,7 +203,7 @@
202203
"metadata": {},
203204
"outputs": [],
204205
"source": [
205-
"config_run = PyStemmusScope.read_config(config_run_path)\n",
206+
"config_run = iostreamer.read_config(config_run_path)\n",
206207
"# Generate the forcing input data for STEMMUS_SCOPE\n",
207208
"forcing_io.prepare_forcing(input_dir, Path(config_run[\"ForcingPath\"]) / forcing_filename, config_run)"
208209
]

notebooks/verify_model_modifications.ipynb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@
1919
"import subprocess\n",
2020
"import numpy as np\n",
2121
"import matplotlib.pyplot as plt\n",
22-
"import PyStemmusScope\n",
2322
"import xarray as xr\n",
24-
"from PyStemmusScope import forcing_io"
23+
"from PyStemmusScope import forcing_io\n",
24+
"from PyStemmusScope import iostreamer"
2525
]
2626
},
2727
{
@@ -58,7 +58,7 @@
5858
"# path to config file\n",
5959
"path_to_config_template_file = path_to_model + \"/config_file_snellius.txt\"\n",
6060
"# Instantiate working directories handler from PyStemmusScope\n",
61-
"config_template = PyStemmusScope.read_config(path_to_config_template_file)"
61+
"config_template = iostreamer.read_config(path_to_config_template_file)"
6262
]
6363
},
6464
{
@@ -99,9 +99,9 @@
9999
"source": [
100100
"# Specify the forcing filename\n",
101101
"forcing_filename = config_template[\"ForcingFileName\"]\n",
102-
"input_dir, output_dir, config_run_path = PyStemmusScope.create_io_dir(forcing_filename, config_template)\n",
102+
"input_dir, output_dir, config_run_path = iostreamer.create_io_dir(forcing_filename, config_template)\n",
103103
"\n",
104-
"run_config = PyStemmusScope.read_config(config_run_path)\n",
104+
"run_config = iostreamer.read_config(config_run_path)\n",
105105
"# Prepare the forcing data\n",
106106
"forcing_io.prepare_forcing(input_dir, Path(run_config[\"ForcingPath\"]) / forcing_filename, run_config)"
107107
]

0 commit comments

Comments
 (0)