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 tonp.datetime64
objects; if this is not possible, decode times tocftime.datetime
objects. If True, always decode times tocftime.datetime
objects, regardless of whether or not they can be represented usingnp.datetime64
objects. If False, always decode times tonp.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”.
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