def _existing_coverage(self, root_dir, persistence_guid): if not is_persisted(root_dir, persistence_guid): raise SystemError('Cannot find specified coverage: {0}'.format(persistence_guid)) self._persistence_layer = PostgresPersistenceLayer(root_dir, persistence_guid, mode=self.mode) if self._persistence_layer.version != self.version: raise IOError('Coverage Model Version Mismatch: %s != %s' %(self.version, self._persistence_layer.version)) self.name = self._persistence_layer.name self.mode = self.mode self._reference_covs = collections.OrderedDict()
def __init__(self, root_dir, persistence_guid, name=None, reference_coverage_locs=None, reference_coverage_extents=None, parameter_dictionary=None, mode=None, complex_type=ComplexCoverageType.PARAMETRIC_STRICT, temporal_domain=None, spatial_domain=None): # Initializes base class with proper mode. super(AggregateCoverage, self).__init__(mode) if root_dir != None: log.info("\'root_dir\' specification is OBE. Use coverage configuration file to specify root_dir") try: # Make sure persistence_guid is string if not isinstance(persistence_guid, basestring): raise TypeError('\'persistence_guid\' must be instance of basestring') root_dir = CoverageConfig().top_level_storage_location if is_persisted(root_dir, persistence_guid): self._existing_coverage(root_dir, persistence_guid) else: self._new_coverage(root_dir, persistence_guid, name, reference_coverage_locs, parameter_dictionary, complex_type, reference_coverage_extents) except: self._closed = True raise self._do_build()