def test_aggregate_categorical_season_membership(self):
     test_cube_a = common._generate_extended_cube()
     test_cube_a = ch.aggregate_categorical(test_cube_a,
                                            'season_membership')
     self.assertIsNotNone(test_cube_a)
     self.assertEqual(
         test_cube_a.coord('season_membership').points[0], True)
 def test_aggregate_categorical_compounds(self):
     test_cube_a = common._generate_extended_cube()
     test_cube_a = ch.aggregate_categorical(test_cube_a,
                                            'annual_seasonal_mean')
     self.assertIsNotNone(test_cube_a)
     self.assertEqual(test_cube_a.coord('time').bounds[0][0], 0)
     self.assertEqual(test_cube_a.coord('time').bounds[0][1], 58.0)
     self.assertEqual(test_cube_a.coord('time').points[0], 29.0)
     self.assertEqual(test_cube_a.coord('clim_season').points[0], 'djf')
     self.assertEqual(test_cube_a.coord('season_year').points[0], 1970)
 def test_aggregate_categorical_day_of_year(self):
     test_cube_a = common._generate_extended_cube()
     test_cube_a = ch.aggregate_categorical(test_cube_a, 'day_of_year')
     self.assertEqual(test_cube_a.coord('day_of_year').points[0], 1)
     self.assertEqual(test_cube_a.coord('day_of_year').points[47], 48)
     self.assertEqual(test_cube_a.coord('day_of_year').points[133], 134)
     self.assertEqual(test_cube_a.coord('day_of_year').points[260], 261)
     self.assertEqual(test_cube_a.coord('time').points[0], 3470.0)
     self.assertEqual(test_cube_a.coord('time').points[47], 3517.0)
     self.assertEqual(test_cube_a.coord('time').points[133], 3420.0)
     self.assertEqual(test_cube_a.coord('time').points[260], 3547.0)
 def test_aggregate_categorical_season(self):
     test_cube_a = common._generate_extended_cube()
     test_cube_a = ch.aggregate_categorical(test_cube_a, 'season')
     self.assertIsNotNone(test_cube_a)
     self.assertEqual(test_cube_a.coord('season').points[0], 'djf')
     self.assertEqual(test_cube_a.coord('season').points[1], 'mam')
     self.assertEqual(test_cube_a.coord('season').points[2], 'jja')
     self.assertEqual(test_cube_a.coord('season').points[3], 'son')
     self.assertEqual(test_cube_a.coord('time').points[0], 3499.0)
     self.assertEqual(test_cube_a.coord('time').points[1], 3529.0)
     self.assertEqual(test_cube_a.coord('time').points[2], 3484.0)
     self.assertEqual(test_cube_a.coord('time').points[3], 3575.5)
 def test_aggregate_categorical_season_year(self):
     test_cube_a = common._generate_extended_cube()
     test_cube_a = ch.aggregate_categorical(test_cube_a, 'season_year')
     self.assertIsNotNone(test_cube_a)
     self.assertEqual(test_cube_a.coord('season_year').points[0], 1970)
     self.assertEqual(test_cube_a.coord('season_year').points[4], 1974)
     self.assertEqual(test_cube_a.coord('season_year').points[9], 1979)
     self.assertEqual(test_cube_a.coord('season_year').points[14], 1984)
     self.assertEqual(test_cube_a.coord('time').points[0], 166.5)
     self.assertEqual(test_cube_a.coord('time').points[4], 1612.0)
     self.assertEqual(test_cube_a.coord('time').points[9], 3438.0)
     self.assertEqual(test_cube_a.coord('time').points[14], 5264.5)
 def test_aggregate_categorical_year(self):
     test_cube_a = common._generate_extended_cube()
     test_cube_a = ch.aggregate_categorical(test_cube_a, 'year')
     self.assertIsNotNone(test_cube_a)
     self.assertEqual(test_cube_a.coord('year').points[0], 1970)
     self.assertEqual(test_cube_a.coord('year').points[4], 1974)
     self.assertEqual(test_cube_a.coord('year').points[9], 1979)
     self.assertEqual(test_cube_a.coord('year').points[14], 1984)
     self.assertEqual(test_cube_a.coord('time').points[0], 182.0)
     self.assertEqual(test_cube_a.coord('time').points[4], 1643.0)
     self.assertEqual(test_cube_a.coord('time').points[9], 3469.0)
     self.assertEqual(test_cube_a.coord('time').points[14], 5295.5)
 def test_aggregate_categorical_month_number(self):
     test_cube_a = common._generate_extended_cube()
     test_cube_a = ch.aggregate_categorical(test_cube_a, 'month_number')
     self.assertIsNotNone(test_cube_a)
     self.assertEqual(test_cube_a.coord('month_number').points[0], 1)
     self.assertEqual(test_cube_a.coord('month_number').points[4], 5)
     self.assertEqual(test_cube_a.coord('month_number').points[9], 10)
     self.assertEqual(test_cube_a.coord('month_number').points[11], 12)
     self.assertEqual(test_cube_a.coord('time').points[0], 3485.0)
     self.assertEqual(test_cube_a.coord('time').points[4], 3422.5)
     self.assertEqual(test_cube_a.coord('time').points[9], 3575.5)
     self.assertEqual(test_cube_a.coord('time').points[11], 3636.5)
 def test_aggregate_categorical_month(self):
     test_cube_a = common._generate_extended_cube()
     test_cube_a = ch.aggregate_categorical(test_cube_a, 'month')
     self.assertIsNotNone(test_cube_a)
     self.assertEqual(test_cube_a.coord('month').points[0], 'Jan')
     self.assertEqual(test_cube_a.coord('month').points[4], 'May')
     self.assertEqual(test_cube_a.coord('month').points[9], 'Oct')
     self.assertEqual(test_cube_a.coord('month').points[11], 'Dec')
     self.assertEqual(test_cube_a.coord('time').points[0], 3485.0)
     self.assertEqual(test_cube_a.coord('time').points[4], 3422.5)
     self.assertEqual(test_cube_a.coord('time').points[9], 3575.5)
     self.assertEqual(test_cube_a.coord('time').points[11], 3636.5)
 def test_aggregate_categorical_weekday_number(self):
     test_cube_a = common._generate_extended_cube()
     test_cube_a = ch.aggregate_categorical(test_cube_a, 'weekday_number')
     self.assertIsNotNone(test_cube_a)
     self.assertEqual(test_cube_a.coord('weekday_number').points[0], 3)
     self.assertEqual(test_cube_a.coord('weekday_number').points[2], 5)
     self.assertEqual(test_cube_a.coord('weekday_number').points[4], 0)
     self.assertEqual(test_cube_a.coord('weekday_number').points[6], 2)
     self.assertEqual(test_cube_a.coord('time').points[0], 3496.5)
     self.assertEqual(test_cube_a.coord('time').points[2], 3498.5)
     self.assertEqual(test_cube_a.coord('time').points[4], 3500.5)
     self.assertEqual(test_cube_a.coord('time').points[6], 3502.5)
 def test_aggregate_categorical_weekday(self):
     test_cube_a = common._generate_extended_cube()
     test_cube_a = ch.aggregate_categorical(test_cube_a, 'weekday')
     self.assertIsNotNone(test_cube_a)
     self.assertEqual(test_cube_a.coord('weekday').points[0], 'Thu')
     self.assertEqual(test_cube_a.coord('weekday').points[2], 'Sat')
     self.assertEqual(test_cube_a.coord('weekday').points[4], 'Mon')
     self.assertEqual(test_cube_a.coord('weekday').points[6], 'Wed')
     self.assertEqual(test_cube_a.coord('time').points[0], 3496.5)
     self.assertEqual(test_cube_a.coord('time').points[2], 3498.5)
     self.assertEqual(test_cube_a.coord('time').points[4], 3500.5)
     self.assertEqual(test_cube_a.coord('time').points[6], 3502.5)
 def test_aggregate_categorical_day_of_month(self):
     test_cube_a = common._generate_extended_cube()
     test_cube_a = ch.aggregate_categorical(test_cube_a, 'day_of_month')
     self.assertEqual(test_cube_a.coord('day_of_month').points[0], 1)
     self.assertEqual(test_cube_a.coord('day_of_month').points[5], 6)
     self.assertEqual(test_cube_a.coord('day_of_month').points[10], 11)
     self.assertEqual(test_cube_a.coord('day_of_month').points[15], 16)
     self.assertEqual(test_cube_a.coord('day_of_month').points[20], 21)
     self.assertEqual(test_cube_a.coord('day_of_month').points[25], 26)
     self.assertEqual(test_cube_a.coord('time').points[0], 3499.5)
     self.assertEqual(test_cube_a.coord('time').points[5], 3490.5)
     self.assertEqual(test_cube_a.coord('time').points[10], 3495.5)
     self.assertEqual(test_cube_a.coord('time').points[15], 3500.5)