<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def set_data(self, data, metadata=None):
 """Set an image to be displayed by providing raw data. This is a convenience method for first constructing an image with `~ginga.AstroImage.AstroImage` and then calling :meth:`set_image`. Parameters data : ndarray This should be at least a 2D Numpy array. metadata : dict or `None` Image metadata mapping keywords to their respective values. """

        image = AstroImage.AstroImage(data, metadata=metadata,
                                      logger=self.logger)
        self.set_image(image)