xoa.cf.infer_cf_specs
- xoa.cf.infer_cf_specs(ds, named=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 byget_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
- Returns:
CFSpecs – The matching cf specs or the current ones