def _loadGridFileAttributes_(self): Hdf5FileReader._loadManagerAttributes_(self) self._initCoordinateLimits() self.unsetGridBounds() if self.lats is not None: self.grid_shape = self.lats.shape self.grid_size = self.lats.size else: self.grid_shape = () self.grid_size = -32768 if (not hasattr(self, 'node_search_radius') or self.node_search_radius is None) and self.lats is not None: self._setDefaultSearchRadius_()
def _loadManagerAttributes_(self): Hdf5FileReader._loadManagerAttributes_(self) self._loadGridFileAttributes_()
def __init__(self, hdf5_filepath): Hdf5FileReader.__init__(self, hdf5_filepath) self._area_mask = None
def _loadGridFileAttributes_(self): Hdf5FileReader._loadManagerAttributes_(self) self.unsetGridBounds() self._initCoordinateLimits() self._loadGridExtentAttributes_()
last_obs_date = target_date - relativedelta(days=1) from_filepath = os.path.normpath(args[0]) to_filepath = from_filepath.replace('.h5','-COPY.h5') if os.path.exists(to_filepath): replace_existing = options.replace_existing if replace_existing: os.remove(to_filepath) else: print to_filepath, 'already exists.' exit(1) msg = "Copying datasets from '%s'\nto new file at '%s'" print msg % (from_filepath, to_filepath) reader = Hdf5FileReader(from_filepath) manager = Hdf5FileManager(to_filepath, 'a') manager.setFileAttributes(**dict(reader.getFileAttributes())) for name in reader.group_names: attrs = reader.getGroupAttributes(name) print "creating '%s' group" % name manager.open('a') manager.createGroup(name) manager.setGroupAttributes(name, **attrs) manager.close() for name in reader.dataset_names: print "creating '%s' dataset" % name dataset = reader.getDataset(name)