def maximum_consecutive_dry_days(pr, thresh='1 mm/day', freq='YS'):
    r
    t = utils.convert_units_to(thresh, pr, 'hydro')
    group = (pr < t).resample(time=freq)
    return group.apply(rl.longest_run, dim='time')