def test_compute_uninitialized( hind_ds_initialized_1d, reconstruction_ds_1d, hist_ds_uninitialized_1d, metric, comparison, ): """ Checks that compute uninitialized works without breaking. """ category_edges = np.array([0.0, 0.5, 1.0]) if metric == "contingency": metric_kwargs = { "forecast_category_edges": category_edges, "observation_category_edges": category_edges, "score": "accuracy", } else: metric_kwargs = {} res = (compute_uninitialized(hind_ds_initialized_1d, hist_ds_uninitialized_1d, reconstruction_ds_1d, metric=metric, comparison=comparison, **metric_kwargs).isnull().any()) for var in res.data_vars: assert not res[var]
def test_compute_uninitialized_alignment(hind_ds_initialized_1d, reconstruction_ds_1d, hist_ds_uninitialized_1d, alignment): """Tests that compute_uninitialized works for various alignments.""" res = (compute_uninitialized( hind_ds_initialized_1d, hist_ds_uninitialized_1d, reconstruction_ds_1d, metric="pr", comparison="e2o", alignment=alignment, ).isnull().any()) for var in res.data_vars: assert not res[var]
def test_compute_uninitialized_same_verifs(hind_ds_initialized_1d, reconstruction_ds_1d, hist_ds_uninitialized_1d): """Tests that uninitialized skill is same at all leads for `same_verifs` alignment.""" res = compute_uninitialized( hind_ds_initialized_1d, hist_ds_uninitialized_1d, reconstruction_ds_1d, metric="pr", comparison="e2o", alignment="same_verifs", ).to_array() assert ((res - res[0]) == 0).all()
def test_compute_uninitialized_same_verifs( hind_da_initialized_1d, reconstruction_da_1d, hist_da_uninitialized_1d ): """Tests that uninitialized skill is same at all leads for `same_verifs` alignment.""" res = compute_uninitialized( hind_da_initialized_1d, hist_da_uninitialized_1d, reconstruction_da_1d, metric='pr', comparison='e2o', alignment='same_verifs', ) assert ((res - res[0]) == 0).all()
def test_compute_uninitialized( hind_ds_initialized_1d, reconstruction_ds_1d, hist_ds_uninitialized_1d, metric, comparison, ): """ Checks that compute uninitialized works without breaking. """ res = ( compute_uninitialized( hind_ds_initialized_1d, hist_ds_uninitialized_1d, reconstruction_ds_1d, metric=metric, comparison=comparison, ) .isnull() .any() ) for var in res.data_vars: assert not res[var]