def test_remap_agg_proportions(self, months, remap_months): month_set = IntervalSet('months', months) remap_set = IntervalSet('remap_months', remap_months) to_interval = month_set.data[0] # january actual = remap_set.get_proportion(0, to_interval) expected = 1.0333333333333 np.testing.assert_allclose(actual, expected, rtol=1e-3)
def test_get_proportion_season_in_month(self, months, seasons): month_set = IntervalSet('months', months) season_set = IntervalSet('seasons', seasons) january = month_set.data[0] actual = season_set.get_proportion(0, january) expected = 31 * 1 / (31 + 31 + 28) np.testing.assert_allclose(actual, expected)
def test_get_proportion_month_in_season(self, months, seasons): month_set = IntervalSet('months', months) season_set = IntervalSet('seasons', seasons) winter = season_set.data[0] actual = month_set.get_proportion(0, winter) expected = 1 assert actual == expected
def test_remap_disagg_proportions(self, months, remap_months): """Find proportion of January in cold_month, split over year """ month_set = IntervalSet('months', months) remap_set = IntervalSet('remap_months', remap_months) to_interval = remap_set.data[0] # cold month actual = month_set.get_proportion(0, to_interval) expected = 0.33333 np.testing.assert_allclose(actual, expected, rtol=1e-3)