|
15 | 15 | "metadata": {}, |
16 | 16 | "outputs": [], |
17 | 17 | "source": [ |
18 | | - "import os\n", |
19 | 18 | "import pickle\n", |
20 | 19 | "import random\n", |
21 | 20 | "from importlib.resources import files\n", |
22 | 21 | "from pathlib import Path\n", |
23 | 22 | "\n", |
24 | | - "import matplotlib.pyplot as plt\n", |
25 | 23 | "import numpy as np\n", |
26 | 24 | "import pandas as pd\n", |
27 | 25 | "\n", |
|
30 | 28 | ")\n", |
31 | 29 | "from nemo_spinup_forecast.forecast import Predictions, Simulation, load_ts\n", |
32 | 30 | "from nemo_spinup_forecast.forecast_method import forecast_techniques\n", |
33 | | - "from nemo_spinup_forecast.utils import (\n", |
34 | | - " create_run_dir,\n", |
35 | | - " get_dr_technique,\n", |
36 | | - " get_forecast_technique,\n", |
37 | | - " get_ocean_term,\n", |
38 | | - ")\n", |
39 | | - "\n", |
40 | 31 | "from nemo_spinup_forecast.plotting_utils import (\n", |
41 | 32 | " plot_bar_with_errors,\n", |
42 | 33 | " plot_component_timeseries,\n", |
|
48 | 39 | " plot_rmse_depth_profile,\n", |
49 | 40 | " plot_rmse_maps,\n", |
50 | 41 | " plot_simulation_snapshots,\n", |
| 42 | + ")\n", |
| 43 | + "from nemo_spinup_forecast.utils import (\n", |
| 44 | + " create_run_dir,\n", |
| 45 | + " get_dr_technique,\n", |
| 46 | + " get_forecast_technique,\n", |
| 47 | + " get_ocean_term,\n", |
51 | 48 | ")" |
52 | 49 | ] |
53 | 50 | }, |
|
198 | 195 | "simus = [simu_zos, simu_so, simu_thetao]\n", |
199 | 196 | "# names = [\"zos\",\"so\",\"thetao\"]\n", |
200 | 197 | "names = [ssh_term, so_term, thetao_term]\n", |
201 | | - "\n", |
| 198 | + "print(simu_so.simulation[0, 0], simu_so.simulation.shape, simu_so.simulation[0, 0].shape)\n", |
202 | 199 | "plot_simulation_snapshots(simus, names)" |
203 | 200 | ] |
204 | 201 | }, |
|
300 | 297 | "metadata": {}, |
301 | 298 | "outputs": [], |
302 | 299 | "source": [ |
303 | | - "rmseV_zos\n", |
304 | 300 | "values = [rmseV_zos, rmseV_so.T, rmseV_thetao.T]\n", |
305 | 301 | "maps = [rmseM_zos, rmseM_so, rmseM_thetao]\n", |
306 | 302 | "names = [ssh_term, so_term, thetao_term]\n", |
|
435 | 431 | "import random\n", |
436 | 432 | "\n", |
437 | 433 | "random.seed(100)\n", |
438 | | - "comp, train_len, steps = 1, len(ts_zos), steps\n", |
439 | | - "print(len(ts_zos))\n", |
| 434 | + "# steps unchanged\n", |
| 435 | + "comp, train_len = 1, len(ts_zos)\n", |
440 | 436 | "\n", |
441 | 437 | "hat_zos, std_zos, metrics_zos = ts_zos.forecast_single_series(comp, train_len, steps)\n", |
442 | 438 | "hat_so, std_so, metrics_so = ts_so.forecast_single_series(comp, train_len, steps)\n", |
443 | 439 | "hat_thetao, std_thetao, metrics_thetao = ts_thetao.forecast_single_series(\n", |
444 | 440 | " comp, train_len, steps\n", |
445 | 441 | ")\n", |
446 | | - "\n", |
| 442 | + "print(\"hat_zos shape:\", hat_zos.shape)\n", |
447 | 443 | "ts_zos.show(comp, hat_zos, std_zos, train_len)\n", |
448 | 444 | "ts_so.show(comp, hat_so, std_so, train_len, color=\"darkgreen\")\n", |
449 | 445 | "ts_thetao.show(comp, hat_thetao, std_thetao, train_len, color=\"darkred\")" |
|
479 | 475 | "outputs": [], |
480 | 476 | "source": [ |
481 | 477 | "n = np.shape(ts_zos.info[\"ts\"])[1]\n", |
482 | | - "predictions, n, info = hat_zos, n, ts_zos.info\n", |
| 478 | + "# n unchanged\n", |
| 479 | + "predictions, info = hat_zos, ts_zos.info\n", |
483 | 480 | "\n", |
484 | 481 | "predictions_zos = simu_zos.reconstruct(hat_zos, n, ts_zos.info)\n", |
485 | 482 | "\n", |
|
550 | 547 | }, |
551 | 548 | "outputs": [], |
552 | 549 | "source": [ |
553 | | - "import matplotlib.pyplot as plt\n", |
554 | 550 | "import numpy as np\n", |
555 | 551 | "import xarray as xr\n", |
556 | 552 | "\n", |
|
581 | 577 | "id_, start2, end2 = \"106\", start, end + steps # start, end + steps\n", |
582 | 578 | "\n", |
583 | 579 | "\n", |
584 | | - "ye = False\n", |
| 580 | + "ye = True\n", |
585 | 581 | "\n", |
586 | 582 | "ref_zos = Simulation(\n", |
587 | 583 | " path=data_path,\n", |
|
656 | 652 | "source": [ |
657 | 653 | "print(ref_so.simulation[end:].shape)\n", |
658 | 654 | "\n", |
| 655 | + "print(\"pred_so shape:\")\n", |
| 656 | + "print(pred_so.shape)\n", |
| 657 | + "print(\"ref_so shape:\")\n", |
| 658 | + "print(ref_so.simulation.shape)\n", |
| 659 | + "\n", |
659 | 660 | "err_so = np.abs((ref_so.simulation - pred_so))\n", |
660 | 661 | "err_thetao = np.abs((ref_thetao.simulation - pred_thetao))\n", |
661 | 662 | "err_zos = np.abs((ref_zos.simulation - pred_zos))\n", |
|
0 commit comments