ML_train_and_predict.ipynb 70.6 KB
Newer Older
Aaron Spring's avatar
Aaron Spring committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Train ML model to correct predictions of week 3-4 & 5-6\n",
    "\n",
    "This notebook create a Machine Learning `ML_model` to predict weeks 3-4 & 5-6 based on `S2S` weeks 3-4 & 5-6 forecasts and is compared to `CPC` observations for the [`s2s-ai-challenge`](https://s2s-ai-challenge.github.io/)."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Synopsis"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Method: `ML-based mean bias reduction`\n",
    "\n",
    "- calculate the ML-based bias from 2000-2019 deterministic ensemble mean forecast\n",
    "- remove that the ML-based bias from 2020 forecast deterministic ensemble mean forecast"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Data used\n",
    "\n",
    "type: renku datasets\n",
    "\n",
    "Training-input for Machine Learning model:\n",
    "- hindcasts of models:\n",
    "    - ECMWF: `ecmwf_hindcast-input_2000-2019_biweekly_deterministic.zarr`\n",
    "\n",
    "Forecast-input for Machine Learning model:\n",
    "- real-time 2020 forecasts of models:\n",
    "    - ECMWF: `ecmwf_forecast-input_2020_biweekly_deterministic.zarr`\n",
    "\n",
    "Compare Machine Learning model forecast against against ground truth:\n",
    "- `CPC` observations:\n",
    "    - `hindcast-like-observations_biweekly_deterministic.zarr`\n",
    "    - `forecast-like-observations_2020_biweekly_deterministic.zarr`"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Resources used\n",
Aaron Spring's avatar
Aaron Spring committed
56
    "for training, details in reproducibility\n",
Aaron Spring's avatar
Aaron Spring committed
57
    "\n",
58
59
60
    "- platform: renku\n",
    "- memory: 8 GB\n",
    "- processors: 2 CPU\n",
Aaron Spring's avatar
Aaron Spring committed
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
    "- storage required: 10 GB"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Safeguards\n",
    "\n",
    "All points have to be [x] checked. If not, your submission is invalid.\n",
    "\n",
    "Changes to the code after submissions are not possible, as the `commit` before the `tag` will be reviewed.\n",
    "(Only in exceptions and if previous effort in reproducibility can be found, it may be allowed to improve readability and reproducibility after November 1st 2021.)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Safeguards to prevent [overfitting](https://en.wikipedia.org/wiki/Overfitting?wprov=sfti1) \n",
    "\n",
    "If the organizers suspect overfitting, your contribution can be disqualified.\n",
    "\n",
Aaron Spring's avatar
Aaron Spring committed
84
85
    "  - [x] We did not use 2020 observations in training (explicit overfitting and cheating)\n",
    "  - [x] We did not repeatedly verify my model on 2020 observations and incrementally improved my RPSS (implicit overfitting)\n",
86
    "  - [x] We provide RPSS scores for the training period with script `print_RPS_per_year`, see in section 6.3 `predict`.\n",
Aaron Spring's avatar
Aaron Spring committed
87
88
    "  - [x] We tried our best to prevent [data leakage](https://en.wikipedia.org/wiki/Leakage_(machine_learning)?wprov=sfti1).\n",
    "  - [x] We honor the `train-validate-test` [split principle](https://en.wikipedia.org/wiki/Training,_validation,_and_test_sets). This means that the hindcast data is split into `train` and `validate`, whereas `test` is withheld.\n",
Aaron Spring's avatar
Aaron Spring committed
89
    "  - [x] We did not use `test` explicitly in training or implicitly in incrementally adjusting parameters.\n",
Aaron Spring's avatar
Aaron Spring committed
90
91
92
93
94
95
96
97
98
99
100
    "  - [x] We considered [cross-validation](https://en.wikipedia.org/wiki/Cross-validation_(statistics))."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Safeguards for Reproducibility\n",
    "Notebook/code must be independently reproducible from scratch by the organizers (after the competition), if not possible: no prize\n",
    "  - [x] All training data is publicly available (no pre-trained private neural networks, as they are not reproducible for us)\n",
    "  - [x] Code is well documented, readable and reproducible.\n",
101
    "  - [x] Code to reproduce training and predictions is preferred to run within a day on the described architecture. If the training takes longer than a day, please justify why this is needed. Please do not submit training piplelines, which take weeks to train."
Aaron Spring's avatar
Aaron Spring committed
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Todos to improve template\n",
    "\n",
    "This is just a demo.\n",
    "\n",
    "- [ ] use multiple predictor variables and two predicted variables\n",
    "- [ ] for both `lead_time`s in one go\n",
    "- [ ] consider seasonality, for now all `forecast_time` months are mixed\n",
    "- [ ] make probabilistic predictions with `category` dim, for now works deterministic"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Imports"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
129
   "outputs": [],
Aaron Spring's avatar
Aaron Spring committed
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
   "source": [
    "from tensorflow.keras.layers import Input, Dense, Flatten\n",
    "from tensorflow.keras.models import Sequential\n",
    "\n",
    "import matplotlib.pyplot as plt\n",
    "\n",
    "import xarray as xr\n",
    "xr.set_options(display_style='text')\n",
    "import numpy as np\n",
    "\n",
    "from dask.utils import format_bytes\n",
    "import xskillscore as xs"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Get training data\n",
    "\n",
    "preprocessing of input data may be done in separate notebook/script"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Hindcast\n",
    "\n",
    "get weekly initialized hindcasts"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "v='t2m'"
   ]
  },
  {
   "cell_type": "code",
173
   "execution_count": 3,
Aaron Spring's avatar
Aaron Spring committed
174
   "metadata": {},
175
176
177
178
179
180
181
182
183
184
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\u001b[33m\u001b[1mWarning: \u001b[0mRun CLI commands only from project's root directory.\n",
      "\u001b[0m\n"
     ]
    }
   ],
Aaron Spring's avatar
Aaron Spring committed
185
186
187
188
189
190
191
   "source": [
    "# preprocessed as renku dataset\n",
    "!renku storage pull ../data/ecmwf_hindcast-input_2000-2019_biweekly_deterministic.zarr"
   ]
  },
  {
   "cell_type": "code",
Aaron Spring's avatar
Aaron Spring committed
192
   "execution_count": 4,
Aaron Spring's avatar
Aaron Spring committed
193
   "metadata": {},
194
   "outputs": [],
Aaron Spring's avatar
Aaron Spring committed
195
   "source": [
196
    "hind_2000_2019 = xr.open_zarr(\"../data/ecmwf_hindcast-input_2000-2019_biweekly_deterministic.zarr\", consolidated=True)"
Aaron Spring's avatar
Aaron Spring committed
197
198
199
200
   ]
  },
  {
   "cell_type": "code",
201
   "execution_count": 5,
Aaron Spring's avatar
Aaron Spring committed
202
   "metadata": {},
203
204
205
206
207
208
209
210
211
212
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\u001b[33m\u001b[1mWarning: \u001b[0mRun CLI commands only from project's root directory.\n",
      "\u001b[0m\n"
     ]
    }
   ],
Aaron Spring's avatar
Aaron Spring committed
213
214
215
216
217
218
219
   "source": [
    "# preprocessed as renku dataset\n",
    "!renku storage pull ../data/ecmwf_forecast-input_2020_biweekly_deterministic.zarr"
   ]
  },
  {
   "cell_type": "code",
Aaron Spring's avatar
Aaron Spring committed
220
   "execution_count": 6,
Aaron Spring's avatar
Aaron Spring committed
221
222
223
   "metadata": {},
   "outputs": [],
   "source": [
224
    "fct_2020 = xr.open_zarr(\"../data/ecmwf_forecast-input_2020_biweekly_deterministic.zarr\", consolidated=True)"
Aaron Spring's avatar
Aaron Spring committed
225
226
227
228
229
230
231
232
233
234
235
236
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Observations\n",
    "corresponding to hindcasts"
   ]
  },
  {
   "cell_type": "code",
237
   "execution_count": 7,
Aaron Spring's avatar
Aaron Spring committed
238
   "metadata": {},
239
240
241
242
243
244
245
246
247
248
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\u001b[33m\u001b[1mWarning: \u001b[0mRun CLI commands only from project's root directory.\n",
      "\u001b[0m\n"
     ]
    }
   ],
Aaron Spring's avatar
Aaron Spring committed
249
250
251
252
253
254
255
   "source": [
    "# preprocessed as renku dataset\n",
    "!renku storage pull ../data/hindcast-like-observations_2000-2019_biweekly_deterministic.zarr"
   ]
  },
  {
   "cell_type": "code",
Aaron Spring's avatar
Aaron Spring committed
256
   "execution_count": 8,
Aaron Spring's avatar
Aaron Spring committed
257
258
259
260
261
262
263
264
   "metadata": {},
   "outputs": [],
   "source": [
    "obs_2000_2019 = xr.open_zarr(\"../data/hindcast-like-observations_2000-2019_biweekly_deterministic.zarr\", consolidated=True)#[v]"
   ]
  },
  {
   "cell_type": "code",
265
   "execution_count": 9,
Aaron Spring's avatar
Aaron Spring committed
266
   "metadata": {},
267
268
269
270
271
272
273
274
275
276
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\u001b[33m\u001b[1mWarning: \u001b[0mRun CLI commands only from project's root directory.\n",
      "\u001b[0m\n"
     ]
    }
   ],
Aaron Spring's avatar
Aaron Spring committed
277
278
279
280
281
282
283
   "source": [
    "# preprocessed as renku dataset\n",
    "!renku storage pull ../data/forecast-like-observations_2020_biweekly_deterministic.zarr"
   ]
  },
  {
   "cell_type": "code",
Aaron Spring's avatar
Aaron Spring committed
284
   "execution_count": 10,
Aaron Spring's avatar
Aaron Spring committed
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
   "metadata": {},
   "outputs": [],
   "source": [
    "obs_2020 = xr.open_zarr(\"../data/forecast-like-observations_2020_biweekly_deterministic.zarr\", consolidated=True)#[v]"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# ML model"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "based on [Weatherbench](https://github.com/pangeo-data/WeatherBench/blob/master/quickstart.ipynb)"
   ]
  },
  {
   "cell_type": "code",
Aaron Spring's avatar
Aaron Spring committed
307
   "execution_count": 11,
Aaron Spring's avatar
Aaron Spring committed
308
   "metadata": {},
Aaron Spring's avatar
Aaron Spring committed
309
310
311
312
313
314
315
316
317
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "fatal: destination path 'WeatherBench' already exists and is not an empty directory.\n"
     ]
    }
   ],
Aaron Spring's avatar
Aaron Spring committed
318
319
320
321
322
323
324
   "source": [
    "# run once only and dont commit\n",
    "!git clone https://github.com/pangeo-data/WeatherBench/"
   ]
  },
  {
   "cell_type": "code",
Aaron Spring's avatar
Aaron Spring committed
325
   "execution_count": 12,
Aaron Spring's avatar
Aaron Spring committed
326
327
328
329
330
331
332
333
334
335
336
   "metadata": {},
   "outputs": [],
   "source": [
    "import sys\n",
    "sys.path.insert(1, 'WeatherBench')\n",
    "from WeatherBench.src.train_nn import DataGenerator, PeriodicConv2D, create_predictions\n",
    "import tensorflow.keras as keras"
   ]
  },
  {
   "cell_type": "code",
Aaron Spring's avatar
Aaron Spring committed
337
   "execution_count": 13,
Aaron Spring's avatar
Aaron Spring committed
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
   "metadata": {},
   "outputs": [],
   "source": [
    "bs=32\n",
    "\n",
    "import numpy as np\n",
    "class DataGenerator(keras.utils.Sequence):\n",
    "    def __init__(self, fct, verif, lead_time, batch_size=bs, shuffle=True, load=True,\n",
    "                 mean=None, std=None):\n",
    "        \"\"\"\n",
    "        Data generator for WeatherBench data.\n",
    "        Template from https://stanford.edu/~shervine/blog/keras-how-to-generate-data-on-the-fly\n",
    "\n",
    "        Args:\n",
    "            fct: forecasts from S2S models: xr.DataArray (xr.Dataset doesnt work properly)\n",
    "            verif: observations with same dimensionality (xr.Dataset doesnt work properly)\n",
    "            lead_time: Lead_time as in model\n",
    "            batch_size: Batch size\n",
    "            shuffle: bool. If True, data is shuffled.\n",
    "            load: bool. If True, datadet is loaded into RAM.\n",
    "            mean: If None, compute mean from data.\n",
    "            std: If None, compute standard deviation from data.\n",
    "            \n",
    "        Todo:\n",
    "        - use number in a better way, now uses only ensemble mean forecast\n",
    "        - dont use .sel(lead_time=lead_time) to train over all lead_time at once\n",
    "        - be sensitive with forecast_time, pool a few around the weekofyear given\n",
    "        - use more variables as predictors\n",
    "        - predict more variables\n",
    "        \"\"\"\n",
    "\n",
    "        if isinstance(fct, xr.Dataset):\n",
    "            print('convert fct to array')\n",
    "            fct = fct.to_array().transpose(...,'variable')\n",
    "            self.fct_dataset=True\n",
    "        else:\n",
    "            self.fct_dataset=False\n",
    "            \n",
    "        if isinstance(verif, xr.Dataset):\n",
    "            print('convert verif to array')\n",
    "            verif = verif.to_array().transpose(...,'variable')\n",
    "            self.verif_dataset=True\n",
    "        else:\n",
    "            self.verif_dataset=False\n",
    "        \n",
    "        #self.fct = fct\n",
    "        self.batch_size = batch_size\n",
    "        self.shuffle = shuffle\n",
    "        self.lead_time = lead_time\n",
    "\n",
    "        self.fct_data = fct.transpose('forecast_time', ...).sel(lead_time=lead_time)\n",
    "        self.fct_mean = self.fct_data.mean('forecast_time').compute() if mean is None else mean\n",
    "        self.fct_std = self.fct_data.std('forecast_time').compute() if std is None else std\n",
    "        \n",
    "        self.verif_data = verif.transpose('forecast_time', ...).sel(lead_time=lead_time)\n",
    "        self.verif_mean = self.verif_data.mean('forecast_time').compute() if mean is None else mean\n",
    "        self.verif_std = self.verif_data.std('forecast_time').compute() if std is None else std\n",
    "\n",
    "        # Normalize\n",
    "        self.fct_data = (self.fct_data - self.fct_mean) / self.fct_std\n",
    "        self.verif_data = (self.verif_data - self.verif_mean) / self.verif_std\n",
    "        \n",
    "        self.n_samples = self.fct_data.forecast_time.size\n",
    "        self.forecast_time = self.fct_data.forecast_time\n",
    "\n",
    "        self.on_epoch_end()\n",
    "\n",
    "        # For some weird reason calling .load() earlier messes up the mean and std computations\n",
    "        if load:\n",
    "            # print('Loading data into RAM')\n",
    "            self.fct_data.load()\n",
    "\n",
    "    def __len__(self):\n",
    "        'Denotes the number of batches per epoch'\n",
    "        return int(np.ceil(self.n_samples / self.batch_size))\n",
    "\n",
    "    def __getitem__(self, i):\n",
    "        'Generate one batch of data'\n",
    "        idxs = self.idxs[i * self.batch_size:(i + 1) * self.batch_size]\n",
    "        # got all nan if nans not masked\n",
    "        X = self.fct_data.isel(forecast_time=idxs).fillna(0.).values\n",
    "        y = self.verif_data.isel(forecast_time=idxs).fillna(0.).values\n",
    "        return X, y\n",
    "\n",
    "    def on_epoch_end(self):\n",
    "        'Updates indexes after each epoch'\n",
    "        self.idxs = np.arange(self.n_samples)\n",
    "        if self.shuffle == True:\n",
    "            np.random.shuffle(self.idxs)"
   ]
  },
  {
   "cell_type": "code",
Aaron Spring's avatar
Aaron Spring committed
431
   "execution_count": 14,
Aaron Spring's avatar
Aaron Spring committed
432
433
434
435
436
437
438
439
440
441
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<pre>&lt;xarray.DataArray &#x27;lead_time&#x27; ()&gt;\n",
       "array(1209600000000000, dtype=&#x27;timedelta64[ns]&#x27;)\n",
       "Coordinates:\n",
       "    lead_time  timedelta64[ns] 14 days\n",
       "Attributes:\n",
442
443
444
445
446
447
448
449
       "    aggregate:      The pd.Timedelta corresponds to the first day of a biweek...\n",
       "    description:    Forecast period is the time interval between the forecast...\n",
       "    long_name:      lead time\n",
       "    standard_name:  forecast_period\n",
       "    week34_t2m:     mean[14 days, 27 days]\n",
       "    week34_tp:      28 days minus 14 days\n",
       "    week56_t2m:     mean[28 days, 41 days]\n",
       "    week56_tp:      42 days minus 28 days</pre>"
Aaron Spring's avatar
Aaron Spring committed
450
451
452
453
454
455
456
      ],
      "text/plain": [
       "<xarray.DataArray 'lead_time' ()>\n",
       "array(1209600000000000, dtype='timedelta64[ns]')\n",
       "Coordinates:\n",
       "    lead_time  timedelta64[ns] 14 days\n",
       "Attributes:\n",
457
458
459
460
461
462
463
464
       "    aggregate:      The pd.Timedelta corresponds to the first day of a biweek...\n",
       "    description:    Forecast period is the time interval between the forecast...\n",
       "    long_name:      lead time\n",
       "    standard_name:  forecast_period\n",
       "    week34_t2m:     mean[14 days, 27 days]\n",
       "    week34_tp:      28 days minus 14 days\n",
       "    week56_t2m:     mean[28 days, 41 days]\n",
       "    week56_tp:      42 days minus 28 days"
Aaron Spring's avatar
Aaron Spring committed
465
466
      ]
     },
Aaron Spring's avatar
Aaron Spring committed
467
     "execution_count": 14,
Aaron Spring's avatar
Aaron Spring committed
468
469
470
471
472
473
474
475
476
477
478
479
480
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 2 bi-weekly `lead_time`: week 3-4\n",
    "lead = hind_2000_2019.isel(lead_time=0).lead_time\n",
    "\n",
    "lead"
   ]
  },
  {
   "cell_type": "code",
Aaron Spring's avatar
Aaron Spring committed
481
   "execution_count": 15,
Aaron Spring's avatar
Aaron Spring committed
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
   "metadata": {},
   "outputs": [],
   "source": [
    "# mask, needed?\n",
    "hind_2000_2019 = hind_2000_2019.where(obs_2000_2019.isel(forecast_time=0, lead_time=0,drop=True).notnull())"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## data prep: train, valid, test\n",
    "\n",
    "[Use the hindcast period to split train and valid.](https://en.wikipedia.org/wiki/Training,_validation,_and_test_sets) Do not use the 2020 data for testing!"
   ]
  },
  {
   "cell_type": "code",
Aaron Spring's avatar
Aaron Spring committed
500
   "execution_count": 16,
Aaron Spring's avatar
Aaron Spring committed
501
502
503
504
505
506
507
508
509
510
511
   "metadata": {},
   "outputs": [],
   "source": [
    "# time is the forecast_time\n",
    "time_train_start,time_train_end='2000','2017' # train\n",
    "time_valid_start,time_valid_end='2018','2019' # valid\n",
    "time_test = '2020'                            # test"
   ]
  },
  {
   "cell_type": "code",
Aaron Spring's avatar
Aaron Spring committed
512
   "execution_count": 17,
Aaron Spring's avatar
Aaron Spring committed
513
514
515
516
517
518
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
Aaron Spring's avatar
Aaron Spring committed
519
      "/opt/conda/lib/python3.8/site-packages/dask/array/numpy_compat.py:39: RuntimeWarning: invalid value encountered in true_divide\n",
Aaron Spring's avatar
Aaron Spring committed
520
      "  x = np.divide(x1, x2, out)\n",
Aaron Spring's avatar
Aaron Spring committed
521
      "/opt/conda/lib/python3.8/site-packages/dask/array/numpy_compat.py:39: RuntimeWarning: invalid value encountered in true_divide\n",
Aaron Spring's avatar
Aaron Spring committed
522
      "  x = np.divide(x1, x2, out)\n",
Aaron Spring's avatar
Aaron Spring committed
523
      "/opt/conda/lib/python3.8/site-packages/dask/array/numpy_compat.py:39: RuntimeWarning: invalid value encountered in true_divide\n",
Aaron Spring's avatar
Aaron Spring committed
524
      "  x = np.divide(x1, x2, out)\n",
Aaron Spring's avatar
Aaron Spring committed
525
      "/opt/conda/lib/python3.8/site-packages/dask/array/numpy_compat.py:39: RuntimeWarning: invalid value encountered in true_divide\n",
Aaron Spring's avatar
Aaron Spring committed
526
      "  x = np.divide(x1, x2, out)\n",
Aaron Spring's avatar
Aaron Spring committed
527
528
529
      "/opt/conda/lib/python3.8/site-packages/dask/array/numpy_compat.py:39: RuntimeWarning: invalid value encountered in true_divide\n",
      "  x = np.divide(x1, x2, out)\n",
      "/opt/conda/lib/python3.8/site-packages/dask/array/numpy_compat.py:39: RuntimeWarning: invalid value encountered in true_divide\n",
Aaron Spring's avatar
Aaron Spring committed
530
531
532
533
534
535
536
537
538
539
540
541
542
      "  x = np.divide(x1, x2, out)\n"
     ]
    }
   ],
   "source": [
    "dg_train = DataGenerator(\n",
    "    hind_2000_2019.mean('realization').sel(forecast_time=slice(time_train_start,time_train_end))[v],\n",
    "    obs_2000_2019.sel(forecast_time=slice(time_train_start,time_train_end))[v],\n",
    "    lead_time=lead, batch_size=bs, load=True)"
   ]
  },
  {
   "cell_type": "code",
Aaron Spring's avatar
Aaron Spring committed
543
   "execution_count": 18,
Aaron Spring's avatar
Aaron Spring committed
544
545
546
547
548
549
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
Aaron Spring's avatar
Aaron Spring committed
550
      "/opt/conda/lib/python3.8/site-packages/dask/array/numpy_compat.py:39: RuntimeWarning: invalid value encountered in true_divide\n",
Aaron Spring's avatar
Aaron Spring committed
551
      "  x = np.divide(x1, x2, out)\n",
Aaron Spring's avatar
Aaron Spring committed
552
      "/opt/conda/lib/python3.8/site-packages/dask/array/numpy_compat.py:39: RuntimeWarning: invalid value encountered in true_divide\n",
Aaron Spring's avatar
Aaron Spring committed
553
      "  x = np.divide(x1, x2, out)\n",
Aaron Spring's avatar
Aaron Spring committed
554
      "/opt/conda/lib/python3.8/site-packages/dask/array/numpy_compat.py:39: RuntimeWarning: invalid value encountered in true_divide\n",
Aaron Spring's avatar
Aaron Spring committed
555
      "  x = np.divide(x1, x2, out)\n",
Aaron Spring's avatar
Aaron Spring committed
556
      "/opt/conda/lib/python3.8/site-packages/dask/array/numpy_compat.py:39: RuntimeWarning: invalid value encountered in true_divide\n",
Aaron Spring's avatar
Aaron Spring committed
557
      "  x = np.divide(x1, x2, out)\n",
Aaron Spring's avatar
Aaron Spring committed
558
      "/opt/conda/lib/python3.8/site-packages/dask/array/numpy_compat.py:39: RuntimeWarning: invalid value encountered in true_divide\n",
Aaron Spring's avatar
Aaron Spring committed
559
560
561
562
563
564
565
566
567
568
569
570
571
      "  x = np.divide(x1, x2, out)\n"
     ]
    }
   ],
   "source": [
    "dg_valid = DataGenerator(\n",
    "    hind_2000_2019.mean('realization').sel(forecast_time=slice(time_valid_start,time_valid_end))[v],\n",
    "    obs_2000_2019.sel(forecast_time=slice(time_valid_start,time_valid_end))[v],\n",
    "    lead_time=lead, batch_size=bs, shuffle=False, load=True)"
   ]
  },
  {
   "cell_type": "code",
Aaron Spring's avatar
Aaron Spring committed
572
   "execution_count": 19,
Aaron Spring's avatar
Aaron Spring committed
573
574
575
576
577
578
579
580
581
582
583
584
   "metadata": {},
   "outputs": [],
   "source": [
    "# do not use, delete?\n",
    "dg_test = DataGenerator(\n",
    "    fct_2020.mean('realization').sel(forecast_time=time_test)[v],\n",
    "    obs_2020.sel(forecast_time=time_test)[v],\n",
    "    lead_time=lead, batch_size=bs, load=True, mean=dg_train.fct_mean, std=dg_train.fct_std, shuffle=False)"
   ]
  },
  {
   "cell_type": "code",
Aaron Spring's avatar
Aaron Spring committed
585
   "execution_count": 20,
Aaron Spring's avatar
Aaron Spring committed
586
587
588
589
590
591
592
593
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "((32, 121, 240), (32, 121, 240))"
      ]
     },
Aaron Spring's avatar
Aaron Spring committed
594
     "execution_count": 20,
Aaron Spring's avatar
Aaron Spring committed
595
596
597
598
599
600
601
602
603
604
605
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "X, y = dg_valid[0]\n",
    "X.shape, y.shape"
   ]
  },
  {
   "cell_type": "code",
Aaron Spring's avatar
Aaron Spring committed
606
   "execution_count": 21,
Aaron Spring's avatar
Aaron Spring committed
607
   "metadata": {},
608
   "outputs": [],
Aaron Spring's avatar
Aaron Spring committed
609
610
611
   "source": [
    "# short look into training data: large biases\n",
    "# any problem from normalizing?\n",
612
613
    "# i=4\n",
    "# xr.DataArray(np.vstack([X[i],y[i]])).plot(yincrease=False, robust=True)"
Aaron Spring's avatar
Aaron Spring committed
614
615
616
617
618
619
620
621
622
623
624
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## `fit`"
   ]
  },
  {
   "cell_type": "code",
Aaron Spring's avatar
Aaron Spring committed
625
   "execution_count": 22,
Aaron Spring's avatar
Aaron Spring committed
626
627
628
629
630
631
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
Aaron Spring's avatar
Aaron Spring committed
632
      "WARNING:tensorflow:AutoGraph could not transform <bound method PeriodicPadding2D.call of <WeatherBench.src.train_nn.PeriodicPadding2D object at 0x7f86042986a0>> and will run it as-is.\n",
Aaron Spring's avatar
Aaron Spring committed
633
634
635
      "Please report this to the TensorFlow team. When filing the bug, set the verbosity to 10 (on Linux, `export AUTOGRAPH_VERBOSITY=10`) and attach the full output.\n",
      "Cause: module 'gast' has no attribute 'Index'\n",
      "To silence this warning, decorate the function with @tf.autograph.experimental.do_not_convert\n",
Aaron Spring's avatar
Aaron Spring committed
636
      "WARNING: AutoGraph could not transform <bound method PeriodicPadding2D.call of <WeatherBench.src.train_nn.PeriodicPadding2D object at 0x7f86042986a0>> and will run it as-is.\n",
Aaron Spring's avatar
Aaron Spring committed
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
      "Please report this to the TensorFlow team. When filing the bug, set the verbosity to 10 (on Linux, `export AUTOGRAPH_VERBOSITY=10`) and attach the full output.\n",
      "Cause: module 'gast' has no attribute 'Index'\n",
      "To silence this warning, decorate the function with @tf.autograph.experimental.do_not_convert\n"
     ]
    }
   ],
   "source": [
    "cnn = keras.models.Sequential([\n",
    "    PeriodicConv2D(filters=32, kernel_size=5, conv_kwargs={'activation':'relu'}, input_shape=(32, 64, 1)),\n",
    "    PeriodicConv2D(filters=1, kernel_size=5)\n",
    "])"
   ]
  },
  {
   "cell_type": "code",
Aaron Spring's avatar
Aaron Spring committed
652
   "execution_count": 23,
Aaron Spring's avatar
Aaron Spring committed
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Model: \"sequential\"\n",
      "_________________________________________________________________\n",
      "Layer (type)                 Output Shape              Param #   \n",
      "=================================================================\n",
      "periodic_conv2d (PeriodicCon (None, 32, 64, 32)        832       \n",
      "_________________________________________________________________\n",
      "periodic_conv2d_1 (PeriodicC (None, 32, 64, 1)         801       \n",
      "=================================================================\n",
      "Total params: 1,633\n",
      "Trainable params: 1,633\n",
      "Non-trainable params: 0\n",
      "_________________________________________________________________\n"
     ]
    }
   ],
   "source": [
    "cnn.summary()"
   ]
  },
  {
   "cell_type": "code",
Aaron Spring's avatar
Aaron Spring committed
680
   "execution_count": 24,
Aaron Spring's avatar
Aaron Spring committed
681
682
683
684
685
686
687
688
   "metadata": {},
   "outputs": [],
   "source": [
    "cnn.compile(keras.optimizers.Adam(1e-4), 'mse')"
   ]
  },
  {
   "cell_type": "code",
Aaron Spring's avatar
Aaron Spring committed
689
   "execution_count": 25,
Aaron Spring's avatar
Aaron Spring committed
690
691
692
693
694
695
696
697
698
   "metadata": {},
   "outputs": [],
   "source": [
    "import warnings\n",
    "warnings.simplefilter(\"ignore\")"
   ]
  },
  {
   "cell_type": "code",
Aaron Spring's avatar
Aaron Spring committed
699
   "execution_count": 26,
Aaron Spring's avatar
Aaron Spring committed
700
701
702
703
704
705
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
706
      "Epoch 1/2\n",
Aaron Spring's avatar
Aaron Spring committed
707
      "30/30 [==============================] - 58s 2s/step - loss: 0.1472 - val_loss: 0.0742\n",
708
      "Epoch 2/2\n",
Aaron Spring's avatar
Aaron Spring committed
709
      "30/30 [==============================] - 45s 1s/step - loss: 0.0712 - val_loss: 0.0545\n"
Aaron Spring's avatar
Aaron Spring committed
710
711
712
713
714
     ]
    },
    {
     "data": {
      "text/plain": [
Aaron Spring's avatar
Aaron Spring committed
715
       "<tensorflow.python.keras.callbacks.History at 0x7f865c2103d0>"
Aaron Spring's avatar
Aaron Spring committed
716
717
      ]
     },
Aaron Spring's avatar
Aaron Spring committed
718
     "execution_count": 26,
Aaron Spring's avatar
Aaron Spring committed
719
720
721
722
723
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
724
    "cnn.fit(dg_train, epochs=2, validation_data=dg_valid)"
Aaron Spring's avatar
Aaron Spring committed
725
726
727
728
729
730
731
732
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## `predict`\n",
    "\n",
733
    "Create predictions and print `mean(variable, lead_time, longitude, weighted latitude)` RPSS for all years as calculated by `skill_by_year`."
Aaron Spring's avatar
Aaron Spring committed
734
735
736
737
   ]
  },
  {
   "cell_type": "code",
Aaron Spring's avatar
Aaron Spring committed
738
   "execution_count": 27,
Aaron Spring's avatar
Aaron Spring committed
739
   "metadata": {},
Aaron Spring's avatar
Aaron Spring committed
740
   "outputs": [],
Aaron Spring's avatar
Aaron Spring committed
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
   "source": [
    "from scripts import add_valid_time_from_forecast_reference_time_and_lead_time\n",
    "\n",
    "def _create_predictions(model, dg, lead):\n",
    "    \"\"\"Create non-iterative predictions\"\"\"\n",
    "    preds = model.predict(dg).squeeze()\n",
    "    # Unnormalize\n",
    "    preds = preds * dg.fct_std.values + dg.fct_mean.values\n",
    "    if dg.verif_dataset:\n",
    "        da = xr.DataArray(\n",
    "                    preds,\n",
    "                    dims=['forecast_time', 'latitude', 'longitude','variable'],\n",
    "                    coords={'forecast_time': dg.fct_data.forecast_time, 'latitude': dg.fct_data.latitude,\n",
    "                            'longitude': dg.fct_data.longitude},\n",
    "                ).to_dataset() # doesnt work yet\n",
    "    else:\n",
    "        da = xr.DataArray(\n",
    "                    preds,\n",
    "                    dims=['forecast_time', 'latitude', 'longitude'],\n",
    "                    coords={'forecast_time': dg.fct_data.forecast_time, 'latitude': dg.fct_data.latitude,\n",
    "                            'longitude': dg.fct_data.longitude},\n",
    "                )\n",
    "    da = da.assign_coords(lead_time=lead)\n",
    "    # da = add_valid_time_from_forecast_reference_time_and_lead_time(da)\n",
    "    return da"
   ]
  },
  {
   "cell_type": "code",
Aaron Spring's avatar
Aaron Spring committed
770
   "execution_count": 28,
Aaron Spring's avatar
Aaron Spring committed
771
772
773
774
775
776
777
778
779
   "metadata": {},
   "outputs": [],
   "source": [
    "# optionally masking the ocean when making probabilistic\n",
    "mask = obs_2020.std(['lead_time','forecast_time']).notnull()"
   ]
  },
  {
   "cell_type": "code",
Aaron Spring's avatar
Aaron Spring committed
780
   "execution_count": 29,
Aaron Spring's avatar
Aaron Spring committed
781
782
783
784
785
786
787
788
   "metadata": {},
   "outputs": [],
   "source": [
    "from scripts import make_probabilistic"
   ]
  },
  {
   "cell_type": "code",
789
   "execution_count": 30,
Aaron Spring's avatar
Aaron Spring committed
790
   "metadata": {},
791
792
793
794
795
796
797
798
799
800
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\u001b[33m\u001b[1mWarning: \u001b[0mRun CLI commands only from project's root directory.\n",
      "\u001b[0m\n"
     ]
    }
   ],
Aaron Spring's avatar
Aaron Spring committed
801
802
803
804
805
806
   "source": [
    "!renku storage pull ../data/hindcast-like-observations_2000-2019_biweekly_tercile-edges.nc"
   ]
  },
  {
   "cell_type": "code",
Aaron Spring's avatar
Aaron Spring committed
807
   "execution_count": 31,
Aaron Spring's avatar
Aaron Spring committed
808
809
810
811
812
813
814
815
816
817
   "metadata": {},
   "outputs": [],
   "source": [
    "cache_path='../data'\n",
    "tercile_file = f'{cache_path}/hindcast-like-observations_2000-2019_biweekly_tercile-edges.nc'\n",
    "tercile_edges = xr.open_dataset(tercile_file)"
   ]
  },
  {
   "cell_type": "code",
Aaron Spring's avatar
Aaron Spring committed
818
   "execution_count": 32,
Aaron Spring's avatar
Aaron Spring committed
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
   "metadata": {},
   "outputs": [],
   "source": [
    "# this is not useful but results have expected dimensions\n",
    "# actually train for each lead_time\n",
    "\n",
    "def create_predictions(cnn, fct, obs, time):\n",
    "    preds_test=[]\n",
    "    for lead in fct.lead_time:\n",
    "        dg = DataGenerator(fct.mean('realization').sel(forecast_time=time)[v],\n",
    "                           obs.sel(forecast_time=time)[v],\n",
    "                           lead_time=lead, batch_size=bs, mean=dg_train.fct_mean, std=dg_train.fct_std, shuffle=False)\n",
    "        preds_test.append(_create_predictions(cnn, dg, lead))\n",
    "    preds_test = xr.concat(preds_test, 'lead_time')\n",
    "    preds_test['lead_time'] = fct.lead_time\n",
    "    # add valid_time coord\n",
    "    preds_test = add_valid_time_from_forecast_reference_time_and_lead_time(preds_test)\n",
    "    preds_test = preds_test.to_dataset(name=v)\n",
    "    # add fake var\n",
    "    preds_test['tp'] = preds_test['t2m']\n",
    "    # make probabilistic\n",
    "    preds_test = make_probabilistic(preds_test.expand_dims('realization'), tercile_edges, mask=mask)\n",
    "    return preds_test"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### `predict` training period in-sample"
   ]
  },
  {
   "cell_type": "code",
853
   "execution_count": 33,
Aaron Spring's avatar
Aaron Spring committed
854
   "metadata": {},
855
856
857
858
859
860
861
862
863
864
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\u001b[33m\u001b[1mWarning: \u001b[0mRun CLI commands only from project's root directory.\n",
      "\u001b[0m\n"
     ]
    }
   ],
Aaron Spring's avatar
Aaron Spring committed
865
866
867
868
869
870
   "source": [
    "!renku storage pull ../data/forecast-like-observations_2020_biweekly_terciled.nc"
   ]
  },
  {
   "cell_type": "code",
871
   "execution_count": 34,
Aaron Spring's avatar
Aaron Spring committed
872
   "metadata": {},
873
874
875
876
877
878
879
880
881
882
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\u001b[33m\u001b[1mWarning: \u001b[0mRun CLI commands only from project's root directory.\n",
      "\u001b[0m\n"
     ]
    }
   ],
Aaron Spring's avatar
Aaron Spring committed
883
884
885
886
887
888
   "source": [
    "!renku storage pull ../data/hindcast-like-observations_2000-2019_biweekly_terciled.zarr"
   ]
  },
  {
   "cell_type": "code",
Aaron Spring's avatar
Aaron Spring committed
889
   "execution_count": 35,
Aaron Spring's avatar
Aaron Spring committed
890
   "metadata": {},
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>RPSS</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>year</th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>2000</th>\n",
Aaron Spring's avatar
Aaron Spring committed
923
       "      <td>-0.862483</td>\n",
924
925
926
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2001</th>\n",
Aaron Spring's avatar
Aaron Spring committed
927
       "      <td>-1.015485</td>\n",
928
929
930
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2002</th>\n",
Aaron Spring's avatar
Aaron Spring committed
931
       "      <td>-1.101022</td>\n",
932
933
934
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2003</th>\n",
Aaron Spring's avatar
Aaron Spring committed
935
       "      <td>-1.032647</td>\n",
936
937
938
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2004</th>\n",
Aaron Spring's avatar
Aaron Spring committed
939
       "      <td>-1.056348</td>\n",
940
941
942
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2005</th>\n",
Aaron Spring's avatar
Aaron Spring committed
943
       "      <td>-1.165675</td>\n",
944
945
946
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2006</th>\n",
Aaron Spring's avatar
Aaron Spring committed
947
       "      <td>-1.057217</td>\n",
948
949
950
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2007</th>\n",
Aaron Spring's avatar
Aaron Spring committed
951
       "      <td>-1.170849</td>\n",
952
953
954
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2008</th>\n",
Aaron Spring's avatar
Aaron Spring committed
955
       "      <td>-1.049785</td>\n",
956
957
958
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2009</th>\n",
Aaron Spring's avatar
Aaron Spring committed
959
       "      <td>-1.169108</td>\n",
960
961
962
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2010</th>\n",
Aaron Spring's avatar
Aaron Spring committed
963
       "      <td>-1.130845</td>\n",
964
965
966
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2011</th>\n",
Aaron Spring's avatar
Aaron Spring committed
967
       "      <td>-1.052670</td>\n",
968
969
970
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2012</th>\n",
Aaron Spring's avatar
Aaron Spring committed
971
       "      <td>-1.126449</td>\n",
972
973
974
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2013</th>\n",
Aaron Spring's avatar
Aaron Spring committed
975
       "      <td>-1.126930</td>\n",
976
977
978
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2014</th>\n",
Aaron Spring's avatar
Aaron Spring committed
979
       "      <td>-1.095896</td>\n",
980
981
982
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2015</th>\n",
Aaron Spring's avatar
Aaron Spring committed
983
       "      <td>-1.117486</td>\n",
984
985
986
987
988
989
990
991
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "          RPSS\n",
       "year          \n",
Aaron Spring's avatar
Aaron Spring committed
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
       "2000 -0.862483\n",
       "2001 -1.015485\n",
       "2002 -1.101022\n",
       "2003 -1.032647\n",
       "2004 -1.056348\n",
       "2005 -1.165675\n",
       "2006 -1.057217\n",
       "2007 -1.170849\n",
       "2008 -1.049785\n",
       "2009 -1.169108\n",
       "2010 -1.130845\n",
       "2011 -1.052670\n",
       "2012 -1.126449\n",
       "2013 -1.126930\n",
       "2014 -1.095896\n",
       "2015 -1.117486"
1008
1009
      ]
     },
Aaron Spring's avatar
Aaron Spring committed
1010
     "execution_count": 35,
1011
1012
1013
1014
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
Aaron Spring's avatar
Aaron Spring committed
1015
   "source": [
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
    "from scripts import skill_by_year\n",
    "import os\n",
    "if os.environ['HOME'] == '/home/jovyan':\n",
    "    import pandas as pd\n",
    "    # assume on renku with small memory\n",
    "    step = 2\n",
    "    skill_list = []\n",
    "    for year in np.arange(int(time_train_start), int(time_train_end) -1, step): # loop over years to consume less memory on renku\n",
    "        preds_is = create_predictions(cnn, hind_2000_2019, obs_2000_2019, time=slice(str(year), str(year+step-1))).compute()\n",
    "        skill_list.append(skill_by_year(preds_is))\n",
    "    skill = pd.concat(skill_list)\n",
    "else: # with larger memory, simply do\n",
    "    preds_is = create_predictions(cnn, hind_2000_2019, obs_2000_2019, time=slice(time_train_start, time_train_end))\n",
    "    skill = skill_by_year(preds_is)\n",
    "skill"
Aaron Spring's avatar
Aaron Spring committed
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### `predict` validation period out-of-sample"
   ]
  },
  {
   "cell_type": "code",
Aaron Spring's avatar
Aaron Spring committed
1042
   "execution_count": 36,
Aaron Spring's avatar
Aaron Spring committed
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
1066
       "      <th>RPSS</th>\n",
Aaron Spring's avatar
Aaron Spring committed
1067
1068
1069
1070
1071
1072
1073
1074
1075
       "    </tr>\n",
       "    <tr>\n",
       "      <th>year</th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>2018</th>\n",
Aaron Spring's avatar
Aaron Spring committed
1076
       "      <td>-1.099744</td>\n",
Aaron Spring's avatar
Aaron Spring committed
1077
1078
1079
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2019</th>\n",
Aaron Spring's avatar
Aaron Spring committed
1080
       "      <td>-1.172401</td>\n",
Aaron Spring's avatar
Aaron Spring committed
1081
1082
1083
1084
1085
1086
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
1087
       "          RPSS\n",
Aaron Spring's avatar
Aaron Spring committed
1088
       "year          \n",
Aaron Spring's avatar
Aaron Spring committed
1089
1090
       "2018 -1.099744\n",
       "2019 -1.172401"
Aaron Spring's avatar
Aaron Spring committed
1091
1092
      ]
     },
Aaron Spring's avatar
Aaron Spring committed
1093
     "execution_count": 36,
Aaron Spring's avatar
Aaron Spring committed
1094
1095
1096
1097
1098
1099
1100
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "preds_os = create_predictions(cnn, hind_2000_2019, obs_2000_2019, time=slice(time_valid_start, time_valid_end))\n",
    "\n",
1101
    "skill_by_year(preds_os)"
Aaron Spring's avatar
Aaron Spring committed
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### `predict` test"
   ]
  },
  {
   "cell_type": "code",
Aaron Spring's avatar
Aaron Spring committed
1113
   "execution_count": 37,
Aaron Spring's avatar
Aaron Spring committed
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
1137
       "      <th>RPSS</th>\n",
Aaron Spring's avatar
Aaron Spring committed
1138
1139
1140
1141
1142
1143
1144
1145
1146
       "    </tr>\n",
       "    <tr>\n",
       "      <th>year</th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>2020</th>\n",
Aaron Spring's avatar
Aaron Spring committed
1147
       "      <td>-1.076834</td>\n",
Aaron Spring's avatar
Aaron Spring committed
1148
1149
1150
1151
1152
1153
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
1154
1155
       "          RPSS\n",
       "year          \n",
Aaron Spring's avatar
Aaron Spring committed
1156
       "2020 -1.076834"
Aaron Spring's avatar
Aaron Spring committed
1157
1158
      ]
     },
Aaron Spring's avatar
Aaron Spring committed
1159
     "execution_count": 37,
Aaron Spring's avatar
Aaron Spring committed
1160
1161
1162
1163
1164
1165
1166
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "preds_test = create_predictions(cnn, fct_2020, obs_2020, time=time_test)\n",
    "\n",
1167
    "skill_by_year(preds_test)"
Aaron Spring's avatar
Aaron Spring committed
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Submission"
   ]
  },
  {
   "cell_type": "code",
Aaron Spring's avatar
Aaron Spring committed
1179
   "execution_count": 38,
Aaron Spring's avatar
Aaron Spring committed
1180
1181
1182
1183
1184
1185
1186
1187
1188
   "metadata": {},
   "outputs": [],
   "source": [
    "from scripts import assert_predictions_2020\n",
    "assert_predictions_2020(preds_test)"
   ]
  },
  {
   "cell_type": "code",
Aaron Spring's avatar
Aaron Spring committed
1189
   "execution_count": null,
Aaron Spring's avatar
Aaron Spring committed
1190
1191
1192
1193
1194
1195
1196
1197
   "metadata": {},
   "outputs": [],
   "source": [
    "preds_test.to_netcdf('../submissions/ML_prediction_2020.nc')"
   ]
  },
  {
   "cell_type": "code",
1198
   "execution_count": null,
Aaron Spring's avatar
Aaron Spring committed
1199
1200
1201
   "metadata": {},
   "outputs": [],
   "source": [
1202
1203
    "# !git add ../submissions/ML_prediction_2020.nc\n",
    "# !git add ML_train_and_prediction.ipynb"
Aaron Spring's avatar
Aaron Spring committed
1204
1205
1206
1207
1208
1209
1210
1211
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
1212
    "# !git commit -m \"template_test commit message\" # whatever message you want"
Aaron Spring's avatar
Aaron Spring committed
1213
1214
1215
1216
1217
1218
1219
1220
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
1221
    "# !git tag \"submission-template_test-0.0.1\" # if this is to be checked by scorer, only the last submitted==tagged version will be considered"
Aaron Spring's avatar
Aaron Spring committed
1222
1223
1224
1225
1226
1227
1228
1229
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
1230
    "# !git push --tags"
Aaron Spring's avatar
Aaron Spring committed
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Reproducibility"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## memory"
   ]
  },
  {
   "cell_type": "code",
Aaron Spring's avatar
Aaron Spring committed
1256
   "execution_count": 1,
Aaron Spring's avatar
Aaron Spring committed
1257
   "metadata": {},
1258
1259
1260
1261
1262
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
1263
      "              total        used        free      shared  buff/cache   available\n",
Aaron Spring's avatar
Aaron Spring committed
1264
      "Mem:             31           7          11           0          12          24\n",
1265
      "Swap:             0           0           0\n"
1266
1267
1268
     ]
    }
   ],
Aaron Spring's avatar
Aaron Spring committed
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
   "source": [
    "# https://phoenixnap.com/kb/linux-commands-check-memory-usage\n",
    "!free -g"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## CPU"
   ]
  },
  {
   "cell_type": "code",
Aaron Spring's avatar
Aaron Spring committed
1283
   "execution_count": 2,
Aaron Spring's avatar
Aaron Spring committed
1284
   "metadata": {},
1285
1286
1287
1288
1289
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
1290
1291
1292
1293
      "Architecture:                    x86_64\n",
      "CPU op-mode(s):                  32-bit, 64-bit\n",
      "Byte Order:                      Little Endian\n",
      "Address sizes:                   40 bits physical, 48 bits virtual\n",
Aaron Spring's avatar
Aaron Spring committed
1294
1295
      "CPU(s):                          8\n",
      "On-line CPU(s) list:             0-7\n",
1296
1297
      "Thread(s) per core:              1\n",
      "Core(s) per socket:              1\n",
Aaron Spring's avatar
Aaron Spring committed
1298
      "Socket(s):                       8\n",
1299
1300
1301
      "NUMA node(s):                    1\n",
      "Vendor ID:                       GenuineIntel\n",
      "CPU family:                      6\n",
Aaron Spring's avatar
Aaron Spring committed
1302
1303
1304
1305
1306
      "Model:                           85\n",
      "Model name:                      Intel Xeon Processor (Skylake, IBRS)\n",
      "Stepping:                        4\n",
      "CPU MHz:                         2095.078\n",
      "BogoMIPS:                        4190.15\n",
1307
1308
1309
      "Virtualization:                  VT-x\n",
      "Hypervisor vendor:               KVM\n",
      "Virtualization type:             full\n",
Aaron Spring's avatar
Aaron Spring committed
1310
1311
1312
1313
1314
      "L1d cache:                       256 KiB\n",
      "L1i cache:                       256 KiB\n",
      "L2 cache:                        32 MiB\n",
      "L3 cache:                        128 MiB\n",
      "NUMA node0 CPU(s):               0-7\n",
1315
1316
1317
      "Vulnerability Itlb multihit:     KVM: Mitigation: Split huge pages\n",
      "Vulnerability L1tf:              Mitigation; PTE Inversion; VMX conditional cach\n",
      "                                 e flushes, SMT disabled\n",
Aaron Spring's avatar
Aaron Spring committed
1318
1319
      "Vulnerability Mds:               Vulnerable: Clear CPU buffers attempted, no mic\n",
      "                                 rocode; SMT Host state unknown\n",
1320
      "Vulnerability Meltdown:          Mitigation; PTI\n",
Aaron Spring's avatar
Aaron Spring committed
1321
      "Vulnerability Spec store bypass: Vulnerable\n",
1322
1323
1324
1325
      "Vulnerability Spectre v1:        Mitigation; usercopy/swapgs barriers and __user\n",
      "                                  pointer sanitization\n",
      "Vulnerability Spectre v2:        Mitigation; Full generic retpoline, IBPB condit\n",
      "                                 ional, IBRS_FW, STIBP disabled, RSB filling\n",
Aaron Spring's avatar
Aaron Spring committed
1326
1327
      "Vulnerability Srbds:             Not affected\n",
      "Vulnerability Tsx async abort:   Not affected\n",
1328
1329
      "Flags:                           fpu vme de pse tsc msr pae mce cx8 apic sep mtr\n",
      "                                 r pge mca cmov pat pse36 clflush mmx fxsr sse s\n",
Aaron Spring's avatar
Aaron Spring committed
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
      "                                 se2 syscall nx pdpe1gb rdtscp lm constant_tsc r\n",
      "                                 ep_good nopl xtopology cpuid tsc_known_freq pni\n",
      "                                  pclmulqdq vmx ssse3 fma cx16 pcid sse4_1 sse4_\n",
      "                                 2 x2apic movbe popcnt tsc_deadline_timer aes xs\n",
      "                                 ave avx f16c rdrand hypervisor lahf_lm abm 3dno\n",
      "                                 wprefetch cpuid_fault invpcid_single pti ibrs i\n",
      "                                 bpb tpr_shadow vnmi flexpriority ept vpid ept_a\n",
      "                                 d fsgsbase bmi1 avx2 smep bmi2 erms invpcid avx\n",
      "                                 512f avx512dq rdseed adx smap clwb avx512cd avx\n",
      "                                 512bw avx512vl xsaveopt xsavec xgetbv1 arat pku\n",
      "                                  ospke\n"
1341
1342
1343
     ]
    }
   ],
Aaron Spring's avatar
Aaron Spring committed
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
   "source": [
    "!lscpu"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## software"
   ]
  },
  {
   "cell_type": "code",
Aaron Spring's avatar
Aaron Spring committed
1357
   "execution_count": 3,
Aaron Spring's avatar
Aaron Spring committed
1358
   "metadata": {},
1359
1360
1361
1362
1363
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
1364
      "# packages in environment at /opt/conda:\n",
1365
1366
      "#\n",
      "# Name                    Version                   Build  Channel\n",
1367
1368
1369
1370
      "_libgcc_mutex             0.1                 conda_forge    conda-forge\n",
      "_openmp_mutex             4.5                       1_gnu    conda-forge\n",
      "_pytorch_select           0.1                       cpu_0    defaults\n",
      "_tflow_select             2.3.0                       mkl    defaults\n",
Aaron Spring's avatar
Aaron Spring committed
1371
1372
1373
      "absl-py                   0.13.0           py38h06a4308_0    defaults\n",
      "aiobotocore               1.4.1              pyhd3eb1b0_0    defaults\n",
      "aiohttp                   3.7.4.post0      py38h7f8727e_2    defaults\n",
1374
1375
1376
1377
      "aioitertools              0.7.1              pyhd3eb1b0_0    defaults\n",
      "alembic                   1.4.3              pyh9f0ad1d_0    conda-forge\n",
      "ansiwrap                  0.8.4                    pypi_0    pypi\n",
      "appdirs                   1.4.4                    pypi_0    pypi\n",
Aaron Spring's avatar
Aaron Spring committed
1378
      "argcomplete               1.12.3                   pypi_0    pypi\n",
1379
1380
1381
1382
1383
1384
1385
      "argon2-cffi               20.1.0           py38h497a2fe_2    conda-forge\n",
      "argparse                  1.4.0                    pypi_0    pypi\n",
      "asciitree                 0.3.3                      py_2    defaults\n",
      "astor                     0.8.1            py38h06a4308_0    defaults\n",
      "astunparse                1.6.3                      py_0    defaults\n",
      "async-timeout             3.0.1                    pypi_0    pypi\n",
      "async_generator           1.10                       py_0    conda-forge\n",
Aaron Spring's avatar
Aaron Spring committed
1386
      "attrs                     21.2.0                   pypi_0    pypi\n",
1387
1388
1389
      "backcall                  0.2.0              pyh9f0ad1d_0    conda-forge\n",
      "backports                 1.0                        py_2    conda-forge\n",
      "backports.functools_lru_cache 1.6.1                      py_0    conda-forge\n",
Aaron Spring's avatar
Aaron Spring committed
1390
1391
      "bagit                     1.8.1                    pypi_0    pypi\n",
      "beautifulsoup4            4.10.0             pyh06a4308_0    defaults\n",
1392
1393
      "binutils_impl_linux-64    2.35.1               h193b22a_1    conda-forge\n",
      "binutils_linux-64         2.35                h67ddf6f_30    conda-forge\n",
1394
      "black                     20.8b1                   pypi_0    pypi\n",
1395
1396
1397
      "blas                      1.0                         mkl    defaults\n",
      "bleach                    3.2.1              pyh9f0ad1d_0    conda-forge\n",
      "blinker                   1.4                        py_1    conda-forge\n",
Aaron Spring's avatar
Aaron Spring committed
1398
1399
      "bokeh                     2.3.3            py38h06a4308_0    defaults\n",
      "botocore                  1.20.106           pyhd3eb1b0_0    defaults\n",
1400
      "bottleneck                1.3.2            py38heb32a55_1    defaults\n",
Aaron Spring's avatar
Aaron Spring committed
1401
      "bracex                    2.1.1                    pypi_0    pypi\n",
1402
      "branca                    0.3.1                    pypi_0    pypi\n",
Aaron Spring's avatar
Aaron Spring committed
1403
      "brotli                    1.0.9                he6710b0_2    defaults\n",
1404
1405
1406
      "brotlipy                  0.7.0           py38h497a2fe_1001    conda-forge\n",
      "bzip2                     1.0.8                h7f98852_4    conda-forge\n",
      "c-ares                    1.17.1               h36c2ea0_0    conda-forge\n",
Aaron Spring's avatar
Aaron Spring committed
1407
1408
1409
1410
      "ca-certificates           2021.7.5             h06a4308_1    defaults\n",
      "cachecontrol              0.12.6                   pypi_0    pypi\n",
      "cachetools                4.2.4                    pypi_0    pypi\n",
      "calamus                   0.3.12                   pypi_0    pypi\n",
1411
      "cdsapi                    0.5.1                    pypi_0    pypi\n",
Aaron Spring's avatar
Aaron Spring committed
1412
      "certifi                   2021.5.30                pypi_0    pypi\n",
1413
      "certipy                   0.1.3                      py_0    conda-forge\n",
Aaron Spring's avatar
Aaron Spring committed
1414
      "cffi                      1.14.6                   pypi_0    pypi\n",
1415
1416
      "cfgrib                    0.9.9.0            pyhd8ed1ab_1    conda-forge\n",
      "cftime                    1.5.0            py38h6323ea4_0    defaults\n",
Aaron Spring's avatar
Aaron Spring committed
1417
      "chardet                   3.0.4                    pypi_0    pypi\n",
1418
      "click                     7.1.2                    pypi_0    pypi\n",
Aaron Spring's avatar
Aaron Spring committed
1419
1420
1421
1422
1423
1424
      "click-completion          0.5.2                    pypi_0    pypi\n",
      "click-option-group        0.5.3                    pypi_0    pypi\n",
      "click-plugins             1.1.1                    pypi_0    pypi\n",
      "climetlab                 0.8.31                   pypi_0    pypi\n",
      "climetlab-s2s-ai-challenge 0.8.0                    pypi_0    pypi\n",
      "cloudpickle               2.0.0              pyhd3eb1b0_0    defaults\n",
1425
      "colorama                  0.4.4                    pypi_0    pypi\n",
Aaron Spring's avatar
Aaron Spring committed
1426
1427
      "coloredlogs               15.0.1                   pypi_0    pypi\n",
      "commonmark                0.9.1                    pypi_0    pypi\n",
1428
1429
      "conda                     4.9.2            py38h578d9bd_0    conda-forge\n",
      "conda-package-handling    1.7.2            py38h8df0ef7_0    conda-forge\n",
Aaron Spring's avatar
Aaron Spring committed
1430
      "configargparse            1.5.2                    pypi_0    pypi\n",
1431
1432
      "configurable-http-proxy   1.3.0                         0    conda-forge\n",
      "coverage                  5.5              py38h27cfd23_2    defaults\n",
Aaron Spring's avatar
Aaron Spring committed
1433
      "cryptography              3.4.8                    pypi_0    pypi\n",
1434
      "curl                      7.71.1               he644dc0_8    conda-forge\n",
Aaron Spring's avatar
Aaron Spring committed
1435
1436
      "cwlgen                    0.4.2                    pypi_0    pypi\n",
      "cwltool                   3.1.20211004060744          pypi_0    pypi\n",
1437
      "cycler                    0.10.0                   py38_0    defaults\n",
Aaron Spring's avatar
Aaron Spring committed
1438
      "cython                    0.29.24          py38h295c915_0    defaults\n",
1439
      "cytoolz                   0.11.0           py38h7b6447c_0    defaults\n",
Aaron Spring's avatar
Aaron Spring committed
1440
1441
1442
      "dask                      2021.8.1           pyhd3eb1b0_0    defaults\n",
      "dask-core                 2021.8.1           pyhd3eb1b0_0    defaults\n",
      "dataclasses               0.8                pyh6d0b6a4_7    defaults\n",
1443
1444
      "decorator                 4.4.2                      py_0    conda-forge\n",
      "defusedxml                0.6.0                      py_0    conda-forge\n",
Aaron Spring's avatar
Aaron Spring committed
1445
      "distributed               2021.8.1         py38h06a4308_0    defaults\n",
1446
1447
      "distro                    1.5.0                    pypi_0    pypi\n",
      "docopt                    0.6.2            py38h06a4308_0    defaults\n",
Aaron Spring's avatar
Aaron Spring committed
1448
      "eccodes                   2.21.0               ha0e6eb6_0    conda-forge\n",
1449
      "ecmwf-api-client          1.6.1                    pypi_0    pypi\n",
Aaron Spring's avatar
Aaron Spring committed
1450
      "ecmwflibs                 0.3.14                   pypi_0    pypi\n",
1451
      "entrypoints               0.3             pyhd8ed1ab_1003    conda-forge\n",
Aaron Spring's avatar
Aaron Spring committed
1452
1453
1454
      "environ-config            21.2.0                   pypi_0    pypi\n",
      "fasteners                 0.16.3             pyhd3eb1b0_0    defaults\n",
      "filelock                  3.0.12                   pypi_0    pypi\n",
1455
      "findlibs                  0.0.2                    pypi_0    pypi\n",
Aaron Spring's avatar
Aaron Spring committed
1456
      "fonttools                 4.25.0             pyhd3eb1b0_0    defaults\n",
1457
      "freetype                  2.10.4               h5ab3b9f_0    defaults\n",
Aaron Spring's avatar
Aaron Spring committed
1458
1459
1460
      "frozendict                2.0.6                    pypi_0    pypi\n",
      "fsspec                    2021.7.0           pyhd3eb1b0_0    defaults\n",
      "gast                      0.4.0              pyhd3eb1b0_0    defaults\n",
1461
1462
1463
1464
      "gcc_impl_linux-64         9.3.0               h70c0ae5_18    conda-forge\n",
      "gcc_linux-64              9.3.0               hf25ea35_30    conda-forge\n",
      "gitdb                     4.0.7                    pypi_0    pypi\n",
      "gitpython                 3.1.14                   pypi_0    pypi\n",
Aaron Spring's avatar
Aaron Spring committed
1465
      "google-auth               1.33.0             pyhd3eb1b0_0    defaults\n",
1466
      "google-auth-oauthlib      0.4.4              pyhd3eb1b0_0    defaults\n",
Aaron Spring's avatar
Aaron Spring committed
1467
      "google-pasta              0.2.0              pyhd3eb1b0_0    defaults\n",
1468
1469
1470
1471
1472
1473
      "grpcio                    1.36.1           py38h2157cd5_1    defaults\n",
      "gxx_impl_linux-64         9.3.0               hd87eabc_18    conda-forge\n",
      "gxx_linux-64              9.3.0               h3fbe746_30    conda-forge\n",
      "h5netcdf                  0.11.0             pyhd8ed1ab_0    conda-forge\n",
      "h5py                      2.10.0           py38hd6299e0_1    defaults\n",
      "hdf4                      4.2.13               h3ca952b_2    defaults\n",
Aaron Spring's avatar
Aaron Spring committed
1474
1475
1476
1477
      "hdf5                      1.10.6          nompi_h6a2412b_1114    conda-forge\n",
      "heapdict                  1.0.1              pyhd3eb1b0_0    defaults\n",
      "humanfriendly             10.0                     pypi_0    pypi\n",
      "humanize                  3.7.1                    pypi_0    pypi\n",
1478
1479
1480
1481
      "icu                       68.1                 h58526e2_0    conda-forge\n",
      "idna                      2.10               pyh9f0ad1d_0    conda-forge\n",
      "importlib-metadata        3.4.0            py38h578d9bd_0    conda-forge\n",
      "importlib_metadata        3.4.0                hd8ed1ab_0    conda-forge\n",
Aaron Spring's avatar
Aaron Spring committed
1482
      "intake                    0.6.3              pyhd3eb1b0_0    defaults\n",
1483
1484
1485
1486
      "intake-xarray             0.5.0              pyhd3eb1b0_0    defaults\n",
      "intel-openmp              2019.4                      243    defaults\n",
      "ipykernel                 5.4.2            py38h81c977d_0    conda-forge\n",
      "ipython                   7.19.0           py38h81c977d_2    conda-forge\n",
1487
      "ipython_genutils          0.2.0                      py_1    conda-forge\n",
Aaron Spring's avatar
Aaron Spring committed
1488
      "isodate                   0.6.0                    pypi_0    pypi\n",
1489
1490
      "jasper                    1.900.1              hd497a04_4    defaults\n",
      "jedi                      0.17.2           py38h578d9bd_1    conda-forge\n",
Aaron Spring's avatar
Aaron Spring committed
1491
1492
1493
      "jellyfish                 0.8.8                    pypi_0    pypi\n",
      "jinja2                    3.0.1                    pypi_0    pypi\n",
      "jmespath                  0.10.0             pyhd3eb1b0_0    defaults\n",
1494
      "joblib                    1.0.1              pyhd3eb1b0_0    defaults\n",
Aaron Spring's avatar
Aaron Spring committed
1495
      "jpeg                      9d                   h7f8727e_0    defaults\n",
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
      "json5                     0.9.5              pyh9f0ad1d_0    conda-forge\n",
      "jsonschema                3.2.0                      py_2    conda-forge\n",
      "jupyter-server-proxy      1.6.0                    pypi_0    pypi\n",
      "jupyter_client            6.1.11             pyhd8ed1ab_1    conda-forge\n",
      "jupyter_core              4.7.0            py38h578d9bd_0    conda-forge\n",
      "jupyter_telemetry         0.1.0              pyhd8ed1ab_1    conda-forge\n",
      "jupyterhub                1.2.2                    pypi_0    pypi\n",
      "jupyterlab                2.2.9                      py_0    conda-forge\n",
      "jupyterlab-git            0.23.3                   pypi_0    pypi\n",
      "jupyterlab_pygments       0.1.2              pyh9f0ad1d_0    conda-forge\n",
      "jupyterlab_server         1.2.0                      py_0    conda-forge\n",
      "keras-preprocessing       1.1.2              pyhd3eb1b0_0    defaults\n",
      "kernel-headers_linux-64   2.6.32              h77966d4_13    conda-forge\n",
      "kiwisolver                1.3.1            py38h2531618_0    defaults\n",
      "krb5                      1.17.2               h926e7f8_0    conda-forge\n",
Aaron Spring's avatar
Aaron Spring committed
1511
      "lazy-object-proxy         1.6.0                    pypi_0    pypi\n",
1512
1513
1514
      "lcms2                     2.12                 h3be6417_0    defaults\n",
      "ld_impl_linux-64          2.35.1               hea4e1c9_1    conda-forge\n",
      "libaec                    1.0.4                he6710b0_1    defaults\n",
Aaron Spring's avatar
Aaron Spring committed
1515
1516
      "libblas                   3.9.0           1_h86c2bf4_netlib    conda-forge\n",
      "libcblas                  3.9.0           5_h92ddd45_netlib    conda-forge\n",
1517
1518
1519
1520
1521
1522
      "libcurl                   7.71.1               hcdd3856_8    conda-forge\n",
      "libedit                   3.1.20191231         he28a2e2_2    conda-forge\n",
      "libev                     4.33                 h516909a_1    conda-forge\n",
      "libffi                    3.3                  h58526e2_2    conda-forge\n",
      "libgcc-devel_linux-64     9.3.0               h7864c58_18    conda-forge\n",
      "libgcc-ng                 9.3.0               h2828fa1_18    conda-forge\n",
Aaron Spring's avatar
Aaron Spring committed
1523
1524
      "libgfortran-ng            9.3.0               ha5ec8a7_17    defaults\n",
      "libgfortran5              9.3.0               ha5ec8a7_17    defaults\n",
1525
      "libgomp                   9.3.0               h2828fa1_18    conda-forge\n",
Aaron Spring's avatar
Aaron Spring committed
1526
      "liblapack                 3.9.0           5_h92ddd45_netlib    conda-forge\n",
1527
1528
1529
1530
1531
      "libllvm10                 10.0.1               hbcb73fb_5    defaults\n",
      "libmklml                  2019.0.5                      0    defaults\n",
      "libnetcdf                 4.7.4           nompi_h56d31a8_107    conda-forge\n",
      "libnghttp2                1.41.0               h8cfc5f6_2    conda-forge\n",
      "libpng                    1.6.37               hbc83047_0    defaults\n",
Aaron Spring's avatar
Aaron Spring committed
1532
      "libprotobuf               3.17.2               h4ff587b_1    defaults\n",
1533
      "libsodium                 1.0.18               h36c2ea0_1    conda-forge\n",
1534
1535
1536
1537
1538
1539
1540
1541
      "libssh2                   1.9.0                hab1572f_5    conda-forge\n",
      "libstdcxx-devel_linux-64  9.3.0               hb016644_18    conda-forge\n",
      "libstdcxx-ng              9.3.0               h6de172a_18    conda-forge\n",
      "libtiff                   4.2.0                h85742a9_0    defaults\n",
      "libuv                     1.40.0               h7f98852_0    conda-forge\n",
      "libwebp-base              1.2.0                h27cfd23_0    defaults\n",
      "llvmlite                  0.36.0           py38h612dafd_4    defaults\n",
      "locket                    0.2.1            py38h06a4308_1    defaults\n",
Aaron Spring's avatar
Aaron Spring committed
1542
1543
1544
      "lockfile                  0.12.2                   pypi_0    pypi\n",
      "lxml                      4.6.3                    pypi_0    pypi\n",
      "lz4-c                     1.9.3                h295c915_1    defaults\n",
1545
      "magics                    1.5.6                    pypi_0    pypi\n",
1546
1547
      "mako                      1.1.4              pyh44b312d_0    conda-forge\n",
      "markdown                  3.3.4            py38h06a4308_0    defaults\n",
Aaron Spring's avatar
Aaron Spring committed
1548
1549
1550
      "markupsafe                2.0.1                    pypi_0    pypi\n",
      "marshmallow               3.13.0                   pypi_0    pypi\n",
      "matplotlib-base           3.4.2            py38hab158f2_0    defaults\n",
1551
1552
1553
1554
1555
1556
1557
      "mistune                   0.8.4           py38h497a2fe_1003    conda-forge\n",
      "mkl                       2020.2                      256    defaults\n",
      "mkl-service               2.3.0            py38he904b0f_0    defaults\n",
      "mkl_fft                   1.3.0            py38h54f3939_0    defaults\n",
      "mkl_random                1.1.1            py38h0573a6f_0    defaults\n",
      "msgpack-python            1.0.2            py38hff7bd54_1    defaults\n",
      "multidict                 5.1.0            py38h27cfd23_2    defaults\n",
Aaron Spring's avatar
Aaron Spring committed
1558
      "munkres                   1.1.4                      py_0    defaults\n",
1559
      "mypy-extensions           0.4.3                    pypi_0    pypi\n",
1560
1561
1562
1563
1564
      "nbclient                  0.5.0                    pypi_0    pypi\n",
      "nbconvert                 6.0.7            py38h578d9bd_3    conda-forge\n",
      "nbdime                    2.1.0                    pypi_0    pypi\n",
      "nbformat                  5.1.2              pyhd8ed1ab_1    conda-forge\n",
      "nbresuse                  0.4.0                    pypi_0    pypi\n",
Aaron Spring's avatar
Aaron Spring committed
1565
      "nc-time-axis              1.3.1              pyhd8ed1ab_2    conda-forge\n",
1566
      "ncurses                   6.2                  h58526e2_4    conda-forge\n",
Aaron Spring's avatar
Aaron Spring committed
1567
      "ndg-httpsclient           0.5.1                    pypi_0    pypi\n",
1568
1569
      "nest-asyncio              1.4.3              pyhd8ed1ab_0    conda-forge\n",
      "netcdf4                   1.5.4                    pypi_0    pypi\n",
Aaron Spring's avatar
Aaron Spring committed
1570
      "networkx                  2.6.3                    pypi_0    pypi\n",
1571
1572
1573
1574
      "ninja                     1.10.2               hff7bd54_1    defaults\n",
      "nodejs                    15.3.0               h25f6087_0    conda-forge\n",
      "notebook                  6.2.0            py38h578d9bd_0    conda-forge\n",
      "numba                     0.53.1           py38ha9443f7_0    defaults\n",
Aaron Spring's avatar
Aaron Spring committed
1575
1576
      "numcodecs                 0.8.0            py38h2531618_0    defaults\n",
      "numexpr                   2.7.3            py38hb2eb853_0    defaults\n",
1577
1578
1579
      "numpy                     1.19.2           py38h54aff64_0    defaults\n",
      "numpy-base                1.19.2           py38hfa32c7d_0    defaults\n",
      "oauthlib                  3.0.1                      py_0    conda-forge\n",
Aaron Spring's avatar
Aaron Spring committed
1580
1581
1582
      "olefile                   0.46               pyhd3eb1b0_0    defaults\n",
      "openjpeg                  2.4.0                h3ad879b_0    defaults\n",
      "openssl                   1.1.1l               h7f8727e_0    defaults\n",
1583
      "opt_einsum                3.3.0              pyhd3eb1b0_1    defaults\n",
Aaron Spring's avatar
Aaron Spring committed
1584
      "owlrl                     5.2.3                    pypi_0    pypi\n",
1585
1586
      "packaging                 20.8               pyhd3deb0d_0    conda-forge\n",
      "pamela                    1.0.0                      py_0    conda-forge\n",
Aaron Spring's avatar
Aaron Spring committed
1587
      "pandas                    1.3.2            py38h8c16a72_0    defaults\n",
1588
1589
1590
1591
1592
      "pandoc                    2.11.3.2             h7f98852_0    conda-forge\n",
      "pandocfilters             1.4.2                      py_1    conda-forge\n",
      "papermill                 2.3.1                    pypi_0    pypi\n",
      "parso                     0.7.1              pyh9f0ad1d_0    conda-forge\n",
      "partd                     1.2.0              pyhd3eb1b0_0    defaults\n",
Aaron Spring's avatar
Aaron Spring committed
1593
1594
1595
      "pathspec                  0.9.0                    pypi_0    pypi\n",
      "patool                    1.12                     pypi_0    pypi\n",
      "pdbufr                    0.9.0                    pypi_0    pypi\n",
1596
1597
      "pexpect                   4.8.0              pyh9f0ad1d_2    conda-forge\n",
      "pickleshare               0.7.5                   py_1003    conda-forge\n",
Aaron Spring's avatar
Aaron Spring committed
1598
      "pillow                    8.3.1            py38h2c7a002_0    defaults\n",
1599
1600
      "pip                       21.0.1                   pypi_0    pypi\n",
      "pipx                      0.16.1.0                 pypi_0    pypi\n",
Aaron Spring's avatar
Aaron Spring committed
1601
1602
      "pluggy                    0.13.1                   pypi_0    pypi\n",
      "portalocker               2.3.2                    pypi_0    pypi\n",
1603
1604
1605
      "powerline-shell           0.7.0                    pypi_0    pypi\n",
      "prometheus_client         0.9.0              pyhd3deb0d_0    conda-forge\n",
      "prompt-toolkit            3.0.10             pyha770c72_0    conda-forge\n",
1606
      "properscoring             0.1                        py_0    conda-forge\n",
Aaron Spring's avatar
Aaron Spring committed
1607
1608
      "protobuf                  3.17.2           py38h295c915_0    defaults\n",
      "prov                      1.5.1                    pypi_0    pypi\n",
1609
1610
      "psutil                    5.8.0            py38h27cfd23_1    defaults\n",
      "ptyprocess                0.7.0              pyhd3deb0d_0    conda-forge\n",
Aaron Spring's avatar
Aaron Spring committed
1611
      "pyasn1                    0.4.8              pyhd3eb1b0_0    defaults\n",
1612
1613
1614
1615
      "pyasn1-modules            0.2.8                      py_0    defaults\n",
      "pycosat                   0.6.3           py38h497a2fe_1006    conda-forge\n",
      "pycparser                 2.20               pyh9f0ad1d_2    conda-forge\n",
      "pycurl                    7.43.0.6         py38h996a351_1    conda-forge\n",
1616
      "pydap                     3.2.2           pyh9f0ad1d_1001    conda-forge\n",
Aaron Spring's avatar
Aaron Spring committed
1617
1618
1619
1620
1621
      "pydot                     1.4.2                    pypi_0    pypi\n",
      "pygments                  2.10.0                   pypi_0    pypi\n",
      "pyjwt                     2.1.0                    pypi_0    pypi\n",
      "pyld                      2.0.3                    pypi_0    pypi\n",
      "pyodc                     1.1.1                    pypi_0    pypi\n",
1622
1623
1624
      "pyopenssl                 20.0.1             pyhd8ed1ab_0    conda-forge\n",
      "pyparsing                 2.4.7              pyh9f0ad1d_0    conda-forge\n",
      "pyrsistent                0.17.3           py38h497a2fe_2    conda-forge\n",
Aaron Spring's avatar
Aaron Spring committed
1625
      "pyshacl                   0.17.0.post1             pypi_0    pypi\n",
1626
1627
1628
      "pysocks                   1.7.1            py38h578d9bd_3    conda-forge\n",
      "python                    3.8.6           hffdb5ce_4_cpython    conda-forge\n",
      "python-dateutil           2.8.1                      py_0    conda-forge\n",
Aaron Spring's avatar
Aaron Spring committed
1629
1630
      "python-eccodes            2021.03.0        py38hb5d20a5_1    conda-forge\n",
      "python-editor             1.0.4                    pypi_0    pypi\n",
1631
1632