Vertical methods#

nctoolkit features built in methods for handling files with multiple vertical levels. They work for datasets with fixed vertical levels, for example ocean data with z-levels, as well as files with varying vertical levels such as terrain following coordinates.

The vertical methods available will be illustrated using depth-resolved ocean temperatures from NOAA’s World Ocean Atlas for January to a depth of 500 metres. The vertical_interp method requires a levels argument, which is sea-depth in this case.

import nctoolkit as nc
ds = nc.open_thredds("")
nctoolkit is using the latest version of Climate Data Operators version: 2.0.5

We can see right awy that there are 57 vertical levels, going as deep as 1500 metres.


Calculating simple vertical statistics#

If we want to calculate the mean temperature across all vertical levels, we can do the following. Note: that you must specify the fixed arg, which tells nctoolkit whether the vertical levels are consistent in this space. In this case they are. Note: this method will account for cell thickness when calculating the mean.

ds_mean = ds.copy()
ds_mean.vertical_mean(fixed = True)