nctoolkit.DataSet.to_xarray

DataSet.to_xarray(self, decode_times=True, cdo_times=False)

Open a dataset as an xarray object

Parameters
  • decode_times (boolean) – Set to False if you do not want xarray to decode the times. Default is True. If xarray cannot decode times, CDO will be used.

  • cdo_times (boolean) – Set to True if you do not want CDO to decode the times

Returns

to_xarray

Return type

xarray.Dataset

Examples

If you want to convert a dataset to an xarray dataset, do the following:

>>> ds.to_xarray()

This will return an xarray dataset.

If you do not want time to be decoded, do the following:

>>> ds.to_xarray(decode_times = False)