MCPcopy
hub / github.com/pydata/xarray / _interpolate_day_of_year

Function _interpolate_day_of_year

xarray/coding/calendar_ops.py:247–254  ·  view source on GitHub ↗

Returns the nearest day in the target calendar of the corresponding "decimal year" in the source calendar.

(times, target_calendar)

Source from the content-addressed store, hash-verified

245
246
247def _interpolate_day_of_year(times, target_calendar):
248 """Returns the nearest day in the target calendar of the corresponding "decimal year" in the source calendar."""
249 source_calendar = times.dt.calendar
250 return np.round(
251 _days_in_year(times.dt.year, target_calendar)
252 * times.dt.dayofyear
253 / _days_in_year(times.dt.year, source_calendar)
254 ).astype(int)
255
256
257def _random_day_of_year(time, target_calendar, use_cftime):

Callers 1

convert_calendarFunction · 0.85

Calls 3

_days_in_yearFunction · 0.85
astypeMethod · 0.45
roundMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…