Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace parallelized with allowed #221

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ Internal Changes
- Added Python 3.7 and Python 3.8 to the CI. Use the latest version of Python 3
for development. (:issue:`21`, :pr:`189`). `Aaron Spring`_
- Lint with the latest black. (:issue:`179`, :pr:`191`). `Ray Bell`_

- Slight optimization using dask="allowed" instead of dask="parallelized"
(:issue:`207`, :pr:`220`). `Andrew Huang`_

xskillscore v0.0.18 (2020-09-23)
--------------------------------
Expand Down
30 changes: 15 additions & 15 deletions xskillscore/core/deterministic.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ def pearson_r(a, b, dim=None, weights=None, skipna=False, keep_attrs=False):
weights,
input_core_dims=input_core_dims,
kwargs={"axis": -1, "skipna": skipna},
dask="parallelized",
dask="allowed",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am still in favor of having dask as a global keyword, see xarray.set_config

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

~/Coding/xskillscore/asv_bench$ asv continuous -f 1.1 upstream/master HEAD -b deterministic.Compute_small.time_xskillscore_metric_small

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


[ 70.83%] ··· ================================================ ========
                                     m
              ------------------------------------------------ --------
                     <function rmse at 0x7fe9d0353730>          failed
                   <function pearson_r at 0x7fe9d032c400>       failed
                      <function mae at 0x7fe9d0353840>          failed
                      <function mse at 0x7fe9d03537b8>          failed
               <function pearson_r_p_value at 0x7fe9d0353378>   failed
              ================================================ ========

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can do easy checks with asv dev -b deterministic.Compute_small.time_xskillscore_metric_small, must delete that encoding it seems

output_dtypes=[float],
keep_attrs=keep_attrs,
)
Expand Down Expand Up @@ -227,7 +227,7 @@ def r2(a, b, dim=None, weights=None, skipna=False, keep_attrs=False):
weights,
input_core_dims=input_core_dims,
kwargs={"axis": -1, "skipna": skipna},
dask="parallelized",
dask="allowed",
output_dtypes=[float],
keep_attrs=keep_attrs,
)
Expand Down Expand Up @@ -289,7 +289,7 @@ def pearson_r_p_value(a, b, dim=None, weights=None, skipna=False, keep_attrs=Fal
weights,
input_core_dims=input_core_dims,
kwargs={"axis": -1, "skipna": skipna},
dask="parallelized",
dask="allowed",
output_dtypes=[float],
keep_attrs=keep_attrs,
)
Expand Down Expand Up @@ -379,7 +379,7 @@ def effective_sample_size(a, b, dim="time", skipna=False, keep_attrs=False):
b,
input_core_dims=[[new_dim], [new_dim]],
kwargs={"axis": -1, "skipna": skipna},
dask="parallelized",
dask="allowed",
output_dtypes=[float],
keep_attrs=keep_attrs,
)
Expand Down Expand Up @@ -481,7 +481,7 @@ def pearson_r_eff_p_value(a, b, dim=None, skipna=False, keep_attrs=False):
b,
input_core_dims=[[new_dim], [new_dim]],
kwargs={"axis": -1, "skipna": skipna},
dask="parallelized",
dask="allowed",
output_dtypes=[float],
keep_attrs=keep_attrs,
)
Expand Down Expand Up @@ -548,7 +548,7 @@ def spearman_r(a, b, dim=None, weights=None, skipna=False, keep_attrs=False):
weights,
input_core_dims=input_core_dims,
kwargs={"axis": -1, "skipna": skipna},
dask="parallelized",
dask="allowed",
output_dtypes=[float],
keep_attrs=keep_attrs,
)
Expand Down Expand Up @@ -610,7 +610,7 @@ def spearman_r_p_value(a, b, dim=None, weights=None, skipna=False, keep_attrs=Fa
weights,
input_core_dims=input_core_dims,
kwargs={"axis": -1, "skipna": skipna},
dask="parallelized",
dask="allowed",
output_dtypes=[float],
keep_attrs=keep_attrs,
)
Expand Down Expand Up @@ -714,7 +714,7 @@ def spearman_r_eff_p_value(a, b, dim=None, skipna=False, keep_attrs=False):
b,
input_core_dims=[[new_dim], [new_dim]],
kwargs={"axis": -1, "skipna": skipna},
dask="parallelized",
dask="allowed",
output_dtypes=[float],
keep_attrs=keep_attrs,
)
Expand Down Expand Up @@ -773,7 +773,7 @@ def me(a, b, dim=None, weights=None, skipna=False, keep_attrs=False):
weights,
input_core_dims=input_core_dims,
kwargs={"axis": axis, "skipna": skipna},
dask="parallelized",
dask="allowed",
output_dtypes=[float],
keep_attrs=keep_attrs,
)
Expand Down Expand Up @@ -840,7 +840,7 @@ def rmse(a, b, dim=None, weights=None, skipna=False, keep_attrs=False):
weights,
input_core_dims=input_core_dims,
kwargs={"axis": axis, "skipna": skipna},
dask="parallelized",
dask="allowed",
output_dtypes=[float],
keep_attrs=keep_attrs,
)
Expand Down Expand Up @@ -907,7 +907,7 @@ def mse(a, b, dim=None, weights=None, skipna=False, keep_attrs=False):
weights,
input_core_dims=input_core_dims,
kwargs={"axis": axis, "skipna": skipna},
dask="parallelized",
dask="allowed",
output_dtypes=[float],
keep_attrs=keep_attrs,
)
Expand Down Expand Up @@ -974,7 +974,7 @@ def mae(a, b, dim=None, weights=None, skipna=False, keep_attrs=False):
weights,
input_core_dims=input_core_dims,
kwargs={"axis": axis, "skipna": skipna},
dask="parallelized",
dask="allowed",
output_dtypes=[float],
keep_attrs=keep_attrs,
)
Expand Down Expand Up @@ -1034,7 +1034,7 @@ def median_absolute_error(a, b, dim=None, skipna=False, keep_attrs=False):
b,
input_core_dims=[dim, dim],
kwargs={"axis": axis, "skipna": skipna},
dask="parallelized",
dask="allowed",
output_dtypes=[float],
keep_attrs=keep_attrs,
)
Expand Down Expand Up @@ -1105,7 +1105,7 @@ def mape(a, b, dim=None, weights=None, skipna=False, keep_attrs=False):
weights,
input_core_dims=input_core_dims,
kwargs={"axis": axis, "skipna": skipna},
dask="parallelized",
dask="allowed",
output_dtypes=[float],
keep_attrs=keep_attrs,
)
Expand Down Expand Up @@ -1175,7 +1175,7 @@ def smape(a, b, dim=None, weights=None, skipna=False, keep_attrs=False):
weights,
input_core_dims=input_core_dims,
kwargs={"axis": axis, "skipna": skipna},
dask="parallelized",
dask="allowed",
output_dtypes=[float],
keep_attrs=keep_attrs,
)
12 changes: 6 additions & 6 deletions xskillscore/core/probabilistic.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ def crps_gaussian(observations, mu, sig, dim=None, weights=None, keep_attrs=Fals
mu,
sig,
input_core_dims=[[], [], []],
dask="parallelized",
dask="allowed",
output_dtypes=[float],
keep_attrs=keep_attrs,
)
Expand Down Expand Up @@ -162,7 +162,7 @@ def crps_quadrature(
xmax,
tol,
input_core_dims=[[], [], [], [], []],
dask="parallelized",
dask="allowed",
output_dtypes=[float],
keep_attrs=keep_attrs,
)
Expand Down Expand Up @@ -241,7 +241,7 @@ def crps_ensemble(
forecasts,
input_core_dims=[[], [member_dim]],
kwargs={"axis": -1, "issorted": issorted, "weights": member_weights},
dask="parallelized",
dask="allowed",
output_dtypes=[float],
keep_attrs=keep_attrs,
)
Expand Down Expand Up @@ -316,7 +316,7 @@ def brier_score(observations, forecasts, dim=None, weights=None, keep_attrs=Fals
observations,
forecasts,
input_core_dims=[[], []],
dask="parallelized",
dask="allowed",
output_dtypes=[float],
keep_attrs=keep_attrs,
)
Expand Down Expand Up @@ -427,7 +427,7 @@ def threshold_brier_score(
input_core_dims=input_core_dims,
kwargs={"axis": -1, "issorted": issorted},
output_core_dims=output_core_dims,
dask="parallelized",
dask="allowed",
output_dtypes=[float],
keep_attrs=keep_attrs,
)
Expand Down Expand Up @@ -590,7 +590,7 @@ def _rank_first(x, y):
observations,
forecasts,
input_core_dims=[[], [member_dim]],
dask="parallelized",
dask="allowed",
output_dtypes=[int],
)

Expand Down