def test_calc_mean_std_min_max(self): ens = ensembles.create_ensemble(self.nc_files_simple) out1 = ensembles.ensemble_mean_std_max_min(ens) np.testing.assert_array_equal( ens['tg_mean'][:, 0, 5, 5].mean(dim='realization'), out1.tg_mean_mean[0, 5, 5]) np.testing.assert_array_equal( ens['tg_mean'][:, 0, 5, 5].std(dim='realization'), out1.tg_mean_stdev[0, 5, 5]) np.testing.assert_array_equal( ens['tg_mean'][:, 0, 5, 5].max(dim='realization'), out1.tg_mean_max[0, 5, 5]) np.testing.assert_array_equal( ens['tg_mean'][:, 0, 5, 5].min(dim='realization'), out1.tg_mean_min[0, 5, 5])
def test_calc_mean_std_min_max(self): ens = ensembles.create_ensemble(self.nc_datasets_simple) out1 = ensembles.ensemble_mean_std_max_min(ens) np.testing.assert_array_equal( ens["tg_mean"][:, 0, 5, 5].mean(dim="realization"), out1.tg_mean_mean[0, 5, 5], ) np.testing.assert_array_equal( ens["tg_mean"][:, 0, 5, 5].std(dim="realization"), out1.tg_mean_stdev[0, 5, 5], ) np.testing.assert_array_equal( ens["tg_mean"][:, 0, 5, 5].max(dim="realization"), out1.tg_mean_max[0, 5, 5]) np.testing.assert_array_equal( ens["tg_mean"][:, 0, 5, 5].min(dim="realization"), out1.tg_mean_min[0, 5, 5]) assert "Computation of statistics on" in out1.attrs["xclim_history"]