polaris.ocean.vertical.diagnostics.vertical_coord_from_location
- polaris.ocean.vertical.diagnostics.vertical_coord_from_location(ds, location, allow_reconstruct=False, ds_vert=None)[source]
Get the vertical coordinate field appropriate for a variable at a given location in
ds- Parameters:
ds (xarray.Dataset) – A dataset with no
Timedimension or aTimedimension of length onelocation ({'cell-center', 'cell-interfaces', 'cell-top'}) – Where the variable is defined: layer midpoints, layer interfaces, or the top of each layer
allow_reconstruct (bool, optional) – Whether to reconstruct the coordinate from
layerThicknessvia_reconstruct_z_mid_and_interface()when the data set does not carry the field directlyds_vert (xarray.Dataset, optional) – The vertical coordinate dataset containing
bottomDepthand optionallyminLevelCellandmaxLevelCell, used when reconstructing the geometry
- Returns:
coord (xarray.DataArray) – The elevation of
ds[var_name], in m, positive up, onnCellsand the vertical dimension appropriate tolocation. ATimedimension of length one is retained if present.var_nameiszMid,GeomZInterfaceorzTopforlocation'cell-center','cell-interfaces'or'cell-top', respectively- Raises:
ValueError – If
locationis not one of the supported values, the corresponding field is not present in the dataset and it may not be reconstructed, ordshas aTimedimension of length other than one