def calc_no_within_ts(levels, lvl, varname):
    """calculate the position for a given level and variable inside the current timestep

    Args:
        levels: all levels
        lvl: the level we are interested in
        varname: the variable we are interested in

    Returns:
        no of steps
    """
    steps = 0
    for i in range(len(levels)):
        if lvl == levels[i]['level']:
            #print('level reached ', lvl)
            steps += list(map(lambda x: x[0], levels[i]['vars'])).index(varname)
            break
        steps += len(levels[i]['vars'])
    return steps