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/ed3deb15634c1766f2ab003486400fe5fa8417bd84bee160a3323bed2e234116.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/47d2ac8744d93278025161b0e8ceaeb8bb3c76ab3c4563091714b208c0afcf5e.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/8f3dd2399d25c7ea292d92d51c64163db10e3f96582cbb66dc52921521217647.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/45b661450166365dab628539ab993f09b7de0ed70dcdb61477c43dce726890a1.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/4c40759a42b828463698fb684ab07918da0a2a1c15089796494a89b757c7751d.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/30574dffa79dc7987bf84d9ba6b25e04771b928b900f97f6cb655071dbb88ff0.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/d7823b863720607aa3355691e85ca502ccc6b9721e484c3255234d851ae09005.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/75ee263e9d62426f11bbedb914c5fc78bf18da291c153b594c3106eade546be7.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/0176f7417adcac06a912e9466d962a5b669c58a13d1a54ce53f1851f720de8a6.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/ef2ebf34514284b10edcd8b14645070f66503b19698cc45240d927f9f0db05a5.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/d4bfc16e36f47536f7ec2ae46e63cbed2017d7fb4b7880601d2e2ee1740de215.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/19761324d96f24ed0ad509592f739236c2d3b67de730d91129fdc960684b19bc.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/460debd2f7d94b3b7661253ebb4c71839586900b9ea472df974ccac6e0d3a41d.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/cb959834df50d16ed23bd3f2fd1eecc0d2e37397c333e5c7d5e57f1a79c48398.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/93051bf14994c173aecb4347610478a5fcb6d204407a8d85a2a7f074e8c463a0.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/b7610931259f05f4a83e83a4d45f6d416adc968e9d5f9b31141a404c32bf411b.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/48c79b32fd2f7eba2b345511216c70faf42bf35c4de1dcdffcec535362129504.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/a7b1c3e1c99b9fc9e8cfa42abcd1c0c2265aedf59a426bab6fac2f1cc57f156c.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/e2cdf2a7081063927bea72da14fc98033efc2d4bf86cce922f030ce107381f02.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/45b97907e0791b0e0205a758e7d0d87ba68dfb9804102e603d4b9a9d9e74ccee.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/a88712d51e3d1c5db616dd71e2804275e8327510181eab5ae5cdeb405a09aa69.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/cf0efc66d7c5a18a0a0a919b4e8d56e4822cca94e60f9bfb007acd165aec3590.png