def xy_to_cell_id(x: int, y: int, Ngrid: int):
    """ Convert a position (x,y) to the grid cell
        index (where upper left hand column is indexed
        0 & indexing is done rowwise)
    """
    return x + y*Ngrid