import re


def get_ens_num(file):
    """
    Return the ensemble number in file name
    :param file: file name, string
    :return: ensemble number, int
    """
    f = r'ens(\d+)'
    match = re.search(f, file)
    if match:
        return int(match.group(1))
    # If no 'ens' seen, assume only one ensemble given
    return 101