Dataset.to_dict(data=True, encoding=False)[source]#

Convert this dataset to a dictionary following xarray naming conventions.

Converts all variables and attributes to native Python objects Useful for converting to json. To avoid datetime incompatibility use decode_times=False kwarg in xarrray.open_dataset.

  • data (bool, default: True) – Whether to include the actual data in the dictionary. When set to False, returns just the schema.

  • encoding (bool, default: False) – Whether to include the Dataset’s encoding in the dictionary.


d (dict) – Dict with keys: “coords”, “attrs”, “dims”, “data_vars” and optionally “encoding”.