Return the day of year of the maximum value.

def doymax(da):
    """Return the day of year of the maximum value."""
    i = da.argmax(dim='time')
    out = da.time.dt.dayofyear[i]
    out.attrs['units'] = ''
    return out