Skip to content

Commit b3a67e3

Browse files
committed
Merge branch 'main' into CI-refresh
2 parents a0dcc2e + 4fd81b5 commit b3a67e3

File tree

94 files changed

+4224
-2517
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

94 files changed

+4224
-2517
lines changed

.binder/environment.yml

Lines changed: 2 additions & 1 deletion
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.8
5+
- python=3.9
66
- boto3
77
- bottleneck
88
- cartopy
@@ -26,6 +26,7 @@ dependencies:
2626
- pandas
2727
- pint
2828
- pip
29+
- pooch
2930
- pydap
3031
- pynio
3132
- rasterio

.git-blame-ignore-revs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# black PR 3142
2+
d089df385e737f71067309ff7abae15994d581ec
3+
4+
# isort PR 1924
5+
0e73e240107caee3ffd1a1149f0150c390d43251

.github/workflows/cancel-duplicate-runs.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,6 @@ jobs:
1010
runs-on: ubuntu-latest
1111
if: github.repository == 'pydata/xarray'
1212
steps:
13-
- uses: styfle/cancel-workflow-action@0.9.0
13+
- uses: styfle/cancel-workflow-action@0.9.1
1414
with:
1515
workflow_id: ${{ github.event.workflow.id }}

.github/workflows/ci-additional.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ jobs:
102102
$PYTEST_EXTRA_FLAGS
103103
104104
- name: Upload code coverage to Codecov
105-
uses: codecov/codecov-action@v1
105+
uses: codecov/codecov-action@v2.0.2
106106
with:
107107
file: ./coverage.xml
108108
flags: unittests,${{ matrix.env }}

.github/workflows/ci.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ jobs:
100100
path: pytest.xml
101101

102102
- name: Upload code coverage to Codecov
103-
uses: codecov/codecov-action@v1
103+
uses: codecov/codecov-action@v2.0.2
104104
with:
105105
file: ./coverage.xml
106106
flags: unittests

.github/workflows/upstream-dev-ci.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ jobs:
122122
shopt -s globstar
123123
python .github/workflows/parse_logs.py logs/**/*-log
124124
- name: Report failures
125-
uses: actions/github-script@v4.0.2
125+
uses: actions/github-script@v4.1
126126
with:
127127
github-token: ${{ secrets.GITHUB_TOKEN }}
128128
script: |

.pre-commit-config.yaml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,16 @@ repos:
88
- id: check-yaml
99
# isort should run before black as black sometimes tweaks the isort output
1010
- repo: https://github.com/PyCQA/isort
11-
rev: 5.9.2
11+
rev: 5.9.3
1212
hooks:
1313
- id: isort
1414
# https://github.com/python/black#version-control-integration
1515
- repo: https://github.com/psf/black
16-
rev: 21.6b0
16+
rev: 21.7b0
1717
hooks:
1818
- id: black
1919
- repo: https://github.com/keewis/blackdoc
20-
rev: v0.3.3
20+
rev: v0.3.4
2121
hooks:
2222
- id: blackdoc
2323
- repo: https://gitlab.com/pycqa/flake8
@@ -43,6 +43,7 @@ repos:
4343
types-pytz,
4444
# Dependencies that are typed
4545
numpy,
46+
typing-extensions==3.10.0.0,
4647
]
4748
# run this occasionally, ref discussion https://github.com/pydata/xarray/pull/3194
4849
# - repo: https://github.com/asottile/pyupgrade

asv_bench/benchmarks/repr.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,30 @@
1+
import numpy as np
12
import pandas as pd
23

34
import xarray as xr
45

56

7+
class Repr:
8+
def setup(self):
9+
a = np.arange(0, 100)
10+
data_vars = dict()
11+
for i in a:
12+
data_vars[f"long_variable_name_{i}"] = xr.DataArray(
13+
name=f"long_variable_name_{i}",
14+
data=np.arange(0, 20),
15+
dims=[f"long_coord_name_{i}_x"],
16+
coords={f"long_coord_name_{i}_x": np.arange(0, 20) * 2},
17+
)
18+
self.ds = xr.Dataset(data_vars)
19+
self.ds.attrs = {f"attr_{k}": 2 for k in a}
20+
21+
def time_repr(self):
22+
repr(self.ds)
23+
24+
def time_repr_html(self):
25+
self.ds._repr_html_()
26+
27+
628
class ReprMultiIndex:
729
def setup(self):
830
index = pd.MultiIndex.from_product(

ci/requirements/environment-windows.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ dependencies:
1010
- cftime
1111
- dask
1212
- distributed
13+
- fsspec!=2021.7.0
1314
- h5netcdf
1415
- h5py
1516
- hdf5

ci/requirements/environment.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ dependencies:
1212
- cftime
1313
- dask
1414
- distributed
15+
- fsspec!=2021.7.0
1516
- h5netcdf
1617
- h5py
1718
- hdf5

ci/requirements/py37-min-all-deps.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ dependencies:
1515
- cfgrib=0.9
1616
- cftime=1.1
1717
- coveralls
18-
- dask=2.15
19-
- distributed=2.15
18+
- dask=2.24
19+
- distributed=2.24
2020
- h5netcdf=0.8
2121
- h5py=2.10
2222
- hdf5=1.10

doc/api-hidden.rst

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@
5454
core.rolling.DatasetCoarsen.var
5555
core.rolling.DatasetCoarsen.boundary
5656
core.rolling.DatasetCoarsen.coord_func
57-
core.rolling.DatasetCoarsen.keep_attrs
5857
core.rolling.DatasetCoarsen.obj
5958
core.rolling.DatasetCoarsen.side
6059
core.rolling.DatasetCoarsen.trim_excess
@@ -120,7 +119,6 @@
120119
core.rolling.DatasetRolling.var
121120
core.rolling.DatasetRolling.center
122121
core.rolling.DatasetRolling.dim
123-
core.rolling.DatasetRolling.keep_attrs
124122
core.rolling.DatasetRolling.min_periods
125123
core.rolling.DatasetRolling.obj
126124
core.rolling.DatasetRolling.rollings
@@ -199,7 +197,6 @@
199197
core.rolling.DataArrayCoarsen.var
200198
core.rolling.DataArrayCoarsen.boundary
201199
core.rolling.DataArrayCoarsen.coord_func
202-
core.rolling.DataArrayCoarsen.keep_attrs
203200
core.rolling.DataArrayCoarsen.obj
204201
core.rolling.DataArrayCoarsen.side
205202
core.rolling.DataArrayCoarsen.trim_excess
@@ -263,7 +260,6 @@
263260
core.rolling.DataArrayRolling.var
264261
core.rolling.DataArrayRolling.center
265262
core.rolling.DataArrayRolling.dim
266-
core.rolling.DataArrayRolling.keep_attrs
267263
core.rolling.DataArrayRolling.min_periods
268264
core.rolling.DataArrayRolling.obj
269265
core.rolling.DataArrayRolling.window

doc/api.rst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ Top-level functions
2424
combine_by_coords
2525
combine_nested
2626
where
27-
set_options
2827
infer_freq
2928
full_like
3029
zeros_like
@@ -686,6 +685,7 @@ Dataset methods
686685
open_zarr
687686
Dataset.to_netcdf
688687
Dataset.to_pandas
688+
Dataset.as_numpy
689689
Dataset.to_zarr
690690
save_mfdataset
691691
Dataset.to_array
@@ -716,6 +716,8 @@ DataArray methods
716716
DataArray.to_pandas
717717
DataArray.to_series
718718
DataArray.to_dataframe
719+
DataArray.to_numpy
720+
DataArray.as_numpy
719721
DataArray.to_index
720722
DataArray.to_masked_array
721723
DataArray.to_cdms2

doc/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@
313313
"pandas": ("https://pandas.pydata.org/pandas-docs/stable", None),
314314
"iris": ("https://scitools-iris.readthedocs.io/en/latest", None),
315315
"numpy": ("https://numpy.org/doc/stable", None),
316-
"scipy": ("https://docs.scipy.org/doc/scipy/reference", None),
316+
"scipy": ("https://docs.scipy.org/doc/scipy", None),
317317
"numba": ("https://numba.pydata.org/numba-doc/latest", None),
318318
"matplotlib": ("https://matplotlib.org/stable/", None),
319319
"dask": ("https://docs.dask.org/en/latest", None),

doc/contributing.rst

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -628,13 +628,7 @@ Or with one of the following constructs::
628628
pytest xarray/tests/[test-module].py::[TestClass]::[test_method]
629629
630630
Using `pytest-xdist <https://pypi.python.org/pypi/pytest-xdist>`_, one can
631-
speed up local testing on multicore machines. To use this feature, you will
632-
need to install `pytest-xdist` via::
633-
634-
pip install pytest-xdist
635-
636-
637-
Then, run pytest with the optional -n argument::
631+
speed up local testing on multicore machines, by running pytest with the optional -n argument::
638632
639633
pytest xarray -n 4
640634

doc/ecosystem.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ Extend xarray capabilities
6868
- `hypothesis-gufunc <https://hypothesis-gufunc.readthedocs.io/en/latest/>`_: Extension to hypothesis. Makes it easy to write unit tests with xarray objects as input.
6969
- `nxarray <https://github.com/nxarray/nxarray>`_: NeXus input/output capability for xarray.
7070
- `xarray-compare <https://github.com/astropenguin/xarray-compare>`_: xarray extension for data comparison.
71-
- `xarray-custom <https://github.com/astropenguin/xarray-custom>`_: Data classes for custom xarray creation.
71+
- `xarray-dataclasses <https://github.com/astropenguin/xarray-dataclasses>`_: xarray extension for typed DataArray and Dataset creation.
7272
- `xarray_extras <https://github.com/crusaderky/xarray_extras>`_: Advanced algorithms for xarray objects (e.g. integrations/interpolations).
7373
- `xpublish <https://xpublish.readthedocs.io/>`_: Publish Xarray Datasets via a Zarr compatible REST API.
7474
- `xrft <https://github.com/rabernat/xrft>`_: Fourier transforms for xarray data.

doc/getting-started-guide/installing.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ Required dependencies
88

99
- Python (3.7 or later)
1010
- setuptools (40.4 or later)
11-
- typing-extensions (3.10 or later)
1211
- `numpy <http://www.numpy.org/>`__ (1.17 or later)
1312
- `pandas <http://pandas.pydata.org/>`__ (1.0 or later)
1413

doc/whats-new.rst

Lines changed: 90 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,93 @@ What's New
1414
1515
np.random.seed(123456)
1616
17-
.. _whats-new.0.18.3:
1817
19-
v0.18.3 (unreleased)
18+
.. _whats-new.0.19.1:
19+
20+
v0.19.1 (unreleased)
2021
---------------------
2122

2223
New Features
2324
~~~~~~~~~~~~
25+
- Xarray now does a better job rendering variable names that are long LaTeX sequences when plotting (:issue:`5681`, :pull:`5682`).
26+
By `Tomas Chor <https://github.com/tomchor>`_.
27+
- Add a option to disable the use of ``bottleneck`` (:pull:`5560`)
28+
By `Justus Magin <https://github.com/keewis>`_.
29+
- Added ``**kwargs`` argument to :py:meth:`open_rasterio` to access overviews (:issue:`3269`).
30+
By `Pushkar Kopparla <https://github.com/pkopparla>`_.
31+
- Added ``storage_options`` argument to :py:meth:`to_zarr` (:issue:`5601`).
32+
By `Ray Bell <https://github.com/raybellwaves>`_, `Zachary Blackwood <https://github.com/blackary>`_ and
33+
`Nathan Lis <https://github.com/wxman22>`_.
34+
35+
36+
Breaking changes
37+
~~~~~~~~~~~~~~~~
38+
- The minimum versions of some dependencies were changed:
39+
40+
============ ====== ====
41+
Package Old New
42+
============ ====== ====
43+
dask 2.15 2.24
44+
distributed 2.15 2.24
45+
============ ====== ====
46+
47+
- The ``__repr__`` of a :py:class:`xarray.Dataset`'s ``coords`` and ``data_vars``
48+
ignore ``xarray.set_option(display_max_rows=...)`` and show the full output
49+
when called directly as, e.g., ``ds.data_vars`` or ``print(ds.data_vars)``
50+
(:issue:`5545`, :pull:`5580`).
51+
By `Stefan Bender <https://github.com/st-bender>`_.
52+
53+
Deprecations
54+
~~~~~~~~~~~~
55+
56+
57+
Bug fixes
58+
~~~~~~~~~
59+
60+
61+
Documentation
62+
~~~~~~~~~~~~~
63+
64+
65+
Internal Changes
66+
~~~~~~~~~~~~~~~~
67+
68+
- Explicit indexes refactor: avoid ``len(index)`` in ``map_blocks`` (:pull:`5670`).
69+
By `Deepak Cherian <https://github.com/dcherian>`_.
70+
- Explicit indexes refactor: decouple ``xarray.Index``` from ``xarray.Variable`` (:pull:`5636`).
71+
By `Benoit Bovy <https://github.com/benbovy>`_.
72+
- Fix ``Mapping`` argument typing to allow mypy to pass on ``str`` keys (:pull:`5690`).
73+
By `Maximilian Roos <https://github.com/max-sixty>`_.
74+
- Annotate many of our tests, and fix some of the resulting typing errors. This will
75+
also mean our typing annotations are tested as part of CI. (:pull:`5728`).
76+
By `Maximilian Roos <https://github.com/max-sixty>`_.
77+
- Improve the performance of reprs for large datasets or dataarrays. (:pull:`5661`)
78+
By `Jimmy Westling <https://github.com/illviljan>`_.
79+
- Use isort's `float_to_top` config. (:pull:`5695`).
80+
By `Maximilian Roos <https://github.com/max-sixty>`_.
81+
82+
.. _whats-new.0.19.0:
83+
84+
v0.19.0 (23 July 2021)
85+
----------------------
86+
87+
This release brings improvements to plotting of categorical data, the ability to specify how attributes
88+
are combined in xarray operations, a new high-level :py:func:`unify_chunks` function, as well as various
89+
deprecations, bug fixes, and minor improvements.
90+
91+
92+
Many thanks to the 29 contributors to this release!:
93+
94+
Andrew Williams, Augustus, Aureliana Barghini, Benoit Bovy, crusaderky, Deepak Cherian, ellesmith88,
95+
Elliott Sales de Andrade, Giacomo Caria, github-actions[bot], Illviljan, Joeperdefloep, joooeey, Julia Kent,
96+
Julius Busecke, keewis, Mathias Hauser, Matthias Göbel, Mattia Almansi, Maximilian Roos, Peter Andreas Entschev,
97+
Ray Bell, Sander, Santiago Soler, Sebastian, Spencer Clark, Stephan Hoyer, Thomas Hirtz, Thomas Nicholas.
98+
99+
New Features
100+
~~~~~~~~~~~~
101+
- Allow passing argument ``missing_dims`` to :py:meth:`Variable.transpose` and :py:meth:`Dataset.transpose`
102+
(:issue:`5550`, :pull:`5586`)
103+
By `Giacomo Caria <https://github.com/gcaria>`_.
24104
- Allow passing a dictionary as coords to a :py:class:`DataArray` (:issue:`5527`,
25105
reverts :pull:`1539`, which had deprecated this due to python's inconsistent ordering in earlier versions).
26106
By `Sander van Rijn <https://github.com/sjvrijn>`_.
@@ -53,6 +133,10 @@ New Features
53133
- Allow removal of the coordinate attribute ``coordinates`` on variables by setting ``.attrs['coordinates']= None``
54134
(:issue:`5510`).
55135
By `Elle Smith <https://github.com/ellesmith88>`_.
136+
- Added :py:meth:`DataArray.to_numpy`, :py:meth:`DataArray.as_numpy`, and :py:meth:`Dataset.as_numpy`. (:pull:`5568`).
137+
By `Tom Nicholas <https://github.com/TomNicholas>`_.
138+
- Units in plot labels are now automatically inferred from wrapped :py:meth:`pint.Quantity` arrays. (:pull:`5561`).
139+
By `Tom Nicholas <https://github.com/TomNicholas>`_.
56140

57141
Breaking changes
58142
~~~~~~~~~~~~~~~~
@@ -70,6 +154,10 @@ Breaking changes
70154
Deprecations
71155
~~~~~~~~~~~~
72156

157+
- Removed the deprecated ``dim`` kwarg to :py:func:`DataArray.integrate` (:pull:`5630`)
158+
- Removed the deprecated ``keep_attrs`` kwarg to :py:func:`DataArray.rolling` (:pull:`5630`)
159+
- Removed the deprecated ``keep_attrs`` kwarg to :py:func:`DataArray.coarsen` (:pull:`5630`)
160+
- Completed deprecation of passing an ``xarray.DataArray`` to :py:func:`Variable` - will now raise a ``TypeError`` (:pull:`5630`)
73161

74162
Bug fixes
75163
~~~~~~~~~
@@ -94,10 +182,6 @@ Bug fixes
94182
By `Augustus Ijams <https://github.com/aijams>`_.
95183

96184

97-
Documentation
98-
~~~~~~~~~~~~~
99-
100-
101185
Internal Changes
102186
~~~~~~~~~~~~~~~~
103187
- Run CI on the first & last python versions supported only; currently 3.7 & 3.9.
@@ -106,7 +190,6 @@ Internal Changes
106190
- Publish test results & timings on each PR.
107191
(:pull:`5537`)
108192
By `Maximilian Roos <https://github.com/max-sixty>`_.
109-
110193
- Explicit indexes refactor: add a ``xarray.Index.query()`` method in which
111194
one may eventually provide a custom implementation of label-based data
112195
selection (not ready yet for public use). Also refactor the internal,
@@ -151,13 +234,6 @@ New Features
151234
- Raise more informative error when decoding time variables with invalid reference dates.
152235
(:issue:`5199`, :pull:`5288`). By `Giacomo Caria <https://github.com/gcaria>`_.
153236

154-
Breaking changes
155-
~~~~~~~~~~~~~~~~
156-
157-
158-
Deprecations
159-
~~~~~~~~~~~~
160-
161237

162238
Bug fixes
163239
~~~~~~~~~

0 commit comments

Comments
 (0)