code: def is_raster_y_inverted(layer):
      
      info = gdal.Info(layer.source(), format='json')
      y_maximum = info['cornerCoordinates']['upperRight'][1]
      y_minimum = info['cornerCoordinates']['lowerRight'][1]
      return y_maximum < y_minimum
docs: Check if the raster is upside down, ie Y inverted.
  
      See issue : https://github.com/inasafe/inasafe/issues/4026
  
      :param layer: The layer to test.
      :type layer: QgsRasterLayer
  
      :return: A boolean to know if the raster is correct or not.
      :rtype: bool