Skip to content

Commit

Permalink
small fixes for the docstrings of swap_dims and integrate (#4867)
Browse files Browse the repository at this point in the history
* update the docstrings of integrate

* also mention the removal version in whats-new.rst

* update the docstrings of swap_dims [skip-ci]

* add the PR [skip-ci]
  • Loading branch information
keewis authored Feb 7, 2021
1 parent 46591d2 commit f98d6f0
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 10 deletions.
4 changes: 3 additions & 1 deletion doc/whats-new.rst
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,9 @@ Deprecations

- ``dim`` argument to :py:meth:`DataArray.integrate` is being deprecated in
favour of a ``coord`` argument, for consistency with :py:meth:`Dataset.integrate`.
For now using ``dim`` issues a ``FutureWarning``. By `Tom Nicholas <https://github.com/TomNicholas>`_.
For now using ``dim`` issues a ``FutureWarning``. It will be removed in
version 0.19.0 (:pull:`3993`).
By `Tom Nicholas <https://github.com/TomNicholas>`_.


New Features
Expand Down
11 changes: 6 additions & 5 deletions xarray/core/dataarray.py
Original file line number Diff line number Diff line change
Expand Up @@ -1707,7 +1707,7 @@ def swap_dims(
dims_dict : dict-like
Dictionary whose keys are current dimension names and whose values
are new names.
**dim_kwargs : {dim: , ...}, optional
**dims_kwargs : {existing_dim: new_dim, ...}, optional
The keyword arguments form of ``dims_dict``.
One of dims_dict or dims_kwargs must be provided.
Expand Down Expand Up @@ -3479,21 +3479,22 @@ def integrate(
Parameters
----------
coord: hashable, or a sequence of hashable
coord : hashable, or sequence of hashable
Coordinate(s) used for the integration.
dim : hashable, or sequence of hashable
Coordinate(s) used for the integration.
datetime_unit: {'Y', 'M', 'W', 'D', 'h', 'm', 's', 'ms', 'us', 'ns', \
datetime_unit : {'Y', 'M', 'W', 'D', 'h', 'm', 's', 'ms', 'us', 'ns', \
'ps', 'fs', 'as'}, optional
Specify the unit if a datetime coordinate is used.
Returns
-------
integrated: DataArray
integrated : DataArray
See also
--------
Dataset.integrate
numpy.trapz: corresponding numpy function
numpy.trapz : corresponding numpy function
Examples
--------
Expand Down
8 changes: 4 additions & 4 deletions xarray/core/dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -3160,7 +3160,7 @@ def swap_dims(
dims_dict : dict-like
Dictionary whose keys are current dimension names and whose values
are new names.
**dim_kwargs : {existing_dim: new_dim, ...}, optional
**dims_kwargs : {existing_dim: new_dim, ...}, optional
The keyword arguments form of ``dims_dict``.
One of dims_dict or dims_kwargs must be provided.
Expand Down Expand Up @@ -5956,9 +5956,9 @@ def integrate(
Parameters
----------
coord: hashable, or a sequence of hashable
coord : hashable, or sequence of hashable
Coordinate(s) used for the integration.
datetime_unit: {'Y', 'M', 'W', 'D', 'h', 'm', 's', 'ms', 'us', 'ns', \
datetime_unit : {'Y', 'M', 'W', 'D', 'h', 'm', 's', 'ms', 'us', 'ns', \
'ps', 'fs', 'as'}, optional
Specify the unit if datetime coordinate is used.
Expand All @@ -5969,7 +5969,7 @@ def integrate(
See also
--------
DataArray.integrate
numpy.trapz: corresponding numpy function
numpy.trapz : corresponding numpy function
Examples
--------
Expand Down

0 comments on commit f98d6f0

Please sign in to comment.