def find_height_profile_dimension(dat_file):
    """Find the dimension of the provided height profile .dat file.
    1D files have 2 columns, 2D - 8 columns.

    Args:
        dat_file (str): full path to height profile .dat file.

    Returns:
        dimension (int): found dimension.
    """
    with open(dat_file, 'r') as f:
        header = f.readline().strip().split()
        dimension = 1 if len(header) == 2 else 2
    return dimension