Compute vertical layer thicknesses for an ocean cube
Source:R/cube_grid_geometry.R
cube_layer_thickness.RdVertical bounds must be supplied explicitly or be present in cube metadata;
they are never inferred from depth centres. Supported representations are an
interface vector of length n_depth + 1 or an n_depth-by-2 matrix. Layer
thickness is the positive distance between bounds, so axes declared positive
upward or positive downward retain cube order without producing negative
thicknesses.
Usage
cube_layer_thickness(x, depth_bounds = NULL, unit = c("native", "m", "km"))Arguments
- x
An
ocean_cube()with a finite depth axis.- depth_bounds
Explicit vertical interfaces or paired bounds. If
NULL, metadata attached to the cube is used.- unit
Output unit: native depth units, metres, or kilometres.
Details
For NetCDF cubes, a certified dimensional metric-depth descriptor
at x$metadata$cf$current$vertical supplies CF bounds automatically.
Height, pressure, dimensionless, parametric, unresolved, and
derivation-pending vertical coordinates are not geometric depth and are
rejected. The supported physical-unit subset is metres and kilometres;
no pressure-to-depth or height-to-depth conversion is performed.