Skip to content

Commit

Permalink
format with black
Browse files Browse the repository at this point in the history
  • Loading branch information
max-sixty committed Aug 8, 2019
1 parent 6d5927a commit d234a95
Show file tree
Hide file tree
Showing 132 changed files with 22,218 additions and 17,944 deletions.
2 changes: 2 additions & 0 deletions asv_bench/benchmarks/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ def decorator(func):
func.param_names = names
func.params = params
return func

return decorator


Expand All @@ -28,6 +29,7 @@ def randn(shape, frac_nan=None, chunks=None, seed=0):
x = rng.standard_normal(shape)
else:
import dask.array as da

rng = da.random.RandomState(seed)
x = rng.standard_normal(shape, chunks=chunks)

Expand Down
18 changes: 9 additions & 9 deletions asv_bench/benchmarks/combine.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,22 +13,22 @@ def setup(self):
data = np.random.randn(t_size, x_size, y_size)

self.dsA0 = xr.Dataset(
{'A': xr.DataArray(data, coords={'T': t},
dims=('T', 'X', 'Y'))})
{"A": xr.DataArray(data, coords={"T": t}, dims=("T", "X", "Y"))}
)
self.dsA1 = xr.Dataset(
{'A': xr.DataArray(data, coords={'T': t + t_size},
dims=('T', 'X', 'Y'))})
{"A": xr.DataArray(data, coords={"T": t + t_size}, dims=("T", "X", "Y"))}
)
self.dsB0 = xr.Dataset(
{'B': xr.DataArray(data, coords={'T': t},
dims=('T', 'X', 'Y'))})
{"B": xr.DataArray(data, coords={"T": t}, dims=("T", "X", "Y"))}
)
self.dsB1 = xr.Dataset(
{'B': xr.DataArray(data, coords={'T': t + t_size},
dims=('T', 'X', 'Y'))})
{"B": xr.DataArray(data, coords={"T": t + t_size}, dims=("T", "X", "Y"))}
)

def time_combine_manual(self):
datasets = [[self.dsA0, self.dsA1], [self.dsB0, self.dsB1]]

xr.combine_manual(datasets, concat_dim=[None, 't'])
xr.combine_manual(datasets, concat_dim=[None, "t"])

def time_auto_combine(self):
"""Also has to load and arrange t coordinate"""
Expand Down
43 changes: 24 additions & 19 deletions asv_bench/benchmarks/dataarray_missing.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,8 @@

def make_bench_data(shape, frac_nan, chunks):
vals = randn(shape, frac_nan)
coords = {'time': pd.date_range('2000-01-01', freq='D',
periods=shape[0])}
da = xr.DataArray(vals, dims=('time', 'x', 'y'), coords=coords)
coords = {"time": pd.date_range("2000-01-01", freq="D", periods=shape[0])}
da = xr.DataArray(vals, dims=("time", "x", "y"), coords=coords)

if chunks is not None:
da = da.chunk(chunks)
Expand All @@ -28,44 +27,50 @@ def time_interpolate_na(shape, chunks, method, limit):
if chunks is not None:
requires_dask()
da = make_bench_data(shape, 0.1, chunks=chunks)
actual = da.interpolate_na(dim='time', method='linear', limit=limit)
actual = da.interpolate_na(dim="time", method="linear", limit=limit)

if chunks is not None:
actual = actual.compute()


time_interpolate_na.param_names = ['shape', 'chunks', 'method', 'limit']
time_interpolate_na.params = ([(3650, 200, 400), (100, 25, 25)],
[None, {'x': 25, 'y': 25}],
['linear', 'spline', 'quadratic', 'cubic'],
[None, 3])
time_interpolate_na.param_names = ["shape", "chunks", "method", "limit"]
time_interpolate_na.params = (
[(3650, 200, 400), (100, 25, 25)],
[None, {"x": 25, "y": 25}],
["linear", "spline", "quadratic", "cubic"],
[None, 3],
)


def time_ffill(shape, chunks, limit):

da = make_bench_data(shape, 0.1, chunks=chunks)
actual = da.ffill(dim='time', limit=limit)
actual = da.ffill(dim="time", limit=limit)

if chunks is not None:
actual = actual.compute()


time_ffill.param_names = ['shape', 'chunks', 'limit']
time_ffill.params = ([(3650, 200, 400), (100, 25, 25)],
[None, {'x': 25, 'y': 25}],
[None, 3])
time_ffill.param_names = ["shape", "chunks", "limit"]
time_ffill.params = (
[(3650, 200, 400), (100, 25, 25)],
[None, {"x": 25, "y": 25}],
[None, 3],
)


def time_bfill(shape, chunks, limit):

da = make_bench_data(shape, 0.1, chunks=chunks)
actual = da.bfill(dim='time', limit=limit)
actual = da.bfill(dim="time", limit=limit)

if chunks is not None:
actual = actual.compute()


time_bfill.param_names = ['shape', 'chunks', 'limit']
time_bfill.params = ([(3650, 200, 400), (100, 25, 25)],
[None, {'x': 25, 'y': 25}],
[None, 3])
time_bfill.param_names = ["shape", "chunks", "limit"]
time_bfill.params = (
[(3650, 200, 400), (100, 25, 25)],
[None, {"x": 25, "y": 25}],
[None, 3],
)
Loading

0 comments on commit d234a95

Please sign in to comment.