nctoolkit.DataSet.vertical_mean

DataSet.vertical_mean(self, thickness=None, depth_range=None)

Calculate the depth-averaged mean for each variable This is calculated for each time step and grid cell

thickness: str or Dataset

Only use when vertical levels vary in space One of: a variable, in the dataset, which contains the variable thicknesses; a .nc file which contains the thicknesses; or a Dataset that contains the thicknesses. Note: the .nc file or Dataset must only contain one variable.

depth_range: list

Only use when vertical levels vary in space Set a depth range if desired. Should be of the form [min_depth, max_depth].

Examples

If you wanted to vertical mean of every variable in a dataset, you would do this:

>>> ds.vertical_mean()

This method will calculate the vertical mean weighted by the thickness of each cell. Note that if cell thickness cannot be derived it will just average the values in each vertical cell.