xoa.sigma.decode_sigma

Contents

xoa.sigma.decode_sigma#

xoa.sigma.decode_sigma(ds, rename=False, hlocs=None, errors='raise')[source]#

Compute heights from sigma-like variable in a dataset using CF conventions

This makes use of the MetaSpecs instance that is retrieved with xoa.meta.get_meta_specs() with ds as an argument in order to find needed variables. If the dataset is not found to have sigma-like coordinates, a simple copy is returned.

When a data variable that has the same dimensions is found, the computed coordinate is transposed properly and assigned to the variable as a coordinate array.

Parameters:
  • ds (xarray.Dataset) – Dataset that contains everything needed to compute heights

  • rename (bool) – Rename and format arrays to make them compliant with xoa.meta

  • hlocs (None, list of str) – Horizontal staggered grid locations to search for “bathy” and “ssh”. By default, no location is assumed.

  • errors ({'ignore', 'warn', 'raise'}) –

    In case of errors

    • 'ignore': silently ignore

    • 'warn': emit a warning

    • 'raise': raise an exception

Returns:

xarray.Dataset