Skip to content

Commit

Permalink
rename notes to references
Browse files Browse the repository at this point in the history
  • Loading branch information
raybellwaves committed Sep 26, 2020
1 parent e1ac646 commit b8a5760
Showing 1 changed file with 19 additions and 26 deletions.
45 changes: 19 additions & 26 deletions xskillscore/core/probabilistic.py
Expand Up @@ -327,8 +327,7 @@ def threshold_brier_score(
if isinstance(threshold, (xr.DataArray, xr.Dataset)):
if "threshold" not in threshold.dims:
raise ValueError(
"please provide threshold with threshold dim, found",
threshold.dims,
"please provide threshold with threshold dim, found", threshold.dims,
)
input_core_dims = [[], [member_dim], ["threshold"]]
output_core_dims = [["threshold"]]
Expand Down Expand Up @@ -553,34 +552,28 @@ def discrimination(
... forecast_event_likelihood,
... dim=['x','y'])
Notes
-----
See http://www.cawcr.gov.au/projects/verification/
References
----------
http://www.cawcr.gov.au/projects/verification/
"""

_fail_if_dim_empty(dim)

hist_event = (
histogram(
forecasts.where(observations),
bins=[probability_bin_edges],
bin_names=[FORECAST_PROBABILITY_DIM],
bin_dim_suffix="",
dim=dim,
)
/ (observations).sum(dim=dim)
)

hist_no_event = (
histogram(
forecasts.where(np.logical_not(observations)),
bins=[probability_bin_edges],
bin_names=[FORECAST_PROBABILITY_DIM],
bin_dim_suffix="",
dim=dim,
)
/ (np.logical_not(observations)).sum(dim=dim)
)
hist_event = histogram(
forecasts.where(observations),
bins=[probability_bin_edges],
bin_names=[FORECAST_PROBABILITY_DIM],
bin_dim_suffix="",
dim=dim,
) / (observations).sum(dim=dim)

hist_no_event = histogram(
forecasts.where(np.logical_not(observations)),
bins=[probability_bin_edges],
bin_names=[FORECAST_PROBABILITY_DIM],
bin_dim_suffix="",
dim=dim,
) / (np.logical_not(observations)).sum(dim=dim)

return xr.concat([hist_event, hist_no_event], dim="event").assign_coords(
{"event": [True, False]}
Expand Down

0 comments on commit b8a5760

Please sign in to comment.