def calc_mean(resdf, var, limit=180):
    """Return mean of `var` over historical period given by `limit`"""
    limit = min(len(resdf.loc[var]), limit)
    val = resdf.loc[var][-limit:].mean()
    return val