Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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 @@ -21,7 +21,8 @@ Internal Changes
:py:func:`~xskillscore.rps` expilicty checks for ``bin_dim`` if
``category_edges==None``. (:pr:`287`) `Aaron Spring`_
- Add doctest on the docstring examples. (:pr:`302`) `Ray Bell`_
- Removed a call to compute weights in testing (:pr:`306`) `Ray Bell`_
- Removed a call to compute weights in testing. (:pr:`306`) `Ray Bell`_
- Use built in ``xarray`` clip method. (:pr:`309`) `Ray Bell`_


xskillscore v0.0.19 (2021-03-12)
Expand Down
2 changes: 1 addition & 1 deletion ci/dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ dependencies:
- xarray>=0.16.1
# xhistogram 0.1.3 introduced an error that broke xskillscore
# see https://github.com/xgcm/xhistogram/issues/48
- xhistogram!=0.1.3
- xhistogram==0.1.2
# Package Management
- asv
- black
Expand Down
2 changes: 1 addition & 1 deletion ci/doc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@ dependencies:
- xarray>=0.16.1
# xhistogram 0.1.3 introduced an error that broke xskillscore
# see https://github.com/xgcm/xhistogram/issues/48
- xhistogram!=0.1.3
- xhistogram==0.1.2
- pip:
- -e ..
2 changes: 1 addition & 1 deletion ci/docs_notebooks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ dependencies:
- xarray>=0.16.1
# xhistogram 0.1.3 introduced an error that broke xskillscore
# see https://github.com/xgcm/xhistogram/issues/48
- xhistogram!=0.1.3
- xhistogram==0.1.2
- importlib_metadata
- jupyterlab
- matplotlib-base
Expand Down
2 changes: 1 addition & 1 deletion ci/minimum-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ dependencies:
- xarray>=0.16.1
# xhistogram 0.1.3 introduced an error that broke xskillscore
# see https://github.com/xgcm/xhistogram/issues/48
- xhistogram!=0.1.3
- xhistogram==0.1.2
- coveralls
- pytest
- pytest-cov
Expand Down
4 changes: 2 additions & 2 deletions xskillscore/core/probabilistic.py
Original file line number Diff line number Diff line change
Expand Up @@ -1153,9 +1153,9 @@ def _auc(fpr, tpr, dim="probability_bin"):
area = xr.apply_ufunc(
np.trapz, tpr, fpr, input_core_dims=[[dim], [dim]], dask="allowed"
)
area = np.abs(area)
area = abs(area)
if ((area > 1)).any():
area = np.clip(area, 0, 1) # allow only values between 0 and 1
area = area.clip(0, 1) # allow only values between 0 and 1
return area


Expand Down
4 changes: 2 additions & 2 deletions xskillscore/tests/test_probabilistic.py
Original file line number Diff line number Diff line change
Expand Up @@ -996,7 +996,7 @@ def test_roc_bin_edges_continuous_against_sklearn(
forecast_1d_long, observation_1d_long, drop_intermediate_bool
):
"""Test xs.roc against sklearn.metrics.roc_curve/auc_score."""
fp = np.clip(forecast_1d_long, 0, 1) # prob
fp = forecast_1d_long.clip(0, 1) # prob
ob = observation_1d_long > 0 # binary
# sklearn
sk_fpr, sk_tpr, _ = roc_curve(ob, fp, drop_intermediate=drop_intermediate_bool)
Expand All @@ -1017,7 +1017,7 @@ def test_roc_bin_edges_continuous_against_sklearn(

def test_roc_bin_edges_drop_intermediate(forecast_1d_long, observation_1d_long):
"""Test that drop_intermediate reduces probability_bins in xs.roc ."""
fp = np.clip(forecast_1d_long, 0, 1) # prob
fp = forecast_1d_long.clip(0, 1) # prob
ob = observation_1d_long > 0 # binary
# xs
txs_fpr, txs_tpr, txs_area = roc(
Expand Down