🍾 Xarray is now 10 years old! 🎉

xarray.date_range_like

xarray.date_range_like#

xarray.date_range_like(source, calendar, use_cftime=None)[source]#

Generate a datetime array with the same frequency, start and end as another one, but in a different calendar.

Parameters:
Returns:

DataArray – 1D datetime coordinate with the same start, end and frequency as the source, but in the new calendar. The start date is assumed to exist in the target calendar. If the end date doesn’t exist, the code tries 1 and 2 calendar days before. There is a special case when the source time series is daily or coarser and the end of the input range is on the last day of the month. Then the output range will also end on the last day of the month in the new calendar.