xoa.cf.infer_cf_specs

Contents

xoa.cf.infer_cf_specs#

xoa.cf.infer_cf_specs(ds, named=False, from_attrs=True, from_score=False)[source]#

Get the registered CFSpecs that are best matching this dataset

This accomplished with some heurestics. First, the cf_specs global attribute or encoding of the dataset is compared with the name of all registered datasets. Second, a score based on the number of data_vars and coord names that are both in the cfspecs and the dataset is computed by get_cf_specs_matching_score() for the registered instances. Finally, if no matching dataset is found, the current one is returned.

Parameters:
  • ds (xarray.Dataset, xarray.DataArray)

  • named (bool) – Make sure the candidate CFSpecs have a name

  • from_attrs (bool) – Scan attributes to infer specs

  • from_score (bool) – Compute the matching score to infer specs

Returns:

CFSpecs – The matching cf specs or the current ones