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/f2f19e06e09dcb0c84ff009e3cf2b14994377ecacf00ae848273afd1afd81d05.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/f6552c9b5bf53c242fe1cd8cccc7d306d55d92593b70c3a6d59ca2ea9cb90b71.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/ea639a42ff96b24abec12ea96f8df9294b41b49874f0ebbccb20e6659c5b4f65.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/1ed78f17ca41c46933b468fedde46ca11ad0f1d9460418123aad0d397cb4f36d.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/2036bfb43bcf056f2004da390935f26ec69b5d5597a972e131075786081e2441.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/947bd1aa4d8a1aa1cd77e397956a8ac6c2e035ab9a64dda65e6fe3da296bbe6f.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/585a9ceace02547efadd3c8a6bbf787a3083e2a12ee164f70fb822d02e9cbd59.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/8cfd38081ee9b05fe1d4d13d4490182e6a31edb8f1bfd0861cc18729ad4c0c27.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/55dbb7afefcd7e67523cc99a792c5d6eb9e7378391ee8145b56d3f24b78f39ce.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/1e1813f84b2880f95916323c342f3e841d031c948b63f1a348460ca061d72a5c.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/eaef931bc745f2e7d6ad9261f6f79cff3d20a83306c5cb533058cd90774f1672.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/c094dfb8ff5ddb5bccb9991a14265f6d37bb951353bdbb9be65fb287e5da3c29.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/c3f2f151b8be7a88114815501bed16ba547409c5d2175c6a49603cfaa5bd8cdc.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/48a65bd63494131011d0bfcd16f07522b914b8978d9f522257b4b81a1736be6a.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/80cb59251b18d06e755982da66a8ceaca1b3083b30294727332ce9c2b2323f20.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/b3a7f17b60c757b3b3f846a4c52fcb0941edbb745f7a620ad6f75f77eac44a8a.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/232db61b7e82a0bae15d9c24fb3e6be58e748bb6814047bc86dcbaf162ed0123.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/d8da8d8a8fd60c938c16977a22b81a72e9aaedcfbefb2d31a0c463937e568621.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/cc636caf6509e529611532a9079844a05bbc492e7af0cc232974954abd14c067.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/c91f4c1774f6f272b63c7c6ec3b475d6f65868f8e9a7f5b0681e0bd427674400.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/703c55a0976b5b8b698217f9568878681e980ba8dc5fa04e5219bcf5f585f73d.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/17af728d2b78b13aad527c90bc3a6ab6bb0255ebc4231d47ea0ceedf86319a8b.png