polaris.cf.add_var_attrs

polaris.cf.add_var_attrs(ds: Dataset, var_attrs: Mapping[str, Mapping[str, str]]) → Dataset[source]

Fill in attributes (units, long_name, …) for the variables of a dataset from a table, without changing any attribute a variable already has.

Parameters:
  • ds (xarray.Dataset) – A dataset about to be written

  • var_attrs (dict) – The attributes to add to each variable, keyed by variable name. Variables not in the dataset are ignored.

Returns:

ds (xarray.Dataset) – A shallow copy of the dataset with the attributes added