wrf.metadecorators.set_alg_metadata(alg_ndims, refvarname, refvarndims=None, missingarg=None, stagdim=None, stagsubvar=None, units=None, description=None)

A decorator that sets the metadata for a wrapped raw diagnostic function.

  • alg_ndims (int) – The number of dimensions returned by the wrapped function.
  • refvarname (str) – The wrapped function argument name for the reference variable.
  • refvarndims (int, optional) – The number of right dimensions for the reference variable. This paramter is required when the wrapped function result has less dimensions than reference. Default is None.
  • missingarg (str, optional) – The wrapped function argument name for the missing value variable. Default is None.
  • ( (stagdim) – obj`int`, optional): The staggered dimension for the reference. This is only needed if the reference variable is on a staggered grid. Default is None.
  • stagsubvar (str, optional) – The wrapped function argument name to use to supply the unstaggered dimension name for the staggered dimension in the reference. This is needed if stagdim is not None. It is primarily used for absolute vorticity. Default is None.
  • units (str, optional) – The units to use if if there is no ‘units’ argument for the wrapped function. Default is None.
  • description (str, optional) – A description for the wrapped algorithm, which is stored in the xarray.DataArray.attrs attribute under the ‘description’ key. Default is None.

The wrapped numerical function output with or without metadata. If xarray is enabled and the meta parameter is True, then the result will be a xarray.DataArray object. Otherwise, the result will be a numpy.ndarray object with no metadata.

Return type:

xarray.DataArray or numpy.ndarray