Skip to content

Commit 93208ea

Browse files
committed
fix text in notebooks
1 parent 9a38579 commit 93208ea

2 files changed

Lines changed: 61 additions & 158 deletions

File tree

docs/notebooks/run_model_with_different_dataset.ipynb

Lines changed: 58 additions & 155 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
" - config file template: https://github.com/EcoExtreML/STEMMUS_SCOPE/blob/main/config_file_crib.txt\n",
2424
"- Global data:\n",
2525
" - path to data `/data/shared/EcoExtreML/STEMMUS_SCOPEv1.0.0/global_data`,\n",
26-
" - config file template: https://github.com/EcoExtreML/STEMMUS_SCOPE/blob/main/run_model_on_snellius/config_file_snellius_global.txt\n",
26+
" - config file template: https://github.com/EcoExtreML/STEMMUS_SCOPE/blob/main/run_model_on_snellius/config_file_crib_global.txt\n",
2727
"\n",
2828
"#### On Snellius\n",
2929
"- Site data:\n",
@@ -35,21 +35,18 @@
3535
"\n",
3636
"Choose how do you want to run the model:\n",
3737
"\n",
38-
"[**Using site data**](#1-using-site-data)\n",
39-
"\n",
40-
"  If MATLAB Runtime is installed on a Unix-like system, you can run STEMMUS_SCOPE using the executable file, for example on Snellius or WSL.\n",
38+
"[**Using site data**](#using-site-data)\n",
4139
"\n",
42-
"[**Uisng global data**](#2-using-global-data)\n",
43-
"\n",
44-
"  If MATLAB Runtime is installed on a Unix-like system, you can run STEMMUS_SCOPE using the executable file, for example on Snellius or WSL.\n"
40+
"[**Using global data**](#using-global-data)\n",
41+
"\n"
4542
]
4643
},
4744
{
4845
"attachments": {},
4946
"cell_type": "markdown",
5047
"metadata": {},
5148
"source": [
52-
"## 1. Using site data"
49+
"## Using site data"
5350
]
5451
},
5552
{
@@ -96,15 +93,15 @@
9693
],
9794
"source": [
9895
"# # Set LD_LIBRARY_PATH\n",
99-
"matlab_path = !whereis MATLAB\n",
100-
"matlab_path = matlab_path.s.split(\": \")[1]\n",
101-
"os.environ['LD_LIBRARY_PATH'] = (\n",
102-
" f\"{matlab_path}/MATLAB_Runtime/R2023a/runtime/glnxa64:\"\n",
103-
" f\"{matlab_path}/MATLAB_Runtime/R2023a/bin/glnxa64:\"\n",
104-
" f\"{matlab_path}/MATLAB_Runtime/R2023a/sys/os/glnxa64:\"\n",
105-
" f\"{matlab_path}/MATLAB_Runtime/R2023a/extern/bin/glnxa64:\"\n",
106-
" f\"{matlab_path}/MATLAB_Runtime/R2023a/sys/opengl/lib/glnxa64\")\n",
107-
"print(os.environ['LD_LIBRARY_PATH'])"
96+
"# matlab_path = !whereis MATLAB\n",
97+
"# matlab_path = matlab_path.s.split(\": \")[1]\n",
98+
"# os.environ['LD_LIBRARY_PATH'] = (\n",
99+
"# f\"{matlab_path}/MATLAB_Runtime/R2023a/runtime/glnxa64:\"\n",
100+
"# f\"{matlab_path}/MATLAB_Runtime/R2023a/bin/glnxa64:\"\n",
101+
"# f\"{matlab_path}/MATLAB_Runtime/R2023a/sys/os/glnxa64:\"\n",
102+
"# f\"{matlab_path}/MATLAB_Runtime/R2023a/extern/bin/glnxa64:\"\n",
103+
"# f\"{matlab_path}/MATLAB_Runtime/R2023a/sys/opengl/lib/glnxa64\")\n",
104+
"# print(os.environ['LD_LIBRARY_PATH'])"
108105
]
109106
},
110107
{
@@ -196,12 +193,12 @@
196193
"cell_type": "markdown",
197194
"metadata": {},
198195
"source": [
199-
"## 2. Using global data"
196+
"## Using global data"
200197
]
201198
},
202199
{
203200
"cell_type": "code",
204-
"execution_count": 1,
201+
"execution_count": 6,
205202
"metadata": {},
206203
"outputs": [],
207204
"source": [
@@ -212,13 +209,13 @@
212209
},
213210
{
214211
"cell_type": "code",
215-
"execution_count": null,
212+
"execution_count": 7,
216213
"metadata": {},
217214
"outputs": [],
218215
"source": [
219216
"# user must provide the correct path\n",
220217
"path_to_config_file = \"./my_config_template_global.txt\"\n",
221-
"path_to_model_src = \"./STEMMUS_SCOPE\""
218+
"path_to_exe_file = \"./STEMMUS_SCOPE\""
222219
]
223220
},
224221
{
@@ -230,151 +227,75 @@
230227
},
231228
{
232229
"cell_type": "code",
233-
"execution_count": null,
234-
"metadata": {},
235-
"outputs": [],
236-
"source": [
237-
"# # Set LD_LIBRARY_PATH\n",
238-
"matlab_path = !whereis MATLAB\n",
239-
"matlab_path = matlab_path.s.split(\": \")[1]\n",
240-
"os.environ['LD_LIBRARY_PATH'] = (\n",
241-
" f\"{matlab_path}/MATLAB_Runtime/R2023a/runtime/glnxa64:\"\n",
242-
" f\"{matlab_path}/MATLAB_Runtime/R2023a/bin/glnxa64:\"\n",
243-
" f\"{matlab_path}/MATLAB_Runtime/R2023a/sys/os/glnxa64:\"\n",
244-
" f\"{matlab_path}/MATLAB_Runtime/R2023a/extern/bin/glnxa64:\"\n",
245-
" f\"{matlab_path}/MATLAB_Runtime/R2023a/sys/opengl/lib/glnxa64\")\n",
246-
"print(os.environ['LD_LIBRARY_PATH'])"
247-
]
248-
},
249-
{
250-
"cell_type": "code",
251-
"execution_count": 5,
252-
"metadata": {},
253-
"outputs": [],
254-
"source": [
255-
"# create an an instance of the model\n",
256-
"model = StemmusScope(config_file=path_to_config_file, model_src_path=path_to_exe_file)"
257-
]
258-
},
259-
{
260-
"cell_type": "code",
261-
"execution_count": 6,
230+
"execution_count": 8,
262231
"metadata": {},
263232
"outputs": [
264233
{
265234
"name": "stdout",
266235
"output_type": "stream",
267236
"text": [
268-
"New config file /gpfs/home2/alidoost/test_matlab/input/ZA-Kru_2022-10-27-1651/ZA-Kru_2022-10-27-1651_config.txt\n",
269-
"Model input dir /gpfs/home2/alidoost/test_matlab/input/ZA-Kru_2022-10-27-1651/\n",
270-
"Model output dir /gpfs/home2/alidoost/test_matlab/output/ZA-Kru_2022-10-27-1651/\n"
237+
"/usr/local/MATLAB/MATLAB_Runtime/R2023a/runtime/glnxa64:/usr/local/MATLAB/MATLAB_Runtime/R2023a/bin/glnxa64:/usr/local/MATLAB/MATLAB_Runtime/R2023a/sys/os/glnxa64:/usr/local/MATLAB/MATLAB_Runtime/R2023a/extern/bin/glnxa64:/usr/local/MATLAB/MATLAB_Runtime/R2023a/sys/opengl/lib/glnxa64\n"
271238
]
272239
}
273240
],
274241
"source": [
275-
"# setup the model\n",
276-
"config_path = model.setup(\n",
277-
" Location=(61.8474, 24.2948),\n",
278-
" StartTime=\"2001-01-01T00:00\",\n",
279-
" EndTime=\"2001-01-02T01:30\",\n",
280-
")\n",
281-
"\n",
282-
"# new config file genertaed to run the model \n",
283-
"print(f\"New config file {config_path}\")\n",
284-
"\n",
285-
"# see input and output paths generated by the model\n",
286-
"print(f'Model input dir {model.config[\"InputPath\"]}')\n",
287-
"print(f'Model output dir {model.config[\"OutputPath\"]}')"
288-
]
289-
},
290-
{
291-
"cell_type": "code",
292-
"execution_count": 7,
293-
"metadata": {},
294-
"outputs": [
295-
{
296-
"data": {
297-
"text/plain": [
298-
"b'MATLAB is selecting SOFTWARE OPENGL rendering.\\nOpening log file: /home/alidoost/java.log.37351\\n\\n < M A T L A B (R) >\\n Copyright 1984-2021 The MathWorks, Inc.\\n R2021a Update 3 (9.10.0.1684407) 64-bit (glnxa64)\\n May 27, 2021\\n\\n \\nTo get started, type doc.\\nFor product information, visit www.mathworks.com.\\n \\nReading config from /gpfs/home2/alidoost/test_matlab/input/ZA-Kru_2022-10-27-1651/ZA-Kru_2022-10-27-1651_config.txt\\nThe calculations start now\\nThe calculations end now\\n'"
299-
]
300-
},
301-
"execution_count": 7,
302-
"metadata": {},
303-
"output_type": "execute_result"
304-
}
305-
],
306-
"source": [
307-
"# run the model\n",
308-
"result = model.run()\n",
309-
"result"
310-
]
311-
},
312-
{
313-
"cell_type": "code",
314-
"execution_count": null,
315-
"metadata": {},
316-
"outputs": [],
317-
"source": [
318-
"# save output in netcdf format\n",
319-
"required_netcdf_variables = \"./required_netcdf_variables.csv\"\n",
320-
"nc_file_name = save.to_netcdf(config_path, required_netcdf_variables)\n",
321-
"print(nc_file_name)"
322-
]
323-
},
324-
{
325-
"cell_type": "code",
326-
"execution_count": 1,
327-
"metadata": {},
328-
"outputs": [],
329-
"source": [
330-
"import os\n",
331-
"from PyStemmusScope import StemmusScope\n",
332-
"from PyStemmusScope import save"
333-
]
334-
},
335-
{
336-
"cell_type": "code",
337-
"execution_count": 2,
338-
"metadata": {},
339-
"outputs": [],
340-
"source": [
341-
"# user must provide the correct path\n",
342-
"path_to_config_file = \"~/my_config_template.txt\"\n",
343-
"path_to_model_src = \"~/STEMMUS_SCOPE/src\""
242+
"# # Set LD_LIBRARY_PATH\n",
243+
"# matlab_path = !whereis MATLAB\n",
244+
"# matlab_path = matlab_path.s.split(\": \")[1]\n",
245+
"# os.environ['LD_LIBRARY_PATH'] = (\n",
246+
"# f\"{matlab_path}/MATLAB_Runtime/R2023a/runtime/glnxa64:\"\n",
247+
"# f\"{matlab_path}/MATLAB_Runtime/R2023a/bin/glnxa64:\"\n",
248+
"# f\"{matlab_path}/MATLAB_Runtime/R2023a/sys/os/glnxa64:\"\n",
249+
"# f\"{matlab_path}/MATLAB_Runtime/R2023a/extern/bin/glnxa64:\"\n",
250+
"# f\"{matlab_path}/MATLAB_Runtime/R2023a/sys/opengl/lib/glnxa64\")\n",
251+
"# print(os.environ['LD_LIBRARY_PATH'])"
344252
]
345253
},
346254
{
347255
"cell_type": "code",
348-
"execution_count": 3,
256+
"execution_count": 9,
349257
"metadata": {},
350258
"outputs": [],
351259
"source": [
352260
"# create an an instance of the model\n",
353-
"model = StemmusScope(config_file=path_to_config_file, model_src_path=path_to_model_src, interpreter=\"Octave\")"
261+
"model = StemmusScope(config_file=path_to_config_file, model_src_path=path_to_exe_file)"
354262
]
355263
},
356264
{
357265
"cell_type": "code",
358-
"execution_count": 4,
266+
"execution_count": 10,
359267
"metadata": {},
360268
"outputs": [
269+
{
270+
"name": "stderr",
271+
"output_type": "stream",
272+
"text": [
273+
"/home/sarah/miniconda3/envs/pystemmusscope/lib/python3.10/site-packages/dask/array/core.py:4836: PerformanceWarning: Increasing number of chunks by factor of 16\n",
274+
" result = blockwise(\n",
275+
"/home/sarah/miniconda3/envs/pystemmusscope/lib/python3.10/site-packages/dask/array/core.py:4836: PerformanceWarning: Increasing number of chunks by factor of 16\n",
276+
" result = blockwise(\n",
277+
"/home/sarah/miniconda3/envs/pystemmusscope/lib/python3.10/site-packages/dask/array/core.py:4836: PerformanceWarning: Increasing number of chunks by factor of 16\n",
278+
" result = blockwise(\n",
279+
"/home/sarah/miniconda3/envs/pystemmusscope/lib/python3.10/site-packages/dask/array/core.py:4836: PerformanceWarning: Increasing number of chunks by factor of 16\n",
280+
" result = blockwise(\n"
281+
]
282+
},
361283
{
362284
"name": "stdout",
363285
"output_type": "stream",
364286
"text": [
365-
"New config file /data/private/Sarah/test_run/input/ZA-Kru_2022-10-28-1159/ZA-Kru_2022-10-28-1159_config.txt\n",
366-
"Model input dir /data/private/Sarah/test_run/input/ZA-Kru_2022-10-28-1159/\n",
367-
"Model output dir /data/private/Sarah/test_run/output/ZA-Kru_2022-10-28-1159/\n"
287+
"New config file /home/sarah/temp/ecoextreml/test/input/global_N61-847_E24-295_2024-02-02-1620/global_2024-02-02-1620_config.txt\n",
288+
"Model input dir /home/sarah/temp/ecoextreml/test/input/global_N61-847_E24-295_2024-02-02-1620/\n",
289+
"Model output dir /home/sarah/temp/ecoextreml/test/output/global_N61-847_E24-295_2024-02-02-1620/\n"
368290
]
369291
}
370292
],
371293
"source": [
372294
"# setup the model\n",
373-
"# here you can change the location and start & end time\n",
374295
"config_path = model.setup(\n",
375-
" Location=\"ZA-Kru\",\n",
376-
" StartTime=\"2001-01-01T00:00\",\n",
377-
" EndTime=\"2001-01-02T01:30\",\n",
296+
" Location=\"(61.8474, 24.2948)\",\n",
297+
" StartTime=\"2014-01-10T00:00\",\n",
298+
" EndTime=\"2014-01-15T00:00\",\n",
378299
")\n",
379300
"\n",
380301
"# new config file genertaed to run the model \n",
@@ -387,19 +308,9 @@
387308
},
388309
{
389310
"cell_type": "code",
390-
"execution_count": 5,
311+
"execution_count": null,
391312
"metadata": {},
392-
"outputs": [
393-
{
394-
"name": "stdout",
395-
"output_type": "stream",
396-
"text": [
397-
"Reading config from /data/private/Sarah/test_run/input/ZA-Kru_2022-10-28-1159/ZA-Kru_2022-10-28-1159_config.txt\n",
398-
"The calculations start now\n",
399-
"The calculations end now\n"
400-
]
401-
}
402-
],
313+
"outputs": [],
403314
"source": [
404315
"# run the model\n",
405316
"result = model.run()\n",
@@ -408,20 +319,12 @@
408319
},
409320
{
410321
"cell_type": "code",
411-
"execution_count": 6,
322+
"execution_count": null,
412323
"metadata": {},
413-
"outputs": [
414-
{
415-
"name": "stdout",
416-
"output_type": "stream",
417-
"text": [
418-
"/data/private/Sarah/test_run/output/ZA-Kru_2022-10-28-1159/ZA-Kru_2022-10-28-1159_STEMMUS_SCOPE.nc\n"
419-
]
420-
}
421-
],
324+
"outputs": [],
422325
"source": [
423326
"# save output in netcdf format\n",
424-
"required_netcdf_variables = \"~/STEMMUS_SCOPE/utils/csv_to_nc/required_netcdf_variables.csv\"\n",
327+
"required_netcdf_variables = \"./required_netcdf_variables.csv\"\n",
425328
"nc_file_name = save.to_netcdf(config_path, required_netcdf_variables)\n",
426329
"print(nc_file_name)"
427330
]

docs/notebooks/run_model_with_different_dataset_on_CRIB.ipynb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
"\n",
3737
"[**Using site data**](#1-using-site-data)\n",
3838
"\n",
39-
"[**Uisng global data**](#2-using-global-data)\n",
39+
"[**Using global data**](#2-using-global-data)\n",
4040
"\n"
4141
]
4242
},
@@ -318,7 +318,7 @@
318318
],
319319
"metadata": {
320320
"kernelspec": {
321-
"display_name": "Python",
321+
"display_name": "Python 3 (ipykernel)",
322322
"language": "python",
323323
"name": "python3"
324324
},
@@ -332,7 +332,7 @@
332332
"name": "python",
333333
"nbconvert_exporter": "python",
334334
"pygments_lexer": "ipython3",
335-
"version": "3.8.10"
335+
"version": "3.10.13"
336336
},
337337
"vscode": {
338338
"interpreter": {

0 commit comments

Comments
 (0)