cf.Data.override_calendar

Data.override_calendar(calendar, inplace=False, i=False)[source]

Override the calendar of the data array elements.

Not to be confused with using the change_calendar method or setting the d.Units.calendar. override_calendar is different because the new calendar need not be equivalent to the original ones and the data array elements will not be changed to reflect the new units.

Parameters
calendar: str

The new calendar.

inplace: bool, optional

If True then do the operation in-place and return None.

i: deprecated at version 3.0.0

Use the inplace parameter instead.

Returns
Data or None

The new data, or None if the operation was in-place.

Examples

>>> d = cf.Data(1, 'days since 2020-02-28')
>>> d
<CF Data(): 2020-02-29 00:00:00>
>>> d.datum()
1
>>> e = d.override_calendar('noleap')
<CF Data(): 2020-03-01 00:00:00 noleap>
>>> e.datum()
1