def test_hybrid_height_cubes_on_dimension_coordinate(self): hh1 = stock.hybrid_height() hh2 = stock.hybrid_height() sa = hh2.coord('surface_altitude') sa.points = sa.points * 10 emsg = 'Unable to create dimensonless vertical coordinate.' with self.temp_filename('.nc') as fname, \ self.assertRaisesRegexp(ValueError, emsg): iris.save([hh1, hh2], fname)
def test_span_check(self): cube = hybrid_height() emsg = "don't span the 2 data dimensions" with self.assertRaisesRegex(ValueError, emsg): iplt._get_plot_defn_custom_coords_picked( cube, ("sigma", "level_height"), POINT_MODE )
def test_dimension_already_has_dimcoord(self): cube_a = stock.hybrid_height() cube_b = cube_a.copy() promote_aux_coord_to_dim_coord(cube_b, "model_level_number") self.assertEqual( cube_b.dim_coords, (cube_a.coord("model_level_number"),) )
def test_old_dim_coord_is_now_aux_coord(self): cube_a = stock.hybrid_height() cube_b = cube_a.copy() demote_dim_coord_to_aux_coord(cube_b, 'level_height') self.assertTrue(cube_a.coord('level_height') in cube_b.aux_coords)
def test_trying_to_promote_a_nonmonotonic_coord(self): cube_a = stock.hybrid_height() with self.assertRaises(ValueError): promote_aux_coord_to_dim_coord(cube_a, "surface_altitude")
def test_old_dim_coord_is_now_aux_coord(self): cube_a = stock.hybrid_height() cube_b = cube_a.copy() promote_aux_coord_to_dim_coord(cube_b, "model_level_number") self.assertTrue(cube_a.coord("level_height") in cube_b.aux_coords)
def test_span_check(self): cube = hybrid_height() emsg = 'don\'t span the 2 data dimensions' with self.assertRaisesRegexp(ValueError, emsg): iplt._get_plot_defn_custom_coords_picked( cube, ('sigma', 'level_height'), POINT_MODE)
def test_dimension_already_has_dimcoord(self): cube_a = stock.hybrid_height() cube_b = cube_a.copy() promote_aux_coord_to_dim_coord(cube_b, "model_level_number") self.assertEqual(cube_b.dim_coords, (cube_a.coord("model_level_number"),))