xarray.coders.CFDatetimeCoder

xarray.coders.CFDatetimeCoder#

class xarray.coders.CFDatetimeCoder(use_cftime=None, time_unit='ns')[source]#

Coder for CF Datetime coding.

Parameters:
  • use_cftime (bool, optional) – Only relevant if encoded dates come from a standard calendar (e.g. “gregorian”, “proleptic_gregorian”, “standard”, or not specified). If None (default), attempt to decode times to np.datetime64 objects; if this is not possible, decode times to cftime.datetime objects. If True, always decode times to cftime.datetime objects, regardless of whether or not they can be represented using np.datetime64 objects. If False, always decode times to np.datetime64 objects; if this is not possible raise an error. May not be supported by all the backends.

  • time_unit (PDDatetimeUnitOptions) – Target resolution when decoding dates. Defaults to “ns”.

__init__(use_cftime=None, time_unit='ns')[source]#

Methods

__init__([use_cftime, time_unit])

decode(variable[, name])

Convert a decoded variable to an encoded variable

encode(variable[, name])

Convert an encoded variable to a decoded variable