One of the exercises for the second Critical Earth ESR Workshop (April 2022, Berg en Dal, Netherlands)
In this exercise you will deal with machine learning prediction of heatwaves. For instructions please view the exercises pdf.
There are two main option to perform this exercise: either on your local machine, or on google Colab.
There are instruction on how to download the data within the jupyter notebooks, alternative the data is available from 500 years of Plasim
-
Click on this link. It is a google drive folder with the data you will need.
-
Right click on
ew2.ipynb
and then onMake a Copy
-
Go in the folder
data
and for every file in the folder add a shortcut to your drive following these steps- Right click on the file
- Click on
Add a shortcut to Drive
- Select
My Drive
- Click
ADD SHORTCUT
-
Go to your own drive and right click on
ew2.ipynb
-
Click
Open with
and selectGoogle Colaboratory
. If the option doesn't show follow these steps:- Click on
Connect more apps
- Go to
Search apps
- Type
Colaboratory
- Click on it and follow the installation
- Click on
-
Once you manage to open the notebook with Google Colaboratory, go to
Runtime
->Change Runtime Type
and select GPU.
colab-tutorial.mp4
This makes sense if your personal computer has a decent GPU, otherwise, it is easier to run the code online. See below
Depending on which operating system you are using there is a possibility to use Anaconda and/or homebrew (on Mac). In some cases path variable must be provided.
It is highly suggested to create a conda environment and work from that, so you don't mess up your own base environment. For details on how to work with conda environments see the following link how to manage environments
Start by creating a new python 3.9 environment, let's call it ew2
conda create -n ew2 python=3.9
conda activate ew2
Then install the required packages
conda install -c conda-forge numpy pandas xarray matplotlib plotly tqdm optuna cartopy nc-time-axis ipykernel netcdf4 ipympl scikit-learn
Install machine learning package: either tensorflow (suggested if you don't have much experience with deep learning. Also the examples are implemented in tensorflow)
conda install -c conda-forge tensorflow
or pytorch (lower level programming with respect to tensorflow, but allows a more capillar and versatile control of what you are doing)
conda install pytorch torchvision cudatoolkit -c pytorch