Skip to content

Commit f03b675

Browse files
committed
Merge branch 'main' into pr/5950
2 parents 411d75d + 7a201de commit f03b675

20 files changed

+332
-163
lines changed

.github/workflows/ci-pre-commit-autoupdate.yaml

Lines changed: 0 additions & 44 deletions
This file was deleted.

.github/workflows/ci.yaml

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -108,19 +108,12 @@ jobs:
108108
name: codecov-umbrella
109109
fail_ci_if_error: false
110110

111-
publish-test-results:
112-
needs: test
111+
event_file:
112+
name: "Event File"
113113
runs-on: ubuntu-latest
114-
# the build-and-test job might be skipped, we don't need to run this job then
115-
if: success() || failure()
116-
117114
steps:
118-
- name: Download Artifacts
119-
uses: actions/download-artifact@v2
120-
with:
121-
path: test-results
122-
123-
- name: Publish Unit Test Results
124-
uses: EnricoMi/publish-unit-test-result-action@v1
115+
- name: Upload
116+
uses: actions/upload-artifact@v2
125117
with:
126-
files: test-results/**/*.xml
118+
name: Event File
119+
path: ${{ github.event_path }}
Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copied from https://github.com/EnricoMi/publish-unit-test-result-action/blob/v1.18/README.md#support-fork-repositories-and-dependabot-branches
1+
# Copied from https://github.com/EnricoMi/publish-unit-test-result-action/blob/v1.23/README.md#support-fork-repositories-and-dependabot-branches
22

33
name: Publish test results
44

@@ -12,11 +12,7 @@ jobs:
1212
publish-test-results:
1313
name: Publish test results
1414
runs-on: ubuntu-latest
15-
if: >
16-
github.event.workflow_run.conclusion != 'skipped' && (
17-
github.event.sender.login == 'dependabot[bot]' ||
18-
github.event.workflow_run.head_repository.full_name != github.repository
19-
)
15+
if: github.event.workflow_run.conclusion != 'skipped'
2016

2117
steps:
2218
- name: Download and extract artifacts
@@ -26,13 +22,10 @@ jobs:
2622
mkdir artifacts && cd artifacts
2723
2824
artifacts_url=${{ github.event.workflow_run.artifacts_url }}
29-
artifacts=$(gh api $artifacts_url -q '.artifacts[] | {name: .name, url: .archive_download_url}')
3025
31-
IFS=$'\n'
32-
for artifact in $artifacts
26+
gh api "$artifacts_url" -q '.artifacts[] | [.name, .archive_download_url] | @tsv' | while read artifact
3327
do
34-
name=$(jq -r .name <<<$artifact)
35-
url=$(jq -r .url <<<$artifact)
28+
IFS=$'\t' read name url <<< "$artifact"
3629
gh api $url > "$name.zip"
3730
unzip -d "$name" "$name.zip"
3831
done
@@ -41,4 +34,7 @@ jobs:
4134
uses: EnricoMi/publish-unit-test-result-action@v1
4235
with:
4336
commit: ${{ github.event.workflow_run.head_sha }}
37+
event_file: artifacts/Event File/event.json
38+
event_name: ${{ github.event.workflow_run.event }}
4439
files: "artifacts/**/*.xml"
40+
comment_mode: off

.pre-commit-config.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@ 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.3
11+
rev: 5.10.1
1212
hooks:
1313
- id: isort
1414
# https://github.com/python/black#version-control-integration
1515
- repo: https://github.com/psf/black
16-
rev: 21.9b0
16+
rev: 21.10b0
1717
hooks:
1818
- id: black
1919
- id: black-jupyter
@@ -22,8 +22,8 @@ repos:
2222
hooks:
2323
- id: blackdoc
2424
exclude: "generate_reductions.py"
25-
- repo: https://gitlab.com/pycqa/flake8
26-
rev: 3.9.2
25+
- repo: https://github.com/PyCQA/flake8
26+
rev: 4.0.1
2727
hooks:
2828
- id: flake8
2929
# - repo: https://github.com/Carreau/velin

CITATION.cff

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
cff-version: 1.2.0
2+
message: "If you use this software, please cite it as below."
3+
authors:
4+
- family-names: "Hoyer"
5+
given-names: "Stephan"
6+
orcid: "https://orcid.org/0000-0002-5207-0380"
7+
- family-names: "Roos"
8+
given-names: "Maximilian"
9+
- family-names: "Joseph"
10+
given-names: "Hamman"
11+
orcid: "https://orcid.org/0000-0001-7479-8439"
12+
- family-names: "Magin"
13+
given-names: "Justus"
14+
- family-names: "Cherian"
15+
given-names: "Deepak"
16+
orcid: "https://orcid.org/0000-0002-6861-8734"
17+
- family-names: "Fitzgerald"
18+
given-names: "Clark"
19+
orcid: "https://orcid.org/0000-0003-3446-6389"
20+
- family-names: "Hauser"
21+
given-names: "Mathias"
22+
orcid: "https://orcid.org/0000-0002-0057-4878"
23+
- family-names: "Fujii"
24+
given-names: "Keisuke"
25+
orcid: "https://orcid.org/0000-0003-0390-9984"
26+
- family-names: "Maussion"
27+
given-names: "Fabien"
28+
orcid: "https://orcid.org/0000-0002-3211-506X"
29+
- family-names: "Imperiale"
30+
given-names: "Guido"
31+
- family-names: "Clark"
32+
given-names: "Spencer"
33+
orcid: "https://orcid.org/0000-0001-5595-7895"
34+
- family-names: "Kleeman"
35+
given-names: "Alex"
36+
- family-names: "Nicholas"
37+
given-names: "Thomas"
38+
orcid: "https://orcid.org/0000-0002-2176-0530"
39+
- family-names: "Kluyver"
40+
given-names: "Thomas"
41+
orcid: "https://orcid.org/0000-0003-4020-6364"
42+
- family-names: "Westling"
43+
given-names: "Jimmy"
44+
- family-names: "Munroe"
45+
given-names: "James"
46+
orcid: "https://orcid.org/0000-0001-9098-6309"
47+
- family-names: "Amici"
48+
given-names: "Alessandro"
49+
orcid: "https://orcid.org/0000-0002-1778-4505"
50+
- family-names: "Barghini"
51+
given-names: "Aureliana"
52+
- family-names: "Banihirwe"
53+
given-names: "Anderson"
54+
orcid: "https://orcid.org/0000-0001-6583-571X"
55+
- family-names: "Bell"
56+
given-names: "Ray"
57+
orcid: "https://orcid.org/0000-0003-2623-0587"
58+
- family-names: "Hatfield-Dodds"
59+
given-names: "Zac"
60+
orcid: "https://orcid.org/0000-0002-8646-8362"
61+
- family-names: "Abernathey"
62+
given-names: "Ryan"
63+
orcid: "https://orcid.org/0000-0001-5999-4917"
64+
- family-names: "Bovy"
65+
given-names: "Benoît"
66+
- family-names: "Omotani"
67+
given-names: "John"
68+
orcid: "https://orcid.org/0000-0002-3156-8227"
69+
- family-names: "Mühlbauer"
70+
given-names: "Kai"
71+
orcid: "https://orcid.org/0000-0001-6599-1034"
72+
- family-names: "Roszko"
73+
given-names: "Maximilian K."
74+
orcid: "https://orcid.org/0000-0001-9424-2526"
75+
- family-names: "Wolfram"
76+
given-names: "Phillip J."
77+
orcid: "https://orcid.org/0000-0001-5971-4241"
78+
title: "xarray"
79+
doi: 10.5281/zenodo.598201
80+
url: "https://github.com/pydata/xarray"
81+
preferred-citation:
82+
type: article
83+
authors:
84+
- family-names: "Hoyer"
85+
given-names: "Stephan"
86+
orcid: "https://orcid.org/0000-0002-5207-0380"
87+
- family-names: "Joseph"
88+
given-names: "Hamman"
89+
orcid: "https://orcid.org/0000-0001-7479-8439"
90+
doi: "10.5334/jors.148"
91+
journal: "Journal of Open Research Software"
92+
month: 4
93+
title: "xarray: N-D labeled Arrays and Datasets in Python"
94+
volume: 5
95+
issue: 1
96+
year: 2017

asv_bench/asv.conf.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@
6262
"pandas": [""],
6363
"netcdf4": [""],
6464
"scipy": [""],
65-
"bottleneck": ["", null],
65+
"bottleneck": [""],
6666
"dask": [""],
6767
"distributed": [""],
6868
},

asv_bench/benchmarks/dataarray_missing.py

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,6 @@ def make_bench_data(shape, frac_nan, chunks):
1616
return da
1717

1818

19-
def requires_bottleneck():
20-
try:
21-
import bottleneck # noqa: F401
22-
except ImportError:
23-
raise NotImplementedError()
24-
25-
2619
class DataArrayMissingInterpolateNA:
2720
def setup(self, shape, chunks, limit):
2821
if chunks is not None:
@@ -46,7 +39,6 @@ def time_interpolate_na(self, shape, chunks, limit):
4639

4740
class DataArrayMissingBottleneck:
4841
def setup(self, shape, chunks, limit):
49-
requires_bottleneck()
5042
if chunks is not None:
5143
requires_dask()
5244
self.da = make_bench_data(shape, 0.1, chunks)

asv_bench/benchmarks/groupby.py

Lines changed: 70 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,98 @@
11
import numpy as np
2+
import pandas as pd
23

34
import xarray as xr
45

5-
from . import parameterized, requires_dask
6+
from . import _skip_slow, parameterized, requires_dask
67

78

89
class GroupBy:
910
def setup(self, *args, **kwargs):
10-
self.ds = xr.Dataset(
11+
self.n = 100
12+
self.ds1d = xr.Dataset(
1113
{
12-
"a": xr.DataArray(np.r_[np.arange(500.0), np.arange(500.0)]),
13-
"b": xr.DataArray(np.arange(1000.0)),
14+
"a": xr.DataArray(np.r_[np.repeat(1, self.n), np.repeat(2, self.n)]),
15+
"b": xr.DataArray(np.arange(2 * self.n)),
1416
}
1517
)
18+
self.ds2d = self.ds1d.expand_dims(z=10)
1619

17-
@parameterized(["method"], [("sum", "mean")])
18-
def time_agg(self, method):
19-
return getattr(self.ds.groupby("a"), method)()
20+
@parameterized(["ndim"], [(1, 2)])
21+
def time_init(self, ndim):
22+
getattr(self, f"ds{ndim}d").groupby("b")
23+
24+
@parameterized(["method", "ndim"], [("sum", "mean"), (1, 2)])
25+
def time_agg_small_num_groups(self, method, ndim):
26+
ds = getattr(self, f"ds{ndim}d")
27+
getattr(ds.groupby("a"), method)()
28+
29+
@parameterized(["method", "ndim"], [("sum", "mean"), (1, 2)])
30+
def time_agg_large_num_groups(self, method, ndim):
31+
ds = getattr(self, f"ds{ndim}d")
32+
getattr(ds.groupby("b"), method)()
2033

2134

2235
class GroupByDask(GroupBy):
2336
def setup(self, *args, **kwargs):
2437
requires_dask()
2538
super().setup(**kwargs)
26-
self.ds = self.ds.chunk({"dim_0": 50})
39+
self.ds1d = self.ds1d.sel(dim_0=slice(None, None, 2)).chunk({"dim_0": 50})
40+
self.ds2d = self.ds2d.sel(dim_0=slice(None, None, 2)).chunk(
41+
{"dim_0": 50, "z": 5}
42+
)
2743

2844

29-
class GroupByDataFrame(GroupBy):
45+
class GroupByPandasDataFrame(GroupBy):
46+
"""Run groupby tests using pandas DataFrame."""
47+
3048
def setup(self, *args, **kwargs):
49+
# Skip testing in CI as it won't ever change in a commit:
50+
_skip_slow()
51+
3152
super().setup(**kwargs)
32-
self.ds = self.ds.to_dataframe()
53+
self.ds1d = self.ds1d.to_dataframe()
3354

3455

3556
class GroupByDaskDataFrame(GroupBy):
57+
"""Run groupby tests using dask DataFrame."""
58+
59+
def setup(self, *args, **kwargs):
60+
# Skip testing in CI as it won't ever change in a commit:
61+
_skip_slow()
62+
63+
requires_dask()
64+
super().setup(**kwargs)
65+
self.ds1d = self.ds1d.chunk({"dim_0": 50}).to_dataframe()
66+
67+
68+
class Resample:
69+
def setup(self, *args, **kwargs):
70+
self.ds1d = xr.Dataset(
71+
{
72+
"b": ("time", np.arange(365.0 * 24)),
73+
},
74+
coords={"time": pd.date_range("2001-01-01", freq="H", periods=365 * 24)},
75+
)
76+
self.ds2d = self.ds1d.expand_dims(z=10)
77+
78+
@parameterized(["ndim"], [(1, 2)])
79+
def time_init(self, ndim):
80+
getattr(self, f"ds{ndim}d").resample(time="D")
81+
82+
@parameterized(["method", "ndim"], [("sum", "mean"), (1, 2)])
83+
def time_agg_small_num_groups(self, method, ndim):
84+
ds = getattr(self, f"ds{ndim}d")
85+
getattr(ds.resample(time="3M"), method)()
86+
87+
@parameterized(["method", "ndim"], [("sum", "mean"), (1, 2)])
88+
def time_agg_large_num_groups(self, method, ndim):
89+
ds = getattr(self, f"ds{ndim}d")
90+
getattr(ds.resample(time="48H"), method)()
91+
92+
93+
class ResampleDask(Resample):
3694
def setup(self, *args, **kwargs):
3795
requires_dask()
3896
super().setup(**kwargs)
39-
self.ds = self.ds.chunk({"dim_0": 50}).to_dataframe()
97+
self.ds1d = self.ds1d.chunk({"time": 50})
98+
self.ds2d = self.ds2d.chunk({"time": 50, "z": 4})

0 commit comments

Comments
 (0)