Assignment 5: Global overturning circulation#

import xarray as xr
import numpy as np
import matplotlib.pyplot as plt

def subplots_shared(n, m, sharex=True, sharey=True, layout='constrained', figsize=None):
    return plt.subplots(n, m, sharex=sharex, sharey=sharey, layout=layout, figsize=figsize)

def pcolormesh_sym(x, y, z, vbound, ax=None, cmap='RdBu_r'):
    if ax is None:
        ax = plt.gca()
    return ax.pcolormesh(x, y, z, vmin=-vbound, vmax=vbound, cmap=cmap, rasterized=True)

def tohours(Time):
    return Time.values.astype('float') / 1e9 /3600
%matplotlib widget

Q1.1 Investigate the structure of the deep water circulation#

Q1.1.1 Plot a cross section of north/south velocity#

Plot an east-west section of north-south velocity in one of the runs (I used OverturningBeta10e5Coarse.snapshot.nc) close to the middle of the basin (say 30 or 40 N). Comment on the flow patterns, both in the veritcal and across the basin.

# YOUR CODE HERE
raise NotImplementedError()
---------------------------------------------------------------------------
NotImplementedError                       Traceback (most recent call last)
Cell In[3], line 2
      1 # YOUR CODE HERE
----> 2 raise NotImplementedError()

NotImplementedError: 

YOUR ANSWER HERE

Q1.1.2 Quantify the north-south transport#

For the whole basin, consider the deeper layer you identified above and calculate the vertically integrated north south transport, per degree of longitude, in the basin and plot. Do the same for the east-west transport, and comment on the structures.

# YOUR CODE HERE
raise NotImplementedError()
---------------------------------------------------------------------------
NotImplementedError                       Traceback (most recent call last)
Cell In[4], line 2
      1 # YOUR CODE HERE
----> 2 raise NotImplementedError()

NotImplementedError: 

YOUR ANSWER HERE

Q1.1.3 Plot w#

Plot w at the top of the volume you considered in the previous question and discuss if the Stomel-Arons assumption of uniform w is applicable.

# YOUR CODE HERE
raise NotImplementedError()
---------------------------------------------------------------------------
NotImplementedError                       Traceback (most recent call last)
Cell In[5], line 2
      1 # YOUR CODE HERE
----> 2 raise NotImplementedError()

NotImplementedError: 

YOUR ANSWER HERE

Q1.1.4 Transport as function of latitude#

Choose a central latitude, and plot the total transport in the deep layer as a function of longitude. Comment on the net transport across this section compared to the peak transport in the section, with reference to the expectations from the Stomel-Arons theory.

# YOUR CODE HERE
raise NotImplementedError()
---------------------------------------------------------------------------
NotImplementedError                       Traceback (most recent call last)
Cell In[6], line 2
      1 # YOUR CODE HERE
----> 2 raise NotImplementedError()

NotImplementedError: 

YOUR ANSWER HERE

Q1.2 Available potential energy#

Lets examine the idea of available potential energy in these simulations. We won’t properly calculate available potential energy because that is quite difficult in the spehrical geometry we ran these simulations with. Instead, lets take one central longitude, and pretend that the longitude dimension has the same dx for each latitude (as opposed to in the actual spherical geometry, where dx gets narrower to the north).

Q1.2.1 Calculate the background potential energy#

for each of

todo = ['../Assign4/OverturningBeta4e6Coarse.snapshot.nc', 
        '../Assign4/OverturningBeta1e5Coarse.snapshot.nc', 
        '../Assign4/OverturningBeta4e5Coarse.snapshot.nc',
        '../Assign4/OverturningBeta8e5Coarse.snapshot.nc',
        '../Assign4/OverturningBeta10e5Coarse.snapshot.nc',
        '../Assign4/OverturningBeta4e4Coarse.snapshot.nc']

calculate a sorted version of the density (ds.prho) in a section at the central latitude, with the densest water at the bottom and lightest water at the surface.

This is a bit tricky, because the depth bins are not even! So first I selected my time and values of xt and made a new data slice interpolated onto a new grid:

dsnew = ds.sel(zt=np.arange(-4000, 0, 20), method='nearest')

Then I used np.sort and np.reshape to make a new prho0.

To show that you did this properly, contour prho and prho0 for one of the simulations, using the same density contours.

# YOUR CODE HERE
raise NotImplementedError()
---------------------------------------------------------------------------
NotImplementedError                       Traceback (most recent call last)
Cell In[7], line 2
      1 # YOUR CODE HERE
----> 2 raise NotImplementedError()

NotImplementedError: 

YOUR ANSWER HERE

Q1.2.2 Calculate the Available Potential Energy#

Calculate the PE of the background state and the actual state and calculate the APE for each of the simulations. Make a log-log plot of K versus Background potential energy and a second of K versus APE. Note that BPE can be negative, depending on what reference z you choose, so try adding an offset to z to make the BPE positive. Note that APE should not be affected by your choice of the z offset (and indeed changing the offset is a very useful way to demonstrate that you did the calculation correctly). Express your ponential energy in units of J/m.

Comment on the trend in background potential energy as a function of K, and the available potential energy as functions of K.

# YOUR CODE HERE
raise NotImplementedError()
---------------------------------------------------------------------------
NotImplementedError                       Traceback (most recent call last)
Cell In[8], line 2
      1 # YOUR CODE HERE
----> 2 raise NotImplementedError()

NotImplementedError: 
# YOUR CODE HERE
raise NotImplementedError()
---------------------------------------------------------------------------
NotImplementedError                       Traceback (most recent call last)
Cell In[9], line 2
      1 # YOUR CODE HERE
----> 2 raise NotImplementedError()

NotImplementedError: 

YOUR ANSWER HERE