|
23 | 23 | " - config file template: https://github.com/EcoExtreML/STEMMUS_SCOPE/blob/main/config_file_crib.txt\n", |
24 | 24 | "- Global data:\n", |
25 | 25 | " - 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", |
27 | 27 | "\n", |
28 | 28 | "#### On Snellius\n", |
29 | 29 | "- Site data:\n", |
|
35 | 35 | "\n", |
36 | 36 | "Choose how do you want to run the model:\n", |
37 | 37 | "\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", |
41 | 39 | "\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" |
45 | 42 | ] |
46 | 43 | }, |
47 | 44 | { |
48 | 45 | "attachments": {}, |
49 | 46 | "cell_type": "markdown", |
50 | 47 | "metadata": {}, |
51 | 48 | "source": [ |
52 | | - "## 1. Using site data" |
| 49 | + "## Using site data" |
53 | 50 | ] |
54 | 51 | }, |
55 | 52 | { |
|
96 | 93 | ], |
97 | 94 | "source": [ |
98 | 95 | "# # 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'])" |
108 | 105 | ] |
109 | 106 | }, |
110 | 107 | { |
|
196 | 193 | "cell_type": "markdown", |
197 | 194 | "metadata": {}, |
198 | 195 | "source": [ |
199 | | - "## 2. Using global data" |
| 196 | + "## Using global data" |
200 | 197 | ] |
201 | 198 | }, |
202 | 199 | { |
203 | 200 | "cell_type": "code", |
204 | | - "execution_count": 1, |
| 201 | + "execution_count": 6, |
205 | 202 | "metadata": {}, |
206 | 203 | "outputs": [], |
207 | 204 | "source": [ |
|
212 | 209 | }, |
213 | 210 | { |
214 | 211 | "cell_type": "code", |
215 | | - "execution_count": null, |
| 212 | + "execution_count": 7, |
216 | 213 | "metadata": {}, |
217 | 214 | "outputs": [], |
218 | 215 | "source": [ |
219 | 216 | "# user must provide the correct path\n", |
220 | 217 | "path_to_config_file = \"./my_config_template_global.txt\"\n", |
221 | | - "path_to_model_src = \"./STEMMUS_SCOPE\"" |
| 218 | + "path_to_exe_file = \"./STEMMUS_SCOPE\"" |
222 | 219 | ] |
223 | 220 | }, |
224 | 221 | { |
|
230 | 227 | }, |
231 | 228 | { |
232 | 229 | "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, |
262 | 231 | "metadata": {}, |
263 | 232 | "outputs": [ |
264 | 233 | { |
265 | 234 | "name": "stdout", |
266 | 235 | "output_type": "stream", |
267 | 236 | "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" |
271 | 238 | ] |
272 | 239 | } |
273 | 240 | ], |
274 | 241 | "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'])" |
344 | 252 | ] |
345 | 253 | }, |
346 | 254 | { |
347 | 255 | "cell_type": "code", |
348 | | - "execution_count": 3, |
| 256 | + "execution_count": 9, |
349 | 257 | "metadata": {}, |
350 | 258 | "outputs": [], |
351 | 259 | "source": [ |
352 | 260 | "# 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)" |
354 | 262 | ] |
355 | 263 | }, |
356 | 264 | { |
357 | 265 | "cell_type": "code", |
358 | | - "execution_count": 4, |
| 266 | + "execution_count": 10, |
359 | 267 | "metadata": {}, |
360 | 268 | "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 | + }, |
361 | 283 | { |
362 | 284 | "name": "stdout", |
363 | 285 | "output_type": "stream", |
364 | 286 | "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" |
368 | 290 | ] |
369 | 291 | } |
370 | 292 | ], |
371 | 293 | "source": [ |
372 | 294 | "# setup the model\n", |
373 | | - "# here you can change the location and start & end time\n", |
374 | 295 | "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", |
378 | 299 | ")\n", |
379 | 300 | "\n", |
380 | 301 | "# new config file genertaed to run the model \n", |
|
387 | 308 | }, |
388 | 309 | { |
389 | 310 | "cell_type": "code", |
390 | | - "execution_count": 5, |
| 311 | + "execution_count": null, |
391 | 312 | "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": [], |
403 | 314 | "source": [ |
404 | 315 | "# run the model\n", |
405 | 316 | "result = model.run()\n", |
|
408 | 319 | }, |
409 | 320 | { |
410 | 321 | "cell_type": "code", |
411 | | - "execution_count": 6, |
| 322 | + "execution_count": null, |
412 | 323 | "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": [], |
422 | 325 | "source": [ |
423 | 326 | "# 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", |
425 | 328 | "nc_file_name = save.to_netcdf(config_path, required_netcdf_variables)\n", |
426 | 329 | "print(nc_file_name)" |
427 | 330 | ] |
|
0 commit comments