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/19225258e9a036ee10e095b74dc2bae052db2534cf38ea173ca16097be88e50d.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/7b7e66efbbd7cf3c64eedf045ef9533aee0e937207c8161bde6bf7e4b5336179.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/57e36277822c7084c169302110aaf9ed44a5c76795045d1661cb00d56ed66117.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/c4389a3b8cedb16e0294e304cf65fb2b8088a62f23c6541b504e8bc70f502d83.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/3e1fb61188c81435a85c51912e691a7fb151185c0d5959e81101ff5f1cda8eaa.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/94c223d5e4a46d0eac3c880d1c7170c987baed5942922e5e411e033e3fbd4276.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/a083b36ca98c4327c0e363c55166376a5bffc8e3621cefc615a73a822bfb95d6.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/19f1161f5f666412ad5800458fa9c2c0b3c597b75deeb27d537fa6d751c7f1ee.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/3d1c0a6ff8bf1da4716bda04de690e003b5e9f76a329fa658e0d53e81629ea3b.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/0566e98c1dab09d9d5194c9296da7cdb0bb05dcf578aaf4f22fc17c680996d34.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/8ee8649b31792edcb6d7b5276b40c91d11014631155c3be6dd0c2dbad8c3ce6a.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/d7b4c58c83efa376429f2668e39f098ed368f1cb908af0f28441744f2452f827.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/5d785ae77c6f271fa8c70705a37a35afd6f276abf0a31f5d5f4c50a485600032.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/ca9b81a97899b69dfff9a65da2d4c6e734c236ac37e0414a043fbaa44c83d1ee.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/6bf944af7e7ff8b626d5425643dafedcd4c8816efca4a8c1f760fa8ad0d8aa26.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/3a3a0e1274d081fb27f37e5bd0395a2c66adb2e70c6481d29a1150cbe53bc2d9.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/18df474c4d6ee598bba24ce4cc570c4c6e7257477074c04593815526355d4842.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/02c777c98e33309e242e1241edbf12bfec02647a75b8122a38d82a3e9529e63b.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/c4ebee23dece704f8415983a3402f6a4c4c67e56de18e5e331478cea2a213a53.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/c3629a8396443d17000f7adb4b7e223dcef2b04faa72538c46c2a58715b4edbc.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/00068ff3e90aea5de435d43a6300b23508b68fe45f9c2359469a19eb5a5dbc41.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/52b27674e473678bfbfab830377661d1064452fdda37deffc1afb4e24114c994.png