def masked_array(self, geometry=None):
if geometry is None:<EOL><INDENT>return self._masked_array()<EOL><DEDENT>geom = transform(geometry, self.sref)<EOL>env = Envelope.from_geom(geom).intersect(self.envelope)<EOL>arr = self._masked_array(env)<EOL>if geom.GetGeometryType() != ogr.wkbPoint:<EOL><INDENT>dims = self.get_offset(env)[<NUM_LIT:2>:]<EOL>affine = AffineTransform(*tuple(self.affine))<EOL>affine.origin = env.ul<EOL>mask = ~np.ma.make_mask(geom_to_array(geom, dims, affine))<EOL>arr.mask = arr.mask | mask<EOL><DEDENT>return arr<EOL>
Returns a MaskedArray using nodata values.

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