Commit cbbe1fbb authored by Theo Steininger's avatar Theo Steininger

Added repository methods to Observable class.

parent fccf4f53
......@@ -25,3 +25,23 @@ class Observable(Field):
self._ensemble_mean = self.mean(spaces=0)
finally:
return self._ensemble_mean
def _to_hdf5(self, hdf5_group):
if self._ensemble_mean is not None:
return_dict = {'ensemble_mean': self._ensemble_mean}
else:
return_dict = {}
return_dict.update(
super(Observable, self)._to_hdf5(hdf5_group=hdf5_group))
return return_dict
@classmethod
def _from_hdf5(cls, hdf5_group, repository):
new_field = super(Observable, cls)._from_hdf5(hdf5_group=hdf5_group,
repository=repository)
try:
observable_mean = repository.get('ensemble_mean', hdf5_group)
new_field._observable_mean = observable_mean
except(KeyError):
pass
return new_field
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment