def probabilityToClassification(image):
    """
    Function to convert an image of land cover classification probabilities to land cover classification

    Args:
        image (ee.Image): an Image where each band represents a land cover classification probability

    Returns:
        An ee.Image with one band representing the land cover classification with the highest probability, each image will have 
                integer values representing the number band that has the highest value. For instance if the third band has the 
                highest probability in pixel[i,j], the outputted value in pixel[i,j] will be 3.
                If there are multiple bands of the same maximum value, returns the first band.
    
    Example: 
        The inputted image has the following bands, Agriculture, Forest, Grassland, Water, Urban, where each  band represents the 
                probability that the pixel is of that classification.
        Say for pixel[i,j] of image k, the bands have the following values:
                Agriculture: 0.1
                Forest: 0.6
                Grassland: 0.2
                Water: 0.5
                Urban: 0.5
        Then the returned value of pixel[i,j] in image k would be 2 as Forest is the second band in the image
        
    """
    #Convert bands to an array
    probs_array = image.toArray().toFloat()
    #Get the argMax to find the band that has the highest probability, add 1 because indices start at 0
    probs_max = probs_array.arrayArgmax().arrayGet(0).add(1)
    probs_max = probs_max.set('system:index',image.get('system:index'))
    probs_max = probs_max.set('system:time_start',image.get('system:time_start'))
    probs_max = probs_max.set('system:time_end',image.get('system:time_end'))
    return probs_max