Exemplo n.º 1
0
        new_key, new_dset = check_key(key, store.dataset)

        self._store = store
        self._key = new_key
        self._keys = new_dset[self._key].attributes

    @property
    def key(self):
        return self._key

    @property
    def store(self):
        return self._store

    @property
    def displayname(self):
        return "%s Attributes" % self._key

    @property
    def description(self):
        return "Attributes of %s" % self._key


# Register Handlers
Server.push(Attributes)
Server.push(Dataset)
Server.push(Structure)
Server.push(Base)

compass_model.push(Server)
Exemplo n.º 2
0
    def key(self):
        return self._key

    @property
    def store(self):
        self._store

    @property
    def displayname(self):
        return self.key

    @property
    def description(self):
        return self.displayname

    def close(self):
        self._valid = False

    @property
    def keys(self):
        return self.data.keys()

    def __getitem__(self, args):
        return self.data[args]


AsciiGrid.push(Attributes)  # attribute data
AsciiGrid.push(ASCFile)  # array

compass_model.push(AsciiGrid)
Exemplo n.º 3
0
        return self.displayname


    @property
    def width(self):
        return self._obj.shape[1]


    @property
    def height(self):
        return self._obj.shape[0]


    @property
    def palette(self):
        return None


    @property
    def data(self):
        return self._obj[:]


# Register handlers    
HDF5Store.push(HDF5KV)
HDF5Store.push(HDF5Dataset)
HDF5Store.push(HDF5Group)
HDF5Store.push(HDF5Image)

compass_model.push(HDF5Store)
    @property
    def key(self):
        return self._key

    @property
    def store(self):
        self._store

    @property
    def displayname(self):
        return self.key

    @property
    def description(self):
        return self.displayname
        
    def close(self):
        self._valid = False

    @property
    def keys(self):
        return self.data.keys()

    def __getitem__(self, args):
        return self.data[args]

AsciiGrid.push(Attributes)   # attribute data
AsciiGrid.push(ASCFile)      # array

compass_model.push(AsciiGrid)
Exemplo n.º 5
0
        return self.displayname


    @property
    def width(self):
        return self._obj.shape[1]


    @property
    def height(self):
        return self._obj.shape[0]


    @property
    def palette(self):
        return None


    @property
    def data(self):
        return self._obj[:]


# Register handlers    
HDF5Store.push(HDF5KV)
HDF5Store.push(HDF5Dataset)
HDF5Store.push(HDF5Group)
HDF5Store.push(HDF5Image)

compass_model.push(HDF5Store)
Exemplo n.º 6
0
    @property
    def displayname(self):
        return op.basename(self.key)

    @property
    def description(self):
        return 'File "%s", size %d bytes' % (self.displayname, op.getsize(self.key))

    @property
    def shape(self):
        return (op.getsize(self.key),)

    @property
    def dtype(self):
        return np.dtype('u1')

    def __getitem__(self, args):
        try:
            with open(self.key, 'rb') as f:
                data = np.fromstring(f.read(), dtype='u1')
        except OSError, IOError:
            data = np.zeros((len(self),), dtype='u1')

        return data[args]

Filesystem.push(File)
Filesystem.push(Directory)

compass_model.push(Filesystem)
Exemplo n.º 7
0
    @property
    def key(self):
        return self._key

    @property
    def store(self):
        return self._store

    @property
    def displayname(self):
        return self.key

    @property
    def description(self):
        return self.displayname

    @property
    def keys(self):
        return self.data.keys()

    def __getitem__(self, args):
        return self.data[args]


ArrayStore.push(ArrayKV)
ArrayStore.push(ArrayContainer)
ArrayStore.push(Array)

compass_model.push(ArrayStore)
Exemplo n.º 8
0
    def displayname(self):
        return op.basename(self.key)

    @property
    def description(self):
        return 'File "%s", size %d bytes' % (self.displayname,
                                             op.getsize(self.key))

    @property
    def shape(self):
        return (op.getsize(self.key), )

    @property
    def dtype(self):
        return np.dtype('u1')

    def __getitem__(self, args):
        try:
            with open(self.key, 'rb') as f:
                data = np.fromstring(f.read(), dtype='u1')
        except (OSError, IOError):
            data = np.zeros((len(self), ), dtype='u1')

        return data[args]


Filesystem.push(File)
Filesystem.push(Directory)

compass_model.push(Filesystem)