def read_n_altitude_lvls(fn):
    """Read number of altitude levels from WF / BAMF output"""
    with open(fn, 'r') as fd:
        while True:
            ln = fd.readline()
            tmp = ln.split('The number of altitude levels:')
            if len(tmp) > 1:
                return int(tmp[-1])
    raise ValueError('Number of altitude levels not found in {}'.format(fn))
