Skip to content

Commit 4e14e7e

Browse files
committed
add a comment and minor edits
1 parent eebe6a7 commit 4e14e7e

1 file changed

Lines changed: 29 additions & 39 deletions

File tree

notebooks/run_model_in_notebook.ipynb

Lines changed: 29 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,23 @@
2222
"import time"
2323
]
2424
},
25+
{
26+
"cell_type": "markdown",
27+
"metadata": {},
28+
"source": [
29+
"#### Path to STEMMUS_SCOPE\n",
30+
"\n",
31+
"STEMMUS_SCOPE executable file is located in the **private** repository on GitHub https://github.com/EcoExtreML/STEMMUS_SCOPE. You need to clone the repository locally and specify the path to it in the cell below. Make sure you have right access to the repository. "
32+
]
33+
},
2534
{
2635
"cell_type": "code",
2736
"execution_count": 2,
2837
"metadata": {},
2938
"outputs": [],
3039
"source": [
3140
"# path to executable\n",
32-
"root_path_to_model = Path(Path.home(), \"STEMMUS_SCOPE\")"
41+
"path_to_model = Path(\"path_to_STEMMUS_SCOPE_repository\")"
3342
]
3443
},
3544
{
@@ -41,13 +50,13 @@
4150
},
4251
{
4352
"cell_type": "code",
44-
"execution_count": 15,
53+
"execution_count": 5,
4554
"metadata": {},
4655
"outputs": [],
4756
"source": [
4857
"# the user must provide the correct path\n",
4958
"# path to config file\n",
50-
"config_file_path = root_path_to_model / \"config_file_snellius.txt\"\n",
59+
"config_file_path = path_to_model / \"config_file_snellius.txt\"\n",
5160
"# create an empty dict\n",
5261
"config = {}\n",
5362
"with open(config_file_path, \"r\") as f:\n",
@@ -58,7 +67,7 @@
5867
},
5968
{
6069
"cell_type": "code",
61-
"execution_count": 16,
70+
"execution_count": 6,
6271
"metadata": {},
6372
"outputs": [
6473
{
@@ -73,7 +82,7 @@
7382
" 'DurationSize': '17520'}"
7483
]
7584
},
76-
"execution_count": 16,
85+
"execution_count": 6,
7786
"metadata": {},
7887
"output_type": "execute_result"
7988
}
@@ -84,22 +93,22 @@
8493
},
8594
{
8695
"cell_type": "code",
87-
"execution_count": 17,
96+
"execution_count": 10,
8897
"metadata": {},
8998
"outputs": [
9099
{
91100
"data": {
92101
"text/plain": [
93-
"{'SoilPropertyPath': '/projects/0/einf2480/model_parameters/soil_property/',\n",
94-
" 'InputPath': '/scratch-shared/ecoextreml/stemmus_scope/input/',\n",
95-
" 'OutputPath': '/scratch-shared/ecoextreml/stemmus_scope/output/',\n",
96-
" 'ForcingPath': '/projects/0/einf2480/forcing/plumber2_data/',\n",
102+
"{'SoilPropertyPath': '/home/sarah/temp/ecoextreml/data/model_parameters/soil_property/',\n",
103+
" 'InputPath': '/home/sarah/temp/ecoextreml/input/',\n",
104+
" 'OutputPath': '/home/sarah/temp/ecoextreml/output/',\n",
105+
" 'ForcingPath': '/home/sarah/temp/ecoextreml/data/forcing/plumber2_data/',\n",
97106
" 'ForcingFileName': 'FI-Hyy_1996-2014_FLUXNET2015_Met.nc',\n",
98-
" 'VegetationPropertyPath': '/projects/0/einf2480/model_parameters/vegetation_property/',\n",
107+
" 'VegetationPropertyPath': '/home/sarah/temp/ecoextreml/data/model_parameters/vegetation_property/',\n",
99108
" 'DurationSize': '20'}"
100109
]
101110
},
102-
"execution_count": 17,
111+
"execution_count": 10,
103112
"metadata": {},
104113
"output_type": "execute_result"
105114
}
@@ -119,7 +128,7 @@
119128
},
120129
{
121130
"cell_type": "code",
122-
"execution_count": 21,
131+
"execution_count": 11,
123132
"metadata": {},
124133
"outputs": [],
125134
"source": [
@@ -152,15 +161,15 @@
152161
},
153162
{
154163
"cell_type": "code",
155-
"execution_count": 22,
164+
"execution_count": 19,
156165
"metadata": {},
157166
"outputs": [
158167
{
159168
"name": "stdout",
160169
"output_type": "stream",
161170
"text": [
162-
"Prepare work directory /scratch-shared/ecoextreml/stemmus_scope/input/NL-Hor_20220511_1608 for the station: NL-Hor\n",
163-
"Prepare work directory /scratch-shared/ecoextreml/stemmus_scope/input/ZA-Kru_20220511_1608 for the station: ZA-Kru\n"
171+
"Prepare work directory /home/sarah/temp/ecoextreml/input/NL-Hor_20220513_1256 for the station: NL-Hor\n",
172+
"Prepare work directory /home/sarah/temp/ecoextreml/input/ZA-Kru_20220513_1256 for the station: ZA-Kru\n"
164173
]
165174
}
166175
],
@@ -190,38 +199,19 @@
190199
},
191200
{
192201
"cell_type": "code",
193-
"execution_count": 24,
202+
"execution_count": null,
194203
"metadata": {},
195-
"outputs": [
196-
{
197-
"name": "stdout",
198-
"output_type": "stream",
199-
"text": [
200-
"Run STEMMUS-SCOPE with the forcing: NL-Hor_2008-2011_FLUXNET2015_Met.nc\n",
201-
"Opening log file: /scratch-shared/ecoextreml/stemmus_scope/input/NL-Hor_20220511_1608/java.log.8335\n",
202-
"Reading config from /scratch-shared/ecoextreml/stemmus_scope/input/NL-Hor_20220511_1608/NL-Hor_20220511_1608_config.txt\n",
203-
"\n",
204-
" The calculations start now \n",
205-
"Run STEMMUS-SCOPE with the forcing: ZA-Kru_2000-2002_FLUXNET2015_Met.nc\n",
206-
"Opening log file: /scratch-shared/ecoextreml/stemmus_scope/input/ZA-Kru_20220511_1608/java.log.9161\n",
207-
"Reading config from /scratch-shared/ecoextreml/stemmus_scope/input/ZA-Kru_20220511_1608/ZA-Kru_20220511_1608_config.txt\n",
208-
"\n",
209-
" The calculations start now \n",
210-
" The calculations end now \r"
211-
]
212-
}
213-
],
204+
"outputs": [],
214205
"source": [
215206
"# generate a text file\n",
216-
"root_path = Path().resolve().parent\n",
217207
"str.split(\"/\")[-1]\n",
218208
"for ncfile in forcing_filenames_list:\n",
219209
" path_to_config = config_path_dict[ncfile]\n",
220210
" # set matlab log dir to slurm, otherwise java.log files are created in user home dir\n",
221211
" os.environ['MATLAB_LOG_DIR'] = str(work_dir_dict[ncfile])\n",
222212
" # run the model\n",
223213
" print(f\"Run STEMMUS-SCOPE with the forcing: {ncfile}\")\n",
224-
" result = subprocess.run([f\"exe/STEMMUS_SCOPE {path_to_config}\"], cwd = root_path_to_model, shell=True)\n",
214+
" result = subprocess.run([f\"exe/STEMMUS_SCOPE {path_to_config}\"], cwd = path_to_model, shell=True)\n",
225215
" result.check_returncode()"
226216
]
227217
},
@@ -268,7 +258,7 @@
268258
],
269259
"source": [
270260
"# convert csv files to nc files\n",
271-
"path_to_utils = Path(root_path_to_model, \"utils/csv_to_nc\")\n",
261+
"path_to_utils = Path(path_to_model, \"utils/csv_to_nc\")\n",
272262
"for ncfile in forcing_filenames_list:\n",
273263
" path_to_config = config_path_dict[ncfile]\n",
274264
" result = subprocess.run([\"python\", Path(path_to_utils, \"generate_netcdf_files.py\"),\n",

0 commit comments

Comments
 (0)