def test_compute_persistence_lead0_lead1(pm_da_ds1d, pm_da_ds1d_lead0, pm_da_control1d, metric): """ Checks that persistence forecast results are identical for a lead 0 and lead 1 setup """ res1 = compute_persistence(pm_da_ds1d, pm_da_control1d, metric=metric) res2 = compute_persistence(pm_da_ds1d_lead0, pm_da_control1d, metric=metric) assert (res1.values == res2.values).all()
def test_persistence_lead0_lead1( initialized_ds, initialized_ds_lead0, reconstruction_ds, metric ): """ Checks that compute persistence returns the same results with a lead-0 and lead-1 framework. """ res1 = compute_persistence(initialized_ds, reconstruction_ds, metric=metric) res2 = compute_persistence(initialized_ds_lead0, reconstruction_ds, metric=metric) assert (res1.SST.values == res2.SST.values).all()
def test_persistence(initialized, reconstruction, metric): """ Checks that compute persistence works without breaking. """ res = compute_persistence(initialized, reconstruction, metric=metric).isnull().any() assert not res
def test_compute_persistence_ds1d_not_nan(pm_ds_ds1d, pm_ds_control1d, metric): """ Checks that there are no NaNs on persistence forecast of 1D time series. """ actual = (compute_persistence(pm_ds_ds1d, pm_ds_control1d, metric=metric).isnull().any()) for var in actual.data_vars: assert not actual[var]