Projects/laydi
Projects
/
laydi
Archived
7
0
Fork 0

Added common_dimensions(ds) that lists common dimensions between two

datasets.
This commit is contained in:
Einar Ryeng 2007-06-22 15:35:45 +00:00
parent ff8833a22c
commit 68cc583d2c
1 changed files with 8 additions and 1 deletions

View File

@ -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.