@@ -59,11 +59,11 @@ use :py:meth:`~xarray.DataArray.squeeze`
5959 Converting between datasets and arrays
6060--------------------------------------
6161
62- To convert from a Dataset to a DataArray, use :py:meth: `~xarray.Dataset.to_array `:
62+ To convert from a Dataset to a DataArray, use :py:meth: `~xarray.Dataset.to_dataarray `:
6363
6464.. ipython :: python
6565
66- arr = ds.to_array ()
66+ arr = ds.to_dataarray ()
6767 arr
6868
6969 This method broadcasts all data variables in the dataset against each other,
@@ -77,7 +77,7 @@ To convert back from a DataArray to a Dataset, use
7777
7878 arr.to_dataset(dim = " variable" )
7979
80- The broadcasting behavior of ``to_array `` means that the resulting array
80+ The broadcasting behavior of ``to_dataarray `` means that the resulting array
8181includes the union of data variable dimensions:
8282
8383.. ipython :: python
@@ -88,7 +88,7 @@ includes the union of data variable dimensions:
8888 ds2
8989
9090 # the resulting array has 6 elements
91- ds2.to_array ()
91+ ds2.to_dataarray ()
9292
9393 Otherwise, the result could not be represented as an orthogonal array.
9494
@@ -161,8 +161,8 @@ arrays as inputs. For datasets with only one variable, we only need ``stack``
161161and ``unstack ``, but combining multiple variables in a
162162:py:class: `xarray.Dataset ` is more complicated. If the variables in the dataset
163163have matching numbers of dimensions, we can call
164- :py:meth: `~xarray.Dataset.to_array ` and then stack along the the new coordinate.
165- But :py:meth: `~xarray.Dataset.to_array ` will broadcast the dataarrays together,
164+ :py:meth: `~xarray.Dataset.to_dataarray ` and then stack along the the new coordinate.
165+ But :py:meth: `~xarray.Dataset.to_dataarray ` will broadcast the dataarrays together,
166166which will effectively tile the lower dimensional variable along the missing
167167dimensions. The method :py:meth: `xarray.Dataset.to_stacked_array ` allows
168168combining variables of differing dimensions without this wasteful copying while
0 commit comments