Comparing Two Climate Models¶
In this notebook, I will be comparing two climate reanalysis models:
- NCEP-DOE Reanalysis 2: Surface
- ERA5
I will be looking at the following variables:
- Surface Pressure
- Mean Sea Level Pressure
- Total Column Water
The idea is simple: these two models should have very similar properties. I will be trying to user RBIG in order to assess how similar these models are. I'll be looking at the following IT measures
- Entropy
- Total Correlation
- Mutual Information
If these climate models are that similar, then they should exhibit similar IT measures.
Data - Climate Models¶
import os, sys
cwd = os.getcwd()
source_path = f"{cwd}/../../../"
sys.path.insert(0, f'{source_path}')
import numpy as np
# Data Loaders
from src.data.climate.rcp import DataDownloader as DDRCP
from src.data.climate.historical import DataDownloader as DDHist
from src.data.climate.rcp import DataLoader
# ESDC tools
sys.path.insert(0, f'/home/emmanuel/code/py_esdc')
from esdc.standardize import normalize_temporal
from esdc.grid import regrid_data
import cdsapi
from zipfile import ZipFile
import pandas as pd
import xarray as xr
from tqdm import tqdm
from sklearn import preprocessing
import seaborn as sns
import matplotlib.pyplot as plt
plt.style.use('ggplot')
%matplotlib inline
%load_ext autoreload
%autoreload 2
data_path = f"/home/emmanuel/projects/2020_rbig_rs/data/climate/raw/rcp/"
results_path = f"/home/emmanuel/projects/2020_rbig_rs/data/climate/results/"
fig_path = f"/home/emmanuel/projects/2020_rbig_rs/reports/figures/climate/"
Download Datasets¶
downloader = DDRCP()
downloader.download_all()
downloader = DDHist()
downloader.download_all()
Load Datasets¶
loader = DataLoader()
dataset = 'ipsl_cm5a_mr'
xr_data = loader.load_rcp_data(dataset)
xr_data
Testing¶
datasets = [
"inmcm4",
"access1_0",
"access1_3",
"ipsl_cm5a_mr",
"mpi_esm_lr",
"mpi_esm_mr",
"noresm1_m",
]
loader = DataLoader()
for idataset in datasets:
print(idataset)
data = loader.load_rcp_data(idataset)
print(data.psl.shape)
assert(type(data) is xr.Dataset)