diff --git a/fluents/dataset.py b/fluents/dataset.py index 9ee083f..4428c49 100644 --- a/fluents/dataset.py +++ b/fluents/dataset.py @@ -142,6 +142,12 @@ class Dataset: else: return [dim for dim in self] + def common_dims(self, ds): + """Returns a list of the common dimensions in the two datasets.""" + dims = self.get_dim_name() + ds_dims = ds.get_dim_name() + return [d for d in dims if d in ds_dims] + def get_identifiers(self, dim, indices=None,sorted=False): """Returns identifiers along dim, sorted by position (index) is optional. @@ -204,7 +210,8 @@ class Dataset: for ni, na in zip(identifier_shape, self.shape): if ni != na: raise ValueError, "Identifier-array mismatch: %s: (idents: %s, array: %s)" %(self._name, ni, na) - + + class CategoryDataset(Dataset): """The category dataset class.