def merge(self, img):
        """Use the provided image as background for the current *img* image,
        that is if the current image has missing data.
        """
        raise NotImplementedError("This method has not be implemented for "
                                  "xarray support.")
        if self.is_empty():
            raise ValueError("Cannot merge an empty image.")

        if self.mode != img.mode:
            raise ValueError("Cannot merge image of different modes.")

        selfmask = self.channels[0].mask
        for chn in self.channels[1:]:
            selfmask = np.ma.mask_or(selfmask, chn.mask)

        for i in range(len(self.channels)):
            self.channels[i] = np.ma.where(selfmask,
                                           img.channels[i],
                                           self.channels[i])
            self.channels[i].mask = np.logical_and(selfmask,
                                                   img.channels[i].mask)
def merge ( self , img ) : raise NotImplementedError ( "This method has not be implemented for " "xarray support." ) if self . is_empty ( ) : raise ValueError ( "Cannot merge an empty image." ) if self . mode != img . mode : raise ValueError ( "Cannot merge image of different modes." ) selfmask = self . channels [ 0 ] . mask for chn in self . channels [ 1 : ] : selfmask = np . ma . mask_or ( selfmask , chn . mask ) for i in range ( len ( self . channels ) ) : self . channels [ i ] = np . ma . where ( selfmask , img . channels [ i ] , self . channels [ i ] ) self . channels [ i ] . mask = np . logical_and ( selfmask , img . channels [ i ] . mask )
Use the provided image as background for the current *img* image,
        that is if the current image has missing data.