Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions xarray/core/dataarray.py
Original file line number Diff line number Diff line change
Expand Up @@ -2490,15 +2490,19 @@ def to_masked_array(self, copy: bool = True) -> np.ma.MaskedArray:
def to_netcdf(self, *args, **kwargs) -> Union[bytes, "Delayed", None]:
"""Write DataArray contents to a netCDF file.

All parameters are passed directly to `xarray.Dataset.to_netcdf`.
All parameters are passed directly to :py:meth:`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__'.
name is the same as a coordinate name, then it is given the name
``"__xarray_dataarray_variable__"``.

See Also
--------
Dataset.to_netcdf
"""
from ..backends.api import DATAARRAY_NAME, DATAARRAY_VARIABLE

Expand Down