Skip to content

Commit 21c4687

Browse files
authored
Merge branch 'main' into to_dataset-silently-drops
2 parents f14ad1a + 0c1ad54 commit 21c4687

28 files changed

+144
-128
lines changed

.binder/environment.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: xarray-examples
22
channels:
33
- conda-forge
44
dependencies:
5-
- python=3.9
5+
- python=3.10
66
- boto3
77
- bottleneck
88
- cartopy
@@ -25,7 +25,7 @@ dependencies:
2525
- numpy
2626
- packaging
2727
- pandas
28-
- pint
28+
- pint>=0.22
2929
- pip
3030
- pooch
3131
- pydap

ci/requirements/all-but-dask.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ dependencies:
2626
- numpy
2727
- packaging
2828
- pandas
29-
- pint<0.21
29+
- pint>=0.22
3030
- pip
3131
- pseudonetcdf
3232
- pydap

ci/requirements/environment-py311.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ dependencies:
2828
- numpy
2929
- packaging
3030
- pandas
31-
- pint<0.21
31+
- pint>=0.22
3232
- pip
3333
- pooch
3434
- pre-commit

ci/requirements/environment-windows-py311.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ dependencies:
2525
- numpy
2626
- packaging
2727
- pandas
28-
- pint<0.21
28+
- pint>=0.22
2929
- pip
3030
- pre-commit
3131
- pseudonetcdf

ci/requirements/environment-windows.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ dependencies:
2525
- numpy
2626
- packaging
2727
- pandas
28-
- pint<0.21
28+
- pint>=0.22
2929
- pip
3030
- pre-commit
3131
- pseudonetcdf

ci/requirements/environment.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ dependencies:
2929
- opt_einsum
3030
- packaging
3131
- pandas
32-
- pint<0.21
32+
- pint>=0.22
3333
- pip
3434
- pooch
3535
- pre-commit

ci/requirements/min-all-deps.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ dependencies:
3535
- numpy=1.22
3636
- packaging=21.3
3737
- pandas=1.4
38-
- pint=0.19
38+
- pint=0.22
3939
- pip
4040
- pseudonetcdf=3.2
4141
- pydap=3.3

doc/api.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -557,6 +557,7 @@ Datetimelike properties
557557
DataArray.dt.seconds
558558
DataArray.dt.microseconds
559559
DataArray.dt.nanoseconds
560+
DataArray.dt.total_seconds
560561

561562
**Timedelta methods**:
562563

@@ -602,7 +603,7 @@ Dataset methods
602603
Dataset.as_numpy
603604
Dataset.from_dataframe
604605
Dataset.from_dict
605-
Dataset.to_array
606+
Dataset.to_dataarray
606607
Dataset.to_dataframe
607608
Dataset.to_dask_dataframe
608609
Dataset.to_dict

doc/howdoi.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ How do I ...
3636
* - rename a variable, dimension or coordinate
3737
- :py:meth:`Dataset.rename`, :py:meth:`DataArray.rename`, :py:meth:`Dataset.rename_vars`, :py:meth:`Dataset.rename_dims`,
3838
* - convert a DataArray to Dataset or vice versa
39-
- :py:meth:`DataArray.to_dataset`, :py:meth:`Dataset.to_array`, :py:meth:`Dataset.to_stacked_array`, :py:meth:`DataArray.to_unstacked_dataset`
39+
- :py:meth:`DataArray.to_dataset`, :py:meth:`Dataset.to_dataarray`, :py:meth:`Dataset.to_stacked_array`, :py:meth:`DataArray.to_unstacked_dataset`
4040
* - extract variables that have certain attributes
4141
- :py:meth:`Dataset.filter_by_attrs`
4242
* - extract the underlying array (e.g. NumPy or Dask arrays)

doc/user-guide/reshaping.rst

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -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
8181
includes 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``
161161
and ``unstack``, but combining multiple variables in a
162162
:py:class:`xarray.Dataset` is more complicated. If the variables in the dataset
163163
have 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,
166166
which will effectively tile the lower dimensional variable along the missing
167167
dimensions. The method :py:meth:`xarray.Dataset.to_stacked_array` allows
168168
combining variables of differing dimensions without this wasteful copying while

0 commit comments

Comments
 (0)