This notebook shows a simple example of plotting ocean Ideal Age. Ideal
Age is a fictitious tracer which is set to zero in the surface grid-cell
every timestep, and is aged by 1 year per year otherwise. It is a useful
proxy for nutrients, such as carbon or oxygen (but not an exact
One of the interesting aspects of age is that we can use it to show
pathways of the densest water in the ocean by plotting a map of age in
the lowest grid cell. This plot requires a couple of tricks to extract
information from the lowest cell.
Requirements: COSIMA Cookbook, preferably installed via the
conda/analysis3 conda installation on NCI.
Firstly, get all the standard preliminaries out of the way.
The age variable is a 3D variable. There are a number of ways to extract
the value at the bottom of the ocean. This notebook outlines two ways
this can be achieved: (i) using masking and using (ii) indexing.
In this case masking is much slower than indexing, but for some use
cases this has been the opposite. The masking approach has the benefit
of not requiring the depth grid information.
Create a mask of all the bottom cells. Can achieve this by taking the
data, shift it up one cell in the vertical grid, find all non-NAN cells,
and then negate this mask. Then mask the same data with with this mask,
which will select out only the lowest level of non-NAN values in the
In a second step turn it into a boolean array for neatness.
Here we grab the kmt variable out of ocean_grid.nc. Note that
this is a static variable, so we just look for the last file (give
n=-1 as keyword argument to getvar() below). The kmt
variable tells us the lowest cell which is active at each \((x, y)\)
A few things to note here: * The continental shelves are all young -
this is just because they are shallow. * The North Atlantic is also
relatively young, due to formation of NADW. Note that both the Deep
Western Boundary Currents and the Mid-Atlantic Ridge both sustain
southward transport of this young water. * A signal following AABW
pathways (northwards at the western boundaries) shows slightly younger
water in these regions, but it has mixed somewhat with older water
above. * Even after 200 years, the water in the NE Pacific has not
experienced any ventilation…
The indexing method requires the data to be loaded into memory and
appears faster than it actually is if this isn’t factored in.
Calculations with large datasets that do not fit within memory will
struggle in this case.
The indexing method does not perform well in a dask workflow where
lazy loading is being used.
The masking approach does not suffer from these limitations and when in
doubt should be the preferred method. It also has the advantage of not
requiring the grid data ing
To illustrate this: a single month of bottom age from the original data