xarray.coding.times.CFTimedeltaCoder#

class xarray.coding.times.CFTimedeltaCoder(time_unit=None, decode_via_units=True, decode_via_dtype=True)[source]#

Coder for CF Timedelta coding.

Parameters:
  • time_unit (PDDatetimeUnitOptions) – Target resolution when decoding timedeltas via units. Defaults to “ns”. When decoding via dtype, the resolution is specified in the dtype attribute, so this parameter is ignored.

  • decode_via_units (bool) – Whether to decode timedeltas based on the presence of a timedelta-like units attribute, e.g. “seconds”. Defaults to True, but in the future will default to False.

  • decode_via_dtype (bool) – Whether to decode timedeltas based on the presence of a np.timedelta64 dtype attribute, e.g. “timedelta64[s]”. Defaults to True.

__init__(time_unit=None, decode_via_units=True, decode_via_dtype=True)[source]#

Methods

__init__([time_unit, decode_via_units, ...])

decode(variable[, name])

Convert a decoded variable to an encoded variable

encode(variable[, name])

Convert an encoded variable to a decoded variable