def test_xr_threshold_brier_score_dask(a_dask, b_dask): threshold = .5 actual = xr_threshold_brier_score(a_dask, b_dask, threshold) expected = threshold_brier_score(a_dask, b_dask, threshold) expected = xr.DataArray(expected, coords=a_dask.coords) # test for numerical identity of xr_threshold and threshold assert_identical(actual, expected) # test that xr_crps_ensemble returns chunks assert actual.chunks is not None # show that crps_ensemble returns no chunks assert expected.chunks is None
def test_xr_threshold_brier_score_multiple_thresholds_xr(o_dask, f_dask): threshold = xr.DataArray([0.1, 0.3, 0.5], dims='threshold') actual = xr_threshold_brier_score(o_dask.compute(), f_dask.compute(), threshold) assert actual.chunks is None
def test_xr_threshold_brier_score_multiple_thresholds_dask(o_dask, f_dask): threshold = xr.DataArray([0.1, 0.3, 0.5, 0.7], dims='threshold').chunk() actual = xr_threshold_brier_score(o_dask, f_dask, threshold) assert actual.chunks is not None
def test_xr_threshold_brier_score_multiple_thresholds_list(o_dask, f_dask): threshold = [0.1, 0.3, 0.5] actual = xr_threshold_brier_score(o_dask.compute(), f_dask.compute(), threshold) assert actual.chunks is None
def test_xr_threshold_brier_score_dask_b_int(o_dask, f_dask): threshold = 0 actual = xr_threshold_brier_score(o_dask, f_dask, threshold) assert actual is not None
def test_xr_threshold_brier_score_multiple_thresholds_xr(o, f): threshold = xr.DataArray([0.1, 0.3, 0.5], dims='threshold') actual = xr_threshold_brier_score(o, f, threshold) assert 'threshold' in actual.dims
def test_xr_threshold_brier_score_dask_threshold(o_dask, f_dask, threshold): actual = xr_threshold_brier_score(o_dask, f_dask, threshold) assert actual.chunks is not None
def test_xr_threshold_brier_score_dim(o, f, dim): actual = xr_threshold_brier_score(o, f, threshold=0.5, dim=dim) assert_only_dim_reduced(dim, actual, o)