def _interpolate_day_of_year(times, target_calendar):
    """Returns the nearest day in the target calendar of the corresponding "decimal year" in the source calendar."""
    source_calendar = times.dt.calendar
    return np.round(
        _days_in_year(times.dt.year, target_calendar)
        * times.dt.dayofyear
        / _days_in_year(times.dt.year, source_calendar)
    ).astype(int)
Returns the nearest day in the target calendar of the corresponding "decimal year" in the source calendar.
xarray/coding/calendar_ops.py