xarray.DataArray.to_netcdf

DataArray.to_netcdf(self, *args, **kwargs) → Union[bytes, ForwardRef('Delayed'), NoneType]

Write DataArray contents to a netCDF file.

All parameters are passed directly to xarray.Dataset.to_netcdf.

Notes

Only xarray.Dataset objects can be written to netCDF files, so the xarray.DataArray is converted to a xarray.Dataset object containing a single variable. If the DataArray has no name, or if the name is the same as a co-ordinate name, then it is given the name ‘__xarray_dataarray_variable__’.