xarray.decode_cf(obj, concat_characters=True, mask_and_scale=True, decode_times=True, decode_coords=True, drop_variables=None, use_cftime=None)

Decode the given Dataset or Datastore according to CF conventions into a new Dataset.

  • obj (Dataset or DataStore) – Object to decode.

  • concat_characters (bool, optional) – Should character arrays be concatenated to strings, for example: [‘h’, ‘e’, ‘l’, ‘l’, ‘o’] -> ‘hello’

  • mask_and_scale (bool, optional) – Lazily scale (using scale_factor and add_offset) and mask (using _FillValue).

  • decode_times (bool, optional) – Decode cf times (e.g., integers since ‘hours since 2000-01-01’) to np.datetime64.

  • decode_coords (bool, optional) – Use the ‘coordinates’ attribute on variable (or the dataset itself) to identify coordinates.

  • drop_variables (string or iterable, optional) – A variable or list of variables to exclude from being parsed from the dataset. This may be useful to drop variables with problems or inconsistent values.

  • 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[ns] 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[ns] objects. If False, always decode times to np.datetime64[ns] objects; if this is not possible raise an error.



Return type