Skip to content
forked from pydata/xarray

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into dask-tokenize
Browse files Browse the repository at this point in the history
* upstream/master:
  upgrade black verison to 19.10b0 (pydata#3456)
  Remove outdated code related to compatibility with netcdftime (pydata#3450)
  Remove deprecated behavior from dataset.drop docstring (pydata#3451)
  jupyterlab dark theme (pydata#3443)
  Drop groups associated with nans in group variable (pydata#3406)
  Allow ellipsis (...) in transpose (pydata#3421)
  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 29, 2019
2 parents 507b1f6 + 278d2e6 commit bc39877
Show file tree
Hide file tree
Showing 44 changed files with 1,646 additions and 339 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')
4 changes: 3 additions & 1 deletion doc/reshaping.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,14 @@ Reordering dimensions
---------------------

To reorder dimensions on a :py:class:`~xarray.DataArray` or across all variables
on a :py:class:`~xarray.Dataset`, use :py:meth:`~xarray.DataArray.transpose`:
on a :py:class:`~xarray.Dataset`, use :py:meth:`~xarray.DataArray.transpose`. An
ellipsis (`...`) can be use to represent all other dimensions:

.. ipython:: python
ds = xr.Dataset({'foo': (('x', 'y', 'z'), [[[42]]]), 'bar': (('y', 'z'), [[24]])})
ds.transpose('y', 'z', 'x')
ds.transpose(..., 'x') # equivalent
ds.transpose() # reverses all dimensions
Expand and squeeze dimensions
Expand Down
29 changes: 26 additions & 3 deletions doc/whats-new.rst
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,23 @@ Breaking changes
~~~~~~~~~~~~~~~~

- Minimum cftime version is now 1.0.3. By `Deepak Cherian <https://github.com/dcherian>`_.
- All leftover support for dates from non-standard calendars through netcdftime, the
module included in versions of netCDF4 prior to 1.4 that eventually became the
cftime package, has been removed in favor of relying solely on the standalone
cftime package (:pull:`3450`). By `Spencer Clark
<https://github.com/spencerkclark>`_.

New Features
~~~~~~~~~~~~
- :py:meth:`Dataset.transpose` and :py:meth:`DataArray.transpose` now support an ellipsis (`...`)
to represent all 'other' dimensions. For example, to move one dimension to the front,
use `.transpose('x', ...)`. (:pull:`3421`)
By `Maximilian Roos <https://github.com/max-sixty>`_
- 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,14 +50,23 @@ 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
but cloudpickle isn't (:issue:`3401`) by `Rhys Doyle <https://github.com/rdoyle45>`_

- Sync with cftime by removing `dayofwk=-1` for cftime>=1.0.4.
- Fix grouping over variables with NaNs. (:issue:`2383`, :pull:`3406`).
By `Deepak Cherian <https://github.com/dcherian>`_.
- 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 bc39877

Please sign in to comment.