greenwich/raster.py
def masked_array(self, geometry=None):
        """Returns a MaskedArray using nodata values.

        Keyword args:
        geometry -- any geometry, envelope, or coordinate extent tuple
        """
        if geometry is None:
            return self._masked_array()
        geom = transform(geometry, self.sref)
        env = Envelope.from_geom(geom).intersect(self.envelope)
        arr = self._masked_array(env)
        if geom.GetGeometryType() != ogr.wkbPoint:
            dims = self.get_offset(env)[2:]
            affine = AffineTransform(*tuple(self.affine))
            affine.origin = env.ul
            mask = ~np.ma.make_mask(geom_to_array(geom, dims, affine))
            arr.mask = arr.mask | mask
        return arr
def masked_array(self, geometry=None):
        """Returns a MaskedArray using nodata values.

        Keyword args:
        geometry -- any geometry, envelope, or coordinate extent tuple
        """
        if geometry is None:
            return self._masked_array()
        geom = transform(geometry, self.sref)
        env = Envelope.from_geom(geom).intersect(self.envelope)
        arr = self._masked_array(env)
        if geom.GetGeometryType() != ogr.wkbPoint:
            dims = self.get_offset(env)[2:]
            affine = AffineTransform(*tuple(self.affine))
            affine.origin = env.ul
            mask = ~np.ma.make_mask(geom_to_array(geom, dims, affine))
            arr.mask = arr.mask | mask
        return arr
Returns a MaskedArray using nodata values.

        Keyword args:
        geometry -- any geometry, envelope, or coordinate extent tuple