We greatly look forward to hosting a hands-on tutorial on "Learning the Fundamentals of Machine Learning through Forecasting El Niño at the NOAA AI Workshop Tutorial.
This notebook requires the following libraries: numpy, xarray, netCDF4, pandas, matplotlib, sklearn, tqdm, pytorch, scipy. Furthermore, it is strongly recommended that you use this notebook on Google Colab for ease of use and for access to GPU resources.
To check that the software setup is correct, please follow these steps:
Press "Open in Colab" at the top of the notebook
In the Colab window, select "Edit > Notebook settings > Hardware Accelerator > GPU"
Run the code cells below, which set up the programming environment and load the necessary data.
If you have any issues with these two cells, please email ankur.mahesh@berkeley.edu with the subject line 'NOAA AI Workshop Setup'
%matplotlib inline
import xarray as xr
import pandas as pd
import numpy as np
from matplotlib import pyplot as plt
import sklearn
import sklearn.ensemble
import scipy.stats
from sklearn.model_selection import train_test_split
from tqdm import tqdm
import xarray as xr
import pandas as pd
import numpy as np
from matplotlib import pyplot as plt
import sklearn
import sklearn.ensemble
import scipy.stats
from sklearn.model_selection import train_test_split
import torch
import torchvision
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
from torch.utils.data import Dataset, DataLoader
from scipy.stats import pearsonr
from sklearn.metrics import mean_squared_error
If the above cell runs successfully, you will not see any ImportErrors
.
!pip install netCDF4
!wget http://portal.nersc.gov/project/dasrepo/AGU_ML_Tutorial/sst.mon.mean.trefadj.anom.1880to2018.nc
!wget http://portal.nersc.gov/project/dasrepo/AGU_ML_Tutorial/nino34.long.anom.data.txt
If the above code cells runs successfully, you will see this output:
Collecting netCDF4
Downloading https://files.pythonhosted.org/packages/09/39/3687b2ba762a709cd97e48dfaf3ae36a78ae603ec3d1487f767ad58a7b2e/netCDF4-1.5.4-cp36-cp36m-manylinux1_x86_64.whl (4.3MB)
|████████████████████████████████| 4.3MB 2.9MB/s
Requirement already satisfied: numpy>=1.9 in /usr/local/lib/python3.6/dist-packages (from netCDF4) (1.18.5)
Collecting cftime
Downloading https://files.pythonhosted.org/packages/81/f4/31cb9b65f462ea960bd334c5466313cb7b8af792f272546b68b7868fccd4/cftime-1.2.1-cp36-cp36m-manylinux1_x86_64.whl (287kB)
|████████████████████████████████| 296kB 34.2MB/s
Installing collected packages: cftime, netCDF4
Successfully installed cftime-1.2.1 netCDF4-1.5.4
--2020-10-08 16:50:29-- http://portal.nersc.gov/project/dasrepo/AGU_ML_Tutorial/sst.mon.mean.trefadj.anom.1880to2018.nc
Resolving portal.nersc.gov (portal.nersc.gov)... 128.55.206.26, 128.55.206.28
Connecting to portal.nersc.gov (portal.nersc.gov)|128.55.206.26|:80... connected.
HTTP request sent, awaiting response... 301 Moved Permanently
Location: https://portal.nersc.gov/project/dasrepo/AGU_ML_Tutorial/sst.mon.mean.trefadj.anom.1880to2018.nc [following]
--2020-10-08 16:50:29-- https://portal.nersc.gov/project/dasrepo/AGU_ML_Tutorial/sst.mon.mean.trefadj.anom.1880to2018.nc
Connecting to portal.nersc.gov (portal.nersc.gov)|128.55.206.26|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 432481041 (412M) [application/x-netcdf]
Saving to: ‘sst.mon.mean.trefadj.anom.1880to2018.nc’
sst.mon.mean.trefad 100%[===================>] 412.45M 15.7MB/s in 27s
2020-10-08 16:50:57 (15.5 MB/s) - ‘sst.mon.mean.trefadj.anom.1880to2018.nc’ saved [432481041/432481041]
URL transformed to HTTPS due to an HSTS policy
--2020-10-08 16:50:57-- https://portal.nersc.gov/project/dasrepo/AGU_ML_Tutorial/nino34.long.anom.data.txt
Resolving portal.nersc.gov (portal.nersc.gov)... 128.55.206.26, 128.55.206.28
Connecting to portal.nersc.gov (portal.nersc.gov)|128.55.206.26|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 15449 (15K) [text/plain]
Saving to: ‘nino34.long.anom.data.txt’
nino34.long.anom.da 100%[===================>] 15.09K --.-KB/s in 0.09s
2020-10-08 16:50:57 (167 KB/s) - ‘nino34.long.anom.data.txt’ saved [15449/15449]```