Hello! This the assignment for learning how to use RRTMG, which is the global climate model version of
the Rapid Radiative Transfer Model (RRTM). While the original model is written in Fortran, climlab
provides a
Python wrapper for RRTMG, which we'll be using in this in-class lab session.
There are three main files that require your attention:
- README.md
- RRTMG_InClass.ipynb
- RRTMG_Pre-class.ipynb
README.md
: Basically this documentation that you are reading right now. Please follow the instructions to set up the required environment and fetch the notebooks, and feel free to reach out if you face any difficulty when running the notebooks!RRTMG_InClass.ipynb
: The working notebook that we will be using on November 17's lecture. Feel free to glance through the text in the notebook to get a better sense of the data and the RRTMG model that we will be working with on Friday.RRTMG_Pre-class.ipynb
: A quick 5-minute read - the goal is to breifly have an idea of what simulation output from global climate models would look like, and the lines of code that calls the RRTMG model using the Climlab package.
Additional References:
- inclass_func.py
inclass_func.py
: This is a python script that contains all functions called fromRRTMG_InClass.ipynb
andRRTMG_InClass_full.ipynb
. All lines of code called from the in-class working notebook are detailed here, including model calls and figure plotting.
We recommend creating a new environment or using an existing non-base environment for this. Here is the one line code to make new environment and install all the necessary libraries
- To do this all in one line:
conda create --name rrtmg python=3.10 climlab climlab-rrtmg numpy=1.23 numba matplotlib jupyter ipykernel --channel conda-forge
This should be fairly straightforward. All dependencies should be installed automatically if they're not already present in your directory. If you want to do this installing packages line by line there are also instructions for this down below.
- Then you can activate your environment
conda activate rrtmg
- In order for the packages to work, you'll need to open your Jupyter Notebook in the new environment
. If you'd like to set up one in Keeling but haven't before, we suggest using Max Grover's tutorial.
You can download all the files or git clone
this repo into your home directory by the following line of code, and it should be ready to run!
git clone https://github.com/PappuP/RRTMG_ATMS511.git
- To create a new environment called
rrtmg
:
conda create --name rrtmg
(Alternative) To copy an environment you already have to make a new one:
conda create --clone [existing environment] -n [new environment]
- To activate your environment:
conda activate rrtmg
- Installing climlab in the new environment:
conda install pip
pip install ipykernel # create a new kernel to run the notebook in
conda install -c conda-forge climlab matplotlib numba # Download climlab
conda install climlab-rrtmg --channel conda-forge # Download the RRTMG specific package of climlab
....
You'll need to install numpy 1.23, jupyter, and ipykernel as well as having Python 3.10.
If the notebook crashes while running, the steps below may be necessary.
- Install
nb_conda_kernels
in yourbase
environment (i.e. after you typedbash
+enter
on Keeling).
conda install -c conda-forge nb_conda_kernels
Once this is installed, kernels in all environment that has ipykernel installed will be automatically shown in any notebook running from the base environment (i.e. jupyter notebooks launched in the Keeling login node).
- Open Jupyter Notebooks from your base environment and follow the steps below
In the top pannel of the notebook find
Kernel>>change kernel>>select your new env kernel
- Climlab
- Conda cheat sheet
- The Climate Laboratory
- Atmospheric and Environmental Research RRTMG Webpage
Content from this repository are fully based on code and model developed by AER (RRTMG-LW, RRTMG-SW) and Dr Brian Rose (Climlab). The in-class assignemnt ideas are inspired from Dr Rose's The Climate Laboratory textbook.