def coordinate2inx(coordinate, row=8, col=16, im_shape=[300, 600]):
    """Convert coordinate of top-left corner of bbox into index.
    Index on solar module looks like:
    [[0, 1, 2]
     [3, 4, 5]]

     Parameters
     ----------
     coordinate: list
     [x, y] of top-left corner of bbox

     row, col: int
     number of rows and columns of solar module

     im_shape: list
     Shape of the module image in the form of [height, width]

     Returns
     -------
     inx: int
     Index of the bbox
    """
    inx = col * round(coordinate[1] / (im_shape[0] / row)) + round(coordinate[0] / (im_shape[1] / col))

    return inx