Added common_dimensions(ds) that lists common dimensions between two
datasets.
This commit is contained in:
parent
ff8833a22c
commit
68cc583d2c
|
@ -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.
|
||||
|
@ -205,6 +211,7 @@ class Dataset:
|
|||
if ni != na:
|
||||
raise ValueError, "Identifier-array mismatch: %s: (idents: %s, array: %s)" %(self._name, ni, na)
|
||||
|
||||
|
||||
class CategoryDataset(Dataset):
|
||||
"""The category dataset class.
|
||||
|
||||
|
|
Reference in New Issue