Skip to content
forked from pydata/xarray

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into fix/groupby-nan
Browse files Browse the repository at this point in the history
* upstream/master:
  Another groupby.reduce bugfix. (pydata#3403)
  add icomoon license (pydata#3448)
  change ALL_DIMS to equal ellipsis (pydata#3418)
  Escaping dtypes (pydata#3444)
  Html repr (pydata#3425)
  • Loading branch information
dcherian committed Oct 28, 2019
2 parents 207e168 + fb0cf7b commit c396381
Show file tree
Hide file tree
Showing 23 changed files with 1,313 additions and 79 deletions.
1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ prune doc/generated
global-exclude .DS_Store
include versioneer.py
include xarray/_version.py
recursive-include xarray/static *
3 changes: 3 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -138,4 +138,7 @@ under a "3-clause BSD" license:
xarray also bundles portions of CPython, which is available under the "Python
Software Foundation License" in xarray/core/pycompat.py.

xarray uses icons from the icomoon package (free version), which is
available under the "CC BY 4.0" license.

The full text of these licenses are included in the licenses directory.
2 changes: 1 addition & 1 deletion doc/examples/multidimensional-coords.rst
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ function to specify the output coordinates of the group.
lat_center = np.arange(1, 90, 2)
# group according to those bins and take the mean
Tair_lat_mean = (ds.Tair.groupby_bins('xc', lat_bins, labels=lat_center)
.mean(xr.ALL_DIMS))
.mean(...))
# plot the result
@savefig xarray_multidimensional_coords_14_1.png width=5in
Tair_lat_mean.plot();
Expand Down
16 changes: 11 additions & 5 deletions doc/groupby.rst
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,13 @@ dimensions *other than* the provided one:

.. ipython:: python
ds.groupby('x').std(xr.ALL_DIMS)
ds.groupby('x').std(...)
.. note::

We use an ellipsis (`...`) here to indicate we want to reduce over all
other dimensions


First and last
~~~~~~~~~~~~~~
Expand All @@ -127,7 +133,7 @@ values for group along the grouped dimension:

.. ipython:: python
ds.groupby('letters').first(xr.ALL_DIMS)
ds.groupby('letters').first(...)
By default, they skip missing values (control this with ``skipna``).

Expand All @@ -142,7 +148,7 @@ coordinates. For example:

.. ipython:: python
alt = arr.groupby('letters').mean(xr.ALL_DIMS)
alt = arr.groupby('letters').mean(...)
alt
ds.groupby('letters') - alt
Expand Down Expand Up @@ -195,7 +201,7 @@ __ http://cfconventions.org/cf-conventions/v1.6.0/cf-conventions.html#_two_dimen
'lat': (['ny','nx'], [[10,10],[20,20]] ),},
dims=['ny','nx'])
da
da.groupby('lon').sum(xr.ALL_DIMS)
da.groupby('lon').sum(...)
da.groupby('lon').apply(lambda x: x - x.mean(), shortcut=False)
Because multidimensional groups have the ability to generate a very large
Expand All @@ -213,4 +219,4 @@ applying your function, and then unstacking the result:
.. ipython:: python
stacked = da.stack(gridcell=['ny', 'nx'])
stacked.groupby('gridcell').sum(xr.ALL_DIMS).unstack('gridcell')
stacked.groupby('gridcell').sum(...).unstack('gridcell')
15 changes: 15 additions & 0 deletions doc/whats-new.rst
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@ Breaking changes

New Features
~~~~~~~~~~~~
- Changed `xr.ALL_DIMS` to equal python's `Ellipsis` (`...`), and changed internal usages to use
`...` directly. As before, you can use this to instruct a `groupby` operation
to reduce over all dimensions. While we have no plans to remove `xr.ALL_DIMS`, we suggest
using `...`.
By `Maximilian Roos <https://github.com/max-sixty>`_
- Added integration tests against `pint <https://pint.readthedocs.io/>`_.
(:pull:`3238`) by `Justus Magin <https://github.com/keewis>`_.

Expand All @@ -36,6 +41,12 @@ New Features
``pip install git+https://github.com/andrewgsavage/pint.git@refs/pull/6/head)``.
Even with it, interaction with non-numpy array libraries, e.g. dask or sparse, is broken.

- Added new :py:meth:`Dataset._repr_html_` and :py:meth:`DataArray._repr_html_` to improve
representation of objects in jupyter. By default this feature is turned off
for now. Enable it with :py:meth:`xarray.set_options(display_style="html")`.
(:pull:`3425`) by `Benoit Bovy <https://github.com/benbovy>`_ and
`Julia Signell <https://github.com/jsignell>`_.

Bug fixes
~~~~~~~~~
- Fix regression introduced in v0.14.0 that would cause a crash if dask is installed
Expand All @@ -45,6 +56,10 @@ Bug fixes
- Sync with cftime by removing `dayofwk=-1` for cftime>=1.0.4.
By `Anderson Banihirwe <https://github.com/andersy005>`_.

- Fix :py:meth:`xarray.core.groupby.DataArrayGroupBy.reduce` and
:py:meth:`xarray.core.groupby.DatasetGroupBy.reduce` when reducing over multiple dimensions.
(:issue:`3402`). By `Deepak Cherian <https://github.com/dcherian/>`_


Documentation
~~~~~~~~~~~~~
Expand Down
Loading

0 comments on commit c396381

Please sign in to comment.