nctoolkit.DataSet.to_xarray

nctoolkit.DataSet.to_xarray#

DataSet.to_xarray(decode_times=True, **kwargs)#

to_xarray: 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.

  • **kwargs (kwargs) – Optional arguments to be sent to subset.

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)