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:
|
else:
|
||||||
return [dim for dim in self]
|
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):
|
def get_identifiers(self, dim, indices=None,sorted=False):
|
||||||
"""Returns identifiers along dim, sorted by position (index)
|
"""Returns identifiers along dim, sorted by position (index)
|
||||||
is optional.
|
is optional.
|
||||||
|
@ -205,6 +211,7 @@ class Dataset:
|
||||||
if ni != na:
|
if ni != na:
|
||||||
raise ValueError, "Identifier-array mismatch: %s: (idents: %s, array: %s)" %(self._name, ni, na)
|
raise ValueError, "Identifier-array mismatch: %s: (idents: %s, array: %s)" %(self._name, ni, na)
|
||||||
|
|
||||||
|
|
||||||
class CategoryDataset(Dataset):
|
class CategoryDataset(Dataset):
|
||||||
"""The category dataset class.
|
"""The category dataset class.
|
||||||
|
|
||||||
|
|
Reference in New Issue