def extract_grid(self, longmin, longmax, latmin, latmax):
        ''' Extract part of the image ``img``

        Args:
            longmin (float): Minimum longitude of the window
            longmax (float): Maximum longitude of the window
            latmin (float): Minimum latitude of the window
            latmax (float): Maximum latitude of the window

        Returns:
            A tupple of three arrays ``(X,Y,Z)`` with ``X`` contains the
            longitudes, ``Y`` contains the latitude and ``Z`` the values
            extracted from the window.

        Note:
            All return arrays have the same size.

            All coordinate are in degree.

        '''

        sample_min, sample_max = map(
            int, map(self.sample_id, [longmin, longmax]))
        line_min, line_max = map(int, map(self.line_id, [latmax, latmin]))
        X = np.array(map(self.long_id, (range(sample_min, sample_max, 1))))
        Y = np.array(map(self.lat_id, (range(line_min, line_max + 1, 1))))

        for i, line in enumerate(range(int(line_min), int(line_max) + 1)):
            start = (line - 1) * int(self.SAMPLE_LAST_PIXEL) + sample_min
            chunk_size = int(sample_max - sample_min)
            Za = self.array(chunk_size, start, self.bytesize)
            if i == 0:
                Z = Za
            else:
                Z = np.vstack((Z, Za))

        X, Y = np.meshgrid(X, Y)

        return X, Y, Z