Ocean Stats#

%load_ext autoreload
%autoreload 2
%%capture 
# comment above line to see details about the run(s) displayed
from misc import *
from mom6_tools.m6toolbox import weighted_temporal_mean
print("Last update:", date.today())
%matplotlib inline
# Make the graphs a bit prettier, and bigger
#plt.style.use('ggplot')
plt.rcParams['figure.figsize'] = (15, 5)
plt.rcParams.update({'font.size': 15})

Globally-integrated T & S#

fig, ax = plt.subplots(nrows=1,ncols=1,figsize=(10,4))

for c, l, p in zip(casename,label, ocn_path):
  ds = xr.open_dataset(p+'{}_mon_ave_global_means.nc'.format(c)).sel(time=slice('0001-01-01',end_date))
  da =  weighted_temporal_mean(ds,'opottempmint')
  da.plot(ax=ax, label=l, lw=3)

#plt.suptitle(ds.opottempmint.attrs['long_name'])
ax.set_ylabel(ds.opottempmint.attrs['units'])
ax.set_xlabel('Year')
ax.grid()
ax.legend(ncol=3,loc=1);
_images/9712a6901d5d47e2101097102c8b984ca4b7a926b6f00acf2cdf341eca2a9071.png
fig, ax = plt.subplots(nrows=1,ncols=1,figsize=(10,4))

for c, l, p in zip(casename,label, ocn_path):
  ds = xr.open_dataset(p+'{}_mon_ave_global_means.nc'.format(c)).sel(time=slice('0001-01-01',end_date))
  da =  weighted_temporal_mean(ds,'somint')  
  da.plot(ax=ax, label=l, lw=3)

#plt.suptitle(ds.somint.attrs['long_name'])
ax.set_ylabel(ds.somint.attrs['units'])
ax.set_xlabel('Year')
ax.grid()
ax.legend(ncol=3,loc=1);
_images/7000344b92c58760b56e28454f7fe00ae793760b2c8b3e49126918f69ad6dbeb.png

Globally-averaged T & S#

fig, ax = plt.subplots(nrows=1,ncols=1,figsize=(10,4))

for c, l, p in zip(casename,label, ocn_path):
  ds = xr.open_dataset(p+'{}_mon_ave_global_means.nc'.format(c)).sel(time=slice('0001-01-01',end_date))
  da =  weighted_temporal_mean(ds,'thetaoga') 
  da.plot(ax=ax, label=l, lw=3)

plt.title(ds.thetaoga.attrs['long_name'])
ax.set_ylabel(ds.thetaoga.attrs['units'])
ax.set_xlabel('Year')
ax.grid()
ax.legend(ncol=3,loc=0);
_images/dda3659c9be0875969bcb881f9e82684bfda1330e6ffa97ee59b93b1735f03d0.png
fig, ax = plt.subplots()
for c, l, p in zip(casename,label, ocn_path):
  ds = xr.open_dataset(p+'{}_mon_ave_global_means.nc'.format(c)).sel(time=slice('0001-01-01',end_date))
  ds['soga'].plot(ax=ax, label=l, lw=3)
    
ax.set_title(ds.soga.attrs['long_name'])
ax.set_ylabel(ds.soga.attrs['units'])
ax.set_xlabel('Year')
ax.grid()
ax.legend();
_images/c41e5489a99d50676a2d8ab97b296c517f73dd46845049f9c6cc2f5aef09be0b.png
ocean_stats = []
for c, l, p in zip(casename,label, ocn_path):
  ds = xr.open_dataset(p+'{}_ocean.stats.nc'.format(c), decode_times=False)#.sel(time=slice('0001-01-01',end_date))
  stats_monthly = ds#.resample(time="1M", 
                    #           closed='left',
                    #           keep_attrs='True').mean('time', keep_attrs=True)
  ocean_stats.append(stats_monthly) 

Truncations#

fig, ax = plt.subplots()
for i,l in zip(range(len(label)), label):
  ocean_stats[i].Truncs.plot(ax=ax,label=l,lw=3);
    
ax.legend()
ax.grid()
_images/3195f63f2bcec1e106f6d9af0828a42eaa94d7dadf6b41471ab4f468e2b28f7e.png

Maximum finite-volume CFL#

fig, ax = plt.subplots()
for i,l in zip(range(len(label)), label):
  ocean_stats[i].max_CFL_trans.plot(ax=ax,label=l,lw=3);
    
ax.legend()
ax.grid();
_images/933ce7e438b59d39732ec77b2ab8850558a103c9223c2621a7f8e1deb31cca78.png

Maximum finite-difference CFL#

fig, ax = plt.subplots()
for i,l in zip(range(len(label)), label):
  ocean_stats[i].max_CFL_lin.plot(ax=ax,label=l,lw=3);
    
ax.legend()
ax.grid();
_images/7551f4d167da74b7091e009a6567db7c93c526037a288b7babf8a519be3616a5.png

Maximum CFL#

fig, ax = plt.subplots()
for i,l in zip(range(len(label)), label):
  ocean_stats[i].MaximumCFL.plot(ax=ax,label=l,lw=3);
    
ax.legend()
ax.grid();
_images/5af38f61d9ae6cddd270fc878967d552dc4f7c6e682263486529a323640bdabe.png

Energy/Mass#

fig, ax = plt.subplots()
for i,l in zip(range(len(label)), label):
  ocean_stats[i].EnergyMass.plot(ax=ax,label=l,lw=3);
    
ax.legend()
ax.grid();
_images/5638e4d2e6393717af450e9d53bbc17268eadb2d3e875b9c68ccab9aa8fb6f5e.png

Mean Sea Level#

fig, ax = plt.subplots()
for i,l in zip(range(len(label)), label):
  ocean_stats[i].MeanSeaLevel.plot.line(ax=ax,label=l,lw=3);
    
ax.legend()
ax.grid();
_images/825c285be59aebe6dd0769cddd7fcefa10c61e2e4e8a49fc160b5d4fc2bf28bd.png

Total Mass#

fig, ax = plt.subplots()
for i,l in zip(range(len(label)), label):
  ocean_stats[i].TotalMass.plot(ax=ax,label=l,lw=3);
    
ax.legend()
ax.grid();
_images/5fdce0dbce837c772b34d115746da977b42d9883bdd4cfdf5d314f875553ba76.png

Mean Salinity#

fig, ax = plt.subplots()
for i,l in zip(range(len(label)), label):
  ocean_stats[i].MeanSalin.plot(ax=ax,label=l,lw=3);
    
ax.legend()
ax.grid();
_images/eb14b6e6207052b48fd43163dbda5701f6fe02d15bbacd442c1423c5e8a17fef.png

Mean Temperature#

fig, ax = plt.subplots()
for i,l in zip(range(len(label)), label):
  ocean_stats[i].MeanTemp.plot(ax=ax,label=l,lw=3);
    
ax.legend()
ax.grid();
_images/89139c8e7abc7853a81307b8361e7093c9566931c8de3f33754783401b8823bf.png

Total Energy#

fig, ax = plt.subplots()
for i,l in zip(range(len(label)), label):
  ocean_stats[i].En.plot(ax=ax,label=l,lw=3);
    
ax.legend()
ax.grid();
_images/3fb4c6dafd0760a26c6ec0b326bef405ef06419a250b49c1eacc9a1ae0ed583d.png

Available Potential Energy#

fig, ax = plt.subplots()
for i,l in zip(range(len(label)), label):
  ocean_stats[i].APE.sum(axis=1,
                      keep_attrs=True).plot(ax=ax,label=l,lw=3);
    
ax.legend()
ax.grid();
_images/c3a9039c3fe40cbd697670b4038fd41cf253ef462d3e05f0828a98d9c161c2cd.png

Total Salt#

fig, ax = plt.subplots()
for i,l in zip(range(len(label)), label):
  ocean_stats[i].Salt.plot(ax=ax,label=l,lw=3);
    
ax.legend()
ax.grid();
_images/bc405d034ec8518431b81d4f1237b0ce8a9cfd50ab6be5d0a3cecd482bb8d26e.png

Total Salt Change between Entries#

fig, ax = plt.subplots()
for i,l in zip(range(len(label)), label):
  ocean_stats[i].Salt_chg.plot(ax=ax,label=l,lw=3);
    
ax.legend()
ax.grid();
_images/732737f391715a8e0c78cba1962299bda26b93de04bcae08f5c67fed6687df69.png

Anomalous Total Salt Change#

fig, ax = plt.subplots()
for i,l in zip(range(len(label)), label):
  ocean_stats[i].Salt_anom.plot(ax=ax,label=l,lw=3);
    
ax.legend()
ax.grid();
_images/c6bd5f8ea801ef5589181615f7b87e30650f8bf533def9ab44b13a4ccecef0ca.png

Total Heat#

fig, ax = plt.subplots()
for i,l in zip(range(len(label)), label):
  ocean_stats[i].Heat.plot(ax=ax,label=l,lw=3);
    
ax.legend()
ax.grid();
_images/79a3b3b02fc27bf8a06ce4ab695d8dbe885f76230b78393f925ecad87942bc28.png

Total Heat Change between Entries#

fig, ax = plt.subplots()
for i,l in zip(range(len(label)), label):
  ocean_stats[i].Heat_chg.plot(ax=ax,label=l,lw=3);
    
ax.legend()
ax.grid();
_images/12b2eb2b531907f4cb77694f2b4367916e729dc2042c10c927b5789d7b468537.png

Anomalous Total Heat Change#

fig, ax = plt.subplots()
for i,l in zip(range(len(label)), label):
  ocean_stats[i].Heat_anom.plot(ax=ax,label=l,lw=3);
    
ax.legend()
ax.grid();
_images/d8b649aa3f221cdf818b0e64f23f80e12f54332df91741413fa225652fbc27c6.png

Age#

fig, ax = plt.subplots()
for i,l in zip(range(len(label)), label):
  ocean_stats[i].age.plot(ax=ax,label=l,lw=3);
    
ax.legend()
ax.grid();
_images/ec74b0982c879d6e71b13eebdb632cd92f791adee6412bdc9d312f8c6ed06fff.png