Skip to content

Commit cc0e74f

Browse files
committed
Merge branch 'master' into increase-visibility-of-allowed-failures
2 parents 6b83a33 + 8f67dca commit cc0e74f

28 files changed

+706
-238
lines changed

.github/ISSUE_TEMPLATE/config.yml

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
1-
blank_issues_enabled: true
1+
blank_issues_enabled: false
22
contact_links:
33
- name: Usage question
4-
url: https://stackoverflow.com/questions/tagged/python-xarray
5-
about: "Post a question on Stack Overflow using the #python-xarray
6-
tag. These are regularly reviewed by xarray's maintainers, and questions which
7-
include a reproducible example will receive a response."
4+
url: https://github.com/pydata/xarray/discussions
5+
about: |
6+
Ask questions and discuss with other community members here.
7+
If you have a question like "How do I concatenate a list of datasets?" then
8+
please include a self-contained reproducible example if possible.
9+
10+

.github/workflows/parse_logs.py

Lines changed: 45 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,53 @@
11
# type: ignore
2+
import argparse
3+
import itertools
24
import pathlib
5+
import textwrap
36

4-
files = pathlib.Path("logs").rglob("**/*-log")
5-
files = sorted(filter(lambda x: x.is_file(), files))
7+
parser = argparse.ArgumentParser()
8+
parser.add_argument("filepaths", nargs="+", type=pathlib.Path)
9+
args = parser.parse_args()
10+
11+
filepaths = sorted(p for p in args.filepaths if p.is_file())
12+
13+
14+
def extract_short_test_summary_info(lines):
15+
up_to_start_of_section = itertools.dropwhile(
16+
lambda l: "=== short test summary info ===" not in l,
17+
lines,
18+
)
19+
up_to_section_content = itertools.islice(up_to_start_of_section, 1, None)
20+
section_content = itertools.takewhile(
21+
lambda l: l.startswith("FAILED"), up_to_section_content
22+
)
23+
content = "\n".join(section_content)
24+
25+
return content
26+
27+
28+
def format_log_message(path):
29+
py_version = path.name.split("-")[1]
30+
summary = f"Python {py_version} Test Summary Info"
31+
with open(path) as f:
32+
data = extract_short_test_summary_info(line.rstrip() for line in f)
33+
message = textwrap.dedent(
34+
f"""\
35+
<details><summary>{summary}</summary>
36+
37+
```
38+
{data}
39+
```
40+
41+
</details>
42+
"""
43+
)
44+
45+
return message
646

7-
message = "\n"
847

948
print("Parsing logs ...")
10-
for file in files:
11-
with open(file) as fpt:
12-
print(f"Parsing {file.absolute()}")
13-
data = fpt.read().split("test summary info")[-1].splitlines()[1:-1]
14-
data = "\n".join(data)
15-
py_version = file.name.split("-")[1]
16-
message = f"{message}\n<details>\n<summary>\nPython {py_version} Test Summary Info\n</summary>\n\n```bash\n{data}\n```\n</details>\n"
49+
message = "\n\n".join(format_log_message(path) for path in filepaths)
1750

1851
output_file = pathlib.Path("pytest-logs.txt")
19-
with open(output_file, "w") as fpt:
20-
print(f"Writing output file to: {output_file.absolute()} ")
21-
fpt.write(message)
52+
print(f"Writing output file to: {output_file.absolute()}")
53+
output_file.write_text(message)

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

Lines changed: 24 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ jobs:
2121
fail-fast: false
2222
matrix:
2323
python-version: ["3.8"]
24+
outputs:
25+
artifacts_availability: ${{ steps.status.outputs.ARTIFACTS_AVAILABLE }}
2426
steps:
2527
- name: Cancel previous runs
2628
uses: styfle/[email protected]
@@ -30,6 +32,7 @@ jobs:
3032
- uses: conda-incubator/setup-miniconda@v2
3133
with:
3234
channels: conda-forge
35+
channel-priority: strict
3336
mamba-version: "*"
3437
activate-environment: xarray-tests
3538
auto-update-conda: false
@@ -40,11 +43,17 @@ jobs:
4043
bash ci/install-upstream-wheels.sh
4144
conda list
4245
- name: Run Tests
46+
id: status
4347
run: |
44-
python -m pytest --verbose -rf > output-${{ matrix.python-version }}-log
45-
48+
set -euo pipefail
49+
python -m pytest -rf | tee output-${{ matrix.python-version }}-log || (
50+
echo '::set-output name=ARTIFACTS_AVAILABLE::true' && false
51+
)
4652
- name: Upload artifacts
47-
if: "failure()&&(github.event_name == 'schedule')&&(github.repository == 'pydata/xarray')" # Check the exit code of previous step
53+
if: |
54+
failure()
55+
&& github.event_name == 'schedule'
56+
&& github.repository == 'pydata/xarray'
4857
uses: actions/upload-artifact@v2
4958
with:
5059
name: output-${{ matrix.python-version }}-log
@@ -54,7 +63,11 @@ jobs:
5463
report:
5564
name: report
5665
needs: upstream-dev
57-
if: "always()&&(github.event_name == 'schedule')&&(github.repository == 'pydata/xarray')"
66+
if: |
67+
always()
68+
&& github.event_name == 'schedule'
69+
&& github.repository == 'pydata/xarray'
70+
&& needs.upstream-dev.outputs.artifacts_availability == 'true'
5871
runs-on: ubuntu-latest
5972
defaults:
6073
run:
@@ -73,7 +86,8 @@ jobs:
7386
ls -R ./logs
7487
- name: Parse logs
7588
run: |
76-
python .github/workflows/parse_logs.py
89+
shopt -s globstar
90+
python .github/workflows/parse_logs.py logs/**/*-log
7791
- name: Report failures
7892
uses: actions/github-script@v3
7993
with:
@@ -84,7 +98,7 @@ jobs:
8498
const title = "⚠️ Nightly upstream-dev CI failed ⚠️"
8599
const workflow_url = `https://github.com/${process.env.GITHUB_REPOSITORY}/actions/runs/${process.env.GITHUB_RUN_ID}`
86100
const issue_body = `[Workflow Run URL](${workflow_url})\n${pytest_logs}`
87-
101+
88102
// Run GraphQL query against GitHub API to find the most recent open issue used for reporting failures
89103
const query = `query($owner:String!, $name:String!, $creator:String!, $label:String!){
90104
repository(owner: $owner, name: $name) {
@@ -107,11 +121,10 @@ jobs:
107121
creator: "github-actions[bot]"
108122
}
109123
const result = await github.graphql(query, variables)
110-
const issue_info = result.repository.issues.edges[0].node
111124
112-
// If no issue is open, create a new issue, else update the
113-
// body of the existing issue.
114-
if (typeof issue_info.number === 'undefined') {
125+
// If no issue is open, create a new issue,
126+
// else update the body of the existing issue.
127+
if (result.repository.issues.edges.length === 0) {
115128
github.issues.create({
116129
owner: variables.owner,
117130
repo: variables.name,
@@ -123,7 +136,7 @@ jobs:
123136
github.issues.update({
124137
owner: variables.owner,
125138
repo: variables.name,
126-
issue_number: issue_info.number,
139+
issue_number: result.repository.issues.edges[0].node.number,
127140
body: issue_body
128141
})
129142
}

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ repos:
1111
hooks:
1212
- id: black
1313
- repo: https://github.com/keewis/blackdoc
14-
rev: v0.3
14+
rev: v0.3.1
1515
hooks:
1616
- id: blackdoc
1717
- repo: https://gitlab.com/pycqa/flake8

ci/requirements/doc.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ dependencies:
2222
- rasterio>=1.1
2323
- seaborn
2424
- setuptools
25-
- sphinx=3.2
25+
- sphinx=3.3
2626
- sphinx_rtd_theme>=0.4
2727
- sphinx-autosummary-accessors
2828
- zarr>=2.4

ci/requirements/py38.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ dependencies:
2929
- numpy
3030
- pandas
3131
- pint
32-
- pip
32+
- pip=20.2
3333
- pseudonetcdf
3434
- pydap
3535
# - pynio: not compatible with netCDF4>1.5.3; only tested in py36-bare-minimum

doc/api-hidden.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -689,6 +689,7 @@
689689
CFTimeIndex.dayofyear
690690
CFTimeIndex.dtype
691691
CFTimeIndex.empty
692+
CFTimeIndex.freq
692693
CFTimeIndex.has_duplicates
693694
CFTimeIndex.hasnans
694695
CFTimeIndex.hour

doc/contributing.rst

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,9 @@ Bug reports must:
5151
<http://github.github.com/github-flavored-markdown/>`_::
5252

5353
```python
54-
>>> import xarray as xr
55-
>>> df = xr.Dataset(...)
54+
import xarray as xr
55+
df = xr.Dataset(...)
56+
5657
...
5758
```
5859

doc/io.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1033,6 +1033,7 @@ and then calling ``to_zarr`` with ``compute=False`` to write only metadata
10331033
.. ipython:: python
10341034
10351035
import dask.array
1036+
10361037
# The values of this dask array are entirely irrelevant; only the dtype,
10371038
# shape and chunks are used
10381039
dummies = dask.array.zeros(30, chunks=10)

doc/whats-new.rst

Lines changed: 52 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,45 @@ What's New
1515
np.random.seed(123456)
1616
1717
18-
.. _whats-new.0.16.2:
18+
.. _whats-new.{0.16.3}:
1919

20-
v0.16.2 (unreleased)
21-
--------------------
20+
v{0.16.3} (unreleased)
21+
----------------------
2222

2323
Breaking changes
2424
~~~~~~~~~~~~~~~~
2525

26+
27+
New Features
28+
~~~~~~~~~~~~
29+
30+
31+
Bug fixes
32+
~~~~~~~~~
33+
34+
- :py:func:`merge` with ``combine_attrs='override'`` makes a copy of the attrs (:issue:`4627`).
35+
36+
Documentation
37+
~~~~~~~~~~~~~
38+
39+
40+
Internal Changes
41+
~~~~~~~~~~~~~~~~
42+
43+
44+
.. _whats-new.0.16.2:
45+
46+
v0.16.2 (30 Nov 2020)
47+
---------------------
48+
49+
This release brings the ability to write to limited regions of ``zarr`` files, open zarr files with :py:func:`open_dataset` and :py:func:`open_mfdataset`, increased support for propagating ``attrs`` using the ``keep_attrs`` flag, as well as numerous bugfixes and documentation improvements.
50+
51+
Many thanks to the 31 contributors who contributed to this release:
52+
Aaron Spring, Akio Taniguchi, Aleksandar Jelenak, alexamici, Alexandre Poux, Anderson Banihirwe, Andrew Pauling, Ashwin Vishnu, aurghs, Brian Ward, Caleb, crusaderky, Dan Nowacki, darikg, David Brochart, David Huard, Deepak Cherian, Dion Häfner, Gerardo Rivera, Gerrit Holl, Illviljan, inakleinbottle, Jacob Tomlinson, James A. Bednar, jenssss, Joe Hamman, johnomotani, Joris Van den Bossche, Julia Kent, Julius Busecke, Kai Mühlbauer, keewis, Keisuke Fujii, Kyle Cranmer, Luke Volpatti, Mathias Hauser, Maximilian Roos, Michaël Defferrard, Michal Baumgartner, Nick R. Papior, Pascal Bourgault, Peter Hausamann, PGijsbers, Ray Bell, Romain Martinez, rpgoldman, Russell Manser, Sahid Velji, Samnan Rahee, Sander, Spencer Clark, Stephan Hoyer, Thomas Zilio, Tobias Kölling, Tom Augspurger, Wei Ji, Yash Saboo, Zeb Nicholls,
53+
54+
Deprecations
55+
~~~~~~~~~~~~
56+
2657
- :py:attr:`~core.accessor_dt.DatetimeAccessor.weekofyear` and :py:attr:`~core.accessor_dt.DatetimeAccessor.week`
2758
have been deprecated. Use ``DataArray.dt.isocalendar().week``
2859
instead (:pull:`4534`). By `Mathias Hauser <https://github.com/mathause>`_,
@@ -55,24 +86,27 @@ New Features
5586
By `Julius Busecke <https://github.com/jbusecke>`_.
5687
- Added the ``keep_attrs`` keyword to ``rolling_exp.mean()``; it now keeps attributes
5788
per default. By `Mathias Hauser <https://github.com/mathause>`_ (:pull:`4592`).
89+
- Added ``freq`` as property to :py:class:`CFTimeIndex` and into the
90+
``CFTimeIndex.repr``. (:issue:`2416`, :pull:`4597`)
91+
By `Aaron Spring <https://github.com/aaronspring>`_.
5892

5993
Bug fixes
6094
~~~~~~~~~
6195

62-
- Fix bug where reference times without padded years (e.g. "since 1-1-1") would lose their units when
96+
- Fix bug where reference times without padded years (e.g. ``since 1-1-1``) would lose their units when
6397
being passed by :py:func:`encode_cf_datetime` (:issue:`4422`, :pull:`4506`). Such units are ambiguous
6498
about which digit represents the years (is it YMD or DMY?). Now, if such formatting is encountered,
65-
it is assumed that the first digit is the years, they are padded appropriately (to e.g. "since 0001-1-1")
99+
it is assumed that the first digit is the years, they are padded appropriately (to e.g. ``since 0001-1-1``)
66100
and a warning that this assumption is being made is issued. Previously, without ``cftime``, such times
67101
would be silently parsed incorrectly (at least based on the CF conventions) e.g. "since 1-1-1" would
68-
be parsed (via``pandas`` and ``dateutil``) to "since 2001-1-1".
102+
be parsed (via ``pandas`` and ``dateutil``) to ``since 2001-1-1``.
69103
By `Zeb Nicholls <https://github.com/znicholls>`_.
70104
- Fix :py:meth:`DataArray.plot.step`. By `Deepak Cherian <https://github.com/dcherian>`_.
71105
- Fix bug where reading a scalar value from a NetCDF file opened with the ``h5netcdf`` backend would raise a ``ValueError`` when ``decode_cf=True`` (:issue:`4471`, :pull:`4485`).
72106
By `Gerrit Holl <https://github.com/gerritholl>`_.
73107
- Fix bug where datetime64 times are silently changed to incorrect values if they are outside the valid date range for ns precision when provided in some other units (:issue:`4427`, :pull:`4454`).
74108
By `Andrew Pauling <https://github.com/andrewpauling>`_
75-
- Fix silently overwriting the `engine` key when passing :py:func:`open_dataset` a file object
109+
- Fix silently overwriting the ``engine`` key when passing :py:func:`open_dataset` a file object
76110
to an incompatible netCDF (:issue:`4457`). Now incompatible combinations of files and engines raise
77111
an exception instead. By `Alessandro Amici <https://github.com/alexamici>`_.
78112
- The ``min_count`` argument to :py:meth:`DataArray.sum()` and :py:meth:`DataArray.prod()`
@@ -91,7 +125,9 @@ Documentation
91125
~~~~~~~~~~~~~
92126
- document the API not supported with duck arrays (:pull:`4530`).
93127
By `Justus Magin <https://github.com/keewis>`_.
94-
128+
- Mention the possibility to pass functions to :py:meth:`Dataset.where` or
129+
:py:meth:`DataArray.where` in the parameter documentation (:issue:`4223`, :pull:`4613`).
130+
By `Justus Magin <https://github.com/keewis>`_.
95131
- Update the docstring of :py:class:`DataArray` and :py:class:`Dataset`.
96132
(:pull:`4532`);
97133
By `Jimmy Westling <https://github.com/illviljan>`_.
@@ -104,6 +140,9 @@ Documentation
104140
By `Sahid Velji <https://github.com/sahidvelji>`_.
105141
- Update link to NumPy docstring standard in the :doc:`contributing` guide (:pull:`4558`).
106142
By `Sahid Velji <https://github.com/sahidvelji>`_.
143+
- Add docstrings to ``isnull`` and ``notnull``, and fix the displayed signature
144+
(:issue:`2760`, :pull:`4618`).
145+
By `Justus Magin <https://github.com/keewis>`_.
107146

108147
Internal Changes
109148
~~~~~~~~~~~~~~~~
@@ -118,7 +157,7 @@ Internal Changes
118157
<https://github.com/mathause>`_.
119158
- Removed stray spaces that stem from black removing new lines (:pull:`4504`).
120159
By `Mathias Hauser <https://github.com/mathause>`_.
121-
- Ensure tests are not skipped in the `py38-all-but-dask` test environment
160+
- Ensure tests are not skipped in the ``py38-all-but-dask`` test environment
122161
(:issue:`4509`). By `Mathias Hauser <https://github.com/mathause>`_.
123162
- Ignore select numpy warnings around missing values, where xarray handles
124163
the values appropriately, (:pull:`4536`);
@@ -128,6 +167,10 @@ Internal Changes
128167
(:issue:`4565`). By `Mathias Hauser <https://github.com/mathause>`_.
129168
- Add GitHub action for running nightly tests against upstream dependencies (:pull:`4583`).
130169
By `Anderson Banihirwe <https://github.com/andersy005>`_.
170+
- Ensure all figures are closed properly in plot tests (:pull:`4600`).
171+
By `Yash Saboo <https://github.com/yashsaboo>`_, `Nirupam K N
172+
<https://github.com/Nirupamkn>`_ and `Mathias Hauser
173+
<https://github.com/mathause>`_.
131174

132175
.. _whats-new.0.16.1:
133176

xarray/backends/api.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
combine_by_coords,
2727
)
2828
from ..core.dataarray import DataArray
29-
from ..core.dataset import Dataset, _maybe_chunk
29+
from ..core.dataset import Dataset, _get_chunk, _maybe_chunk
3030
from ..core.utils import close_on_error, is_grib_path, is_remote_uri
3131
from .common import AbstractDataStore, ArrayWriter
3232
from .locks import _get_scheduler
@@ -536,7 +536,7 @@ def maybe_decode_store(store, chunks):
536536
k: _maybe_chunk(
537537
k,
538538
v,
539-
store.get_chunk(k, v, chunks),
539+
_get_chunk(k, v, chunks),
540540
overwrite_encoded_chunks=overwrite_encoded_chunks,
541541
)
542542
for k, v in ds.variables.items()

0 commit comments

Comments
 (0)