xoa.sigma.get_sigma_terms

xoa.sigma.get_sigma_terms(ds, vloc=None, hlocs=None, rename=False)[source]

Get sigma terms from a dataset as another dataset

It operates like this:

  1. Search for the sigma variables.

  2. Parse their formula_terms attribute.

  3. Create a dict for each locations from names in datasets to xoa.cf compliant names that are also used in conversion functions.

Parameters:
  • ds (xarray.Dataset) –

  • vloc (str, {"any", None}, False) – Staggered grid vertical location. If any or None, results for all locations are returned.

  • hlocs (None, list of str) – A list of horizontal grid locations

Returns:

dict, dict of dict, dict of dict of dict – A dict is generated for a given sigma variable, whose keys are array names, like "sc_r", and values are cf names, like "sig". A special key is the "type" whose corresponding value is the standard_name, stripped from its potential staggered grid location indicator. If loc is "any" or None, each dict is embedded in a master dict whose keys are staggered grid location. If no location is found, the key is set None.

Raises:

xoa.sigma.XoaSigmaError – In case of: - inconsistent staggered grid location in dataarrays as checked by xoa.cf.SGLocator.get_location() - no standard_name in sigma/s variable - a malformed formula - a formula term variable that is not found in the dataset - an unknown formula term name