示例#1
0
    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_()
示例#2
0
 def _loadManagerAttributes_(self):
     Hdf5FileReader._loadManagerAttributes_(self)
     self._loadGridFileAttributes_()
示例#3
0
 def __init__(self, hdf5_filepath):
     Hdf5FileReader.__init__(self, hdf5_filepath)
     self._area_mask = None
示例#4
0
 def _loadGridFileAttributes_(self):
     Hdf5FileReader._loadManagerAttributes_(self)
     self.unsetGridBounds()
     self._initCoordinateLimits()
     self._loadGridExtentAttributes_()
示例#5
0
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)