def array(self, geom=None, stat=None):
        with greenwich.Raster(self.image.path) as r:
            if geom:
                if geom.num_coords > 1:
                    with r.clip(geom) as clipped:
                        arr = clipped.masked_array()
                else:
                    coord_px = r.affine.transform((geom.coords,)).pop()
                    arr = r.ReadAsArray(*(coord_px + (1, 1)))
            else:
                arr = r.masked_array()
            if arr is not None:
                if stat:
                    arr = getattr(np.ma, stat)(arr)
                if arr.size == 1:
                    arr = arr.item()
            return arr
        raise ValueError('Failure reading array values')
dataset/ETHPy150Open bkg/django-spillway/spillway/models.py/AbstractRasterStore.array/original