Meridional Overturning Circulation#

%load_ext autoreload
%autoreload 2
%%capture 
# comment above line to see details about the run(s) displayed
from misc import *
from  mom6_tools import m6plot, m6toolbox
from mom6_tools.moc import  *
import glob
from IPython.display import Image, display
%matplotlib inline
ds = []
for c, l, p in zip(casename,label, ocn_path):
  dummy = xr.open_dataset(p+'{}_MOC.nc'.format(c))
  ds.append(dummy) 

Global MOC#

pnum = len(ds)
varName = 'vmo'
Zmod = []
fname ='*.mom6.h.z.????-??.nc'
for i in range(pnum):
  # this hack needs to be fixed
  print(OUTDIR[i]+fname)
  file = sorted(glob.glob(OUTDIR[i]+fname))[0:2]
  ds1 = xr.open_mfdataset(file)
  Zmod.append(m6toolbox.get_z(ds1, depth[i], varName))
/glade/derecho/scratch/gmarques/archive/g.e30_a07g.GW_JRA.TL319_t232_wgx3_hycom1_N75.2025.154/ocn/hist/*.mom6.h.z.????-??.nc

z#

for i in range(pnum):
  m6plot.setFigureSize([16,9],576,debug=False)
  axis = plt.gca()
  cmap = plt.get_cmap('dunnePM')
  zg = Zmod[i].min(axis=-1); 
  psiPlot = ds[i].moc.values
  yyg = grd[i].geolat_c[:,:].max(axis=-1)+0*zg

  ci=m6plot.pmCI(0.,40.,5.)
  plotPsi(yyg, zg, psiPlot, ci, 'Global MOC [Sv], ' + \
         'start_date:' + ds[i].start_date +' end_date:' + ds[i].end_date)
  plt.xlabel(r'Latitude [$\degree$N]')
  plt.suptitle(label[i])

  findExtrema(yyg, zg, psiPlot, max_lat=-30.)
  findExtrema(yyg, zg, psiPlot, min_lat=25., min_depth=250.)
  findExtrema(yyg, zg, psiPlot, min_depth=2000., mult=-1.)
  plt.gca().invert_yaxis()
_images/f9f9ed6a7fb5e2c855a50f248d88e6cb09ff68f88f1b937e6032d937550e30b0.png

sigma2#

for i in range(len(casename)):
  png_files = glob.glob(ocn_path[i]+'../PNG/MOC/'+casename[i]+'_MOC_sigma2_global.png')
  for png_file in png_files:
      display(Image(filename=png_file))
_images/0f533fdade61fdc97e9abb061ade4da7b247d21a78905d94c061f5a5a7441159.png

zrho#

for i in range(len(casename)):
  png_files = glob.glob(ocn_path[i]+'../PNG/MOC/'+casename[i]+'_MOC_zrho_global.png')
  for png_file in png_files:
      display(Image(filename=png_file))
_images/99326cf5a76d9516740040005d4c71d713544b0e386f9525f1b05baf2c41b6d8.png

Atlantic MOC#

z#

# 2 - Atlatic; 4 - Arctic; 6 - Med; 7 - Baltic; 8 - Hudson Bay;
for i in range(pnum):
  basin_code = genBasinMasks(grd[i].geolon, grd[i].geolat, depth[i], xda=False);
  m6plot.setFigureSize([16,9],576,debug=False)
  cmap = plt.get_cmap('dunnePM')
  ci=m6plot.pmCI(0.,22.,2.)
  m = 0*basin_code; m[(basin_code==2) | (basin_code==4) | (basin_code==6) | (basin_code==7) | (basin_code==8)]=1
  z = (m*Zmod[i]).min(axis=-1)
  psiPlot = ds[i].amoc.values
  yy = grd[i].geolat_c[:,:].max(axis=-1)+0*z
  plotPsi(yy, z, psiPlot, ci, 'Atlantic MOC [Sv], ' + \
         'start_date:' + ds[i].start_date +' end_date:' + ds[i].end_date)
  plt.xlabel(r'Latitude [$\degree$N]')
  plt.suptitle(label[i])
  findExtrema(yy, z, psiPlot, min_lat=26.5, max_lat=27., min_depth=250.) # RAPID
  findExtrema(yy, z, psiPlot, min_lat=44, max_lat=46., min_depth=250.) # RAPID
  findExtrema(yy, z, psiPlot, max_lat=-33.)
  findExtrema(yy, z, psiPlot)
  findExtrema(yy, z, psiPlot, min_lat=5.)
  plt.gca().invert_yaxis()
_images/c1c16be167dae8de55a91f8e0087a97cabb119d0639d716c92bcf31695e7e059.png

sigma2#

for i in range(len(casename)):
  png_files = glob.glob(ocn_path[i]+'../PNG/MOC/'+casename[i]+'_MOC_sigma2_Atlantic.png')
  for png_file in png_files:
      display(Image(filename=png_file))
_images/32d9e4272c18b1d2e2455985f120c55ff206a2ebd328715574259f44a4f1a5c8.png

zrho#

for i in range(len(casename)):
  png_files = glob.glob(ocn_path[i]+'../PNG/MOC/'+casename[i]+'_MOC_zrho_Atlantic.png')
  for png_file in png_files:
      display(Image(filename=png_file))
_images/72dc8001fcd6575003b460f0bc801741511dd9268b55e9d6d414498d1298c7ed.png

AMOC profile at 26N#

fig, ax = plt.subplots(figsize=(10,6))
rapid_vertical = xr.open_dataset('/glade/work/gmarques/cesm/datasets/RAPID/moc_vertical.nc')
ax.plot(rapid_vertical.stream_function_mar.mean('time'),
        rapid_vertical.depth, 'k', label='RAPID', lw=3)
for i in range(pnum):
  ax.plot(ds[i]['amoc'].sel(yq=26, method='nearest'), ds[i].zl, label=label[i], lw=3)

ax.legend()
plt.gca().invert_yaxis()
plt.grid()
ax.set_xlabel('AMOC @ 26N [Sv]')
ax.set_ylabel('Depth [m]');
_images/4ec2806816e1e490e749e09bbfc99d6979a61c2fc8d25905e6ece57e99616cd7.png

AMOC time series#

# load RAPID time series
rapid = m6toolbox.weighted_temporal_mean_vars(xr.open_dataset('/glade/work/gmarques/cesm/datasets/RAPID/moc_transports.nc'))

# plot
fig = plt.figure(figsize=(12, 6))
for i in range(pnum):
  plt.plot(np.arange(len(ds[i].time))+1. ,ds[i]['amoc_26'].values, 
           label=label[i], lw=3)
# rapid
plt.plot(np.arange(len(rapid.time))+46.5 ,rapid.moc_mar_hc10.values, 
         label='RAPID', lw=2)

plt.title('AMOC @ 26 $^o$ N', fontsize=16)
plt.ylim(5,20)
plt.xlim(0,1+len(ds[0].time))
plt.xlabel('Time [years]', fontsize=16); plt.ylabel('Sv', fontsize=16)
plt.legend(fontsize=13, ncol=2)
plt.grid()
_images/d486fdf51b3a59f89c80bc0d2653bd2f6b962634f824cd2608986c319814d72e.png
# plot
fig = plt.figure(figsize=(12, 6))
for i in range(pnum):
  plt.plot(np.arange(len(ds[i].time))+1 ,ds[i]['amoc_45'].values, 
           label=label[i], lw=3)
plt.title('AMOC @ 45 $^o$ N', fontsize=16)
plt.ylim(5,25)
plt.xlim(0,1+len(ds[0].time))
plt.xlabel('Time [years]', fontsize=16); plt.ylabel('Sv', fontsize=16)
plt.legend(fontsize=13, ncol=2);
plt.grid()
_images/1a9f97dc7a5a89d833fe75acf68b1d6bbc41b7e52af0ac8a0844bc672768004e.png

Indo-Pacific#

z#

for i in range(len(casename)):
  png_files = glob.glob(ocn_path[i]+'../PNG/MOC/'+casename[i]+'_MOC_IndoPacific.png')
  for png_file in png_files:
      display(Image(filename=png_file))
_images/c0861d03503090f1eb529200b8d160b511857e515b59a74cb17f9d65f005a35f.png

sigma2#

for i in range(len(casename)):
  png_files = glob.glob(ocn_path[i]+'../PNG/MOC/'+casename[i]+'_MOC_sigma2_IndoPacific.png')
  for png_file in png_files:
      display(Image(filename=png_file))
_images/de15dff8dfba754fffd5ab3c229c6acf55559c579b67285319b78cc478d73e07.png

zrho#

for i in range(len(casename)):
  png_files = glob.glob(ocn_path[i]+'../PNG/MOC/'+casename[i]+'_MOC_zrho_IndoPacific.png')
  for png_file in png_files:
      display(Image(filename=png_file))
_images/fde0ce0ea86b9aa163676a0cd0bf8496b7cb3ce35ca3d1fdf5de1046911b15f4.png

Submesoscale-induced Global MOC#

z#

for i in range(pnum):
    # create a ndarray subclass
    class C(np.ndarray): pass
    varName = 'moc_FFH'

    psiPlot = np.ma.masked_invalid(ds[i][varName].values)
    tmp = psiPlot[:].filled(0.)
    VHmod = tmp.view(C)
    VHmod.units = 'Sv'

    # Global MOC
    m6plot.setFigureSize([16,9],576,debug=False)
    axis = plt.gca()
    cmap = plt.get_cmap('dunnePM')
    z =  Zmod[i].min(axis=-1) 
    #yy = y[1:,:].max(axis=-1)+0*z
    yy = grd[i].geolat_c[:,:].max(axis=-1)+0*z
    ci=m6plot.pmCI(0.,40.,2.)
    plotPsi(yy, z, psiPlot, ci, 'Global MOC [Sv] due to vhML', zval=[0.,-400.,-6500.])
    plt.xlabel(r'Latitude [$\degree$N]')
    plt.suptitle(label[i])
    plt.gca().invert_yaxis()
_images/a917d67fab744aa0ad25b7353e3aa8120e435fde5f7b2a415871343a90354dc6.png

sigma2#

for i in range(len(casename)):
  png_files = glob.glob(ocn_path[i]+'../PNG/MOC/'+casename[i]+'_MOC_sigma2_global_vhml.png')
  for png_file in png_files:
      display(Image(filename=png_file))
_images/b89d87bbb5b747b4409f1a4d37d008dc0ce73da80533796240cf3f14c81ee104.png

zrho#

for i in range(len(casename)):
  png_files = glob.glob(ocn_path[i]+'../PNG/MOC/'+casename[i]+'_MOC_zrho_global_vhml.png')
  for png_file in png_files:
      display(Image(filename=png_file))
_images/86cd9c060c0f74bb67c88068b2264808b5cad55c3db4a34870813bb645eaf0ae.png

Eddy(GM)-induced Global MOC#

z#

for i in range(pnum):
    # create a ndarray subclass
    class C(np.ndarray): pass
    varName = 'moc_GM'

    psiPlot = np.ma.masked_invalid(ds[i][varName].values)
    tmp = psiPlot[:].filled(0.)
    VHmod = tmp.view(C)
    VHmod.units = 'Sv'

    # Global MOC
    m6plot.setFigureSize([16,9],576,debug=False)
    axis = plt.gca()
    cmap = plt.get_cmap('dunnePM')
    z =  Zmod[i].min(axis=-1) 
    yy = grd[0].geolat_c[:,:].max(axis=-1)+0*z
    ci=m6plot.pmCI(0.,20.,1.)
    plotPsi(yy, z, psiPlot, ci, 'Global MOC [Sv] due to GM')
    plt.xlabel(r'Latitude [$\degree$N]')
    plt.suptitle(label[i])
    findExtrema(yy, z, psiPlot, min_lat=-65., max_lat=-30, mult=-1.)
    plt.gca().invert_yaxis()
_images/5d46d3482b76a03836ee4a993fed00ec24d0cc70f94f2aca8c1df46afd1f8475.png

sigma2#

for i in range(len(casename)):
  png_files = glob.glob(ocn_path[i]+'../PNG/MOC/'+casename[i]+'_MOC_sigma2_global_vhGM.png')
  for png_file in png_files:
      display(Image(filename=png_file))
_images/f8ffbfea20f20dfd3c4478185312cc4fed2a858f42ae3e33570c9d5ffb81979e.png

zrho#

for i in range(len(casename)):
  png_files = glob.glob(ocn_path[i]+'../PNG/MOC/'+casename[i]+'_MOC_zrho_global_vhGM.png')
  for png_file in png_files:
      display(Image(filename=png_file))
_images/b94e94daaa8c350d7316c8b22050db001e4fdf655d26f346ff2045344525d9ca.png