In [1]:
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns

In [2]:
df = pd.read_csv('drifts_reformatted.csv')

In [3]:
df


Out[3]:
model run project variable drift
0 ACCESS1-0 r1i1p1 CMIP5 thermal OHC (J yr-1) 1.730000e+21
1 ACCESS1-3 r1i1p1 CMIP5 thermal OHC (J yr-1) -1.800000e+21
2 BCC-CSM1-1 r1i1p1 CMIP5 thermal OHC (J yr-1) 7.520000e+19
3 BCC-CSM1.1(m) r1i1p1 CMIP5 thermal OHC (J yr-1) 1.950000e+20
4 BNU-ESM r1i1p1 CMIP5 thermal OHC (J yr-1) 3.870000e+21
... ... ... ... ... ...
223 HadGEM3-GC31-LL r1i1p1f1 CMIP6 soga (g/kg yr-1) 6.670000e-07
224 IPSL-CM6A-LR r1i1p1f1 CMIP6 soga (g/kg yr-1) -9.180000e-07
225 IPSL-CM6A-LR r1i2p1f1 CMIP6 soga (g/kg yr-1) -9.210000e-07
226 MPI-ESM1-2-HR r1i1p1f1 CMIP6 soga (g/kg yr-1) -2.540000e-07
227 UKESM1-0-LL r1i1p1f2 CMIP6 soga (g/kg yr-1) -2.830000e-06

228 rows × 5 columns


In [18]:
df_subset = df[df['variable'] == 'thermal OHC (J yr-1)']
df_subset['drift'] = df_subset['drift'].abs()

sns.boxplot(x="project", y="drift", data=df_subset)
plt.title('OHC temperature component')
plt.show()


<ipython-input-18-e801ff78880d>:2: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame.
Try using .loc[row_indexer,col_indexer] = value instead

See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy
  df_subset['drift'] = df_subset['drift'].abs()

In [20]:
df_subset = df[df['variable'] == 'hfds (J yr-1)']
df_subset['drift'] = df_subset['drift'].abs()

sns.boxplot(x="project", y="drift", data=df_subset)
plt.title('surface heat flux')
plt.ylim(0, 1e22)
plt.show()


<ipython-input-20-8e70e82ddb49>:2: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame.
Try using .loc[row_indexer,col_indexer] = value instead

See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy
  df_subset['drift'] = df_subset['drift'].abs()

In [16]:
df_subset['drift'] = df_subset['drift'].abs()


<ipython-input-16-974c88bc26fb>:1: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame.
Try using .loc[row_indexer,col_indexer] = value instead

See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy
  df_subset['drift'] = df_subset['drift'].abs()

In [21]:
df_subset = df[df['variable'] == 'netTOA (J yr-1)']
df_subset['drift'] = df_subset['drift'].abs()

sns.boxplot(x="project", y="drift", data=df_subset)
plt.title('netTOA')
plt.show()


<ipython-input-21-fa3f1ca4b178>:2: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame.
Try using .loc[row_indexer,col_indexer] = value instead

See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy
  df_subset['drift'] = df_subset['drift'].abs()

In [24]:
df_subset = df[df['variable'] == 'wfo (kg yr-1)']
df_subset['drift'] = df_subset['drift'].abs()

sns.boxplot(x="project", y="drift", data=df_subset)
plt.title('wfo')
plt.ylim(0, 0.6e16)
plt.show()


<ipython-input-24-1dd1820ef2d1>:2: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame.
Try using .loc[row_indexer,col_indexer] = value instead

See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy
  df_subset['drift'] = df_subset['drift'].abs()

In [27]:
df_subset = df[df['variable'] == 'masso (kg yr-1)']
df_subset['drift'] = df_subset['drift'].abs()

sns.boxplot(x="project", y="drift", data=df_subset)
plt.title('masso')
plt.ylim(0, 2e14)
plt.show()


<ipython-input-27-7d2838852f0f>:2: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame.
Try using .loc[row_indexer,col_indexer] = value instead

See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy
  df_subset['drift'] = df_subset['drift'].abs()

In [30]:
df_subset = df[df['variable'] == 'soga (g/kg yr-1)']
df_subset['drift'] = df_subset['drift'].abs()

sns.boxplot(x="project", y="drift", data=df_subset)
plt.title('soga')
plt.ylim(0, 1e-5)
plt.show()


<ipython-input-30-957d595b4203>:2: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame.
Try using .loc[row_indexer,col_indexer] = value instead

See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy
  df_subset['drift'] = df_subset['drift'].abs()

In [ ]: