def normalize(img, maxImg, minImg):
  """
  Scale an image from 0 to 1

  Parameters:
    img (ee.Image): image to be rescaled
    maxImg (ee.Image): image storing the maximum value of the image
    minImg (ee.Image): image storing the minimum value of the image
  Returns:
    ee.Image:
  """
  return img.subtract(minImg).divide(maxImg.subtract(minImg))