コード例 #1
0
ファイル: test_netcdf.py プロジェクト: AntoinedDMO/iris
 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)
コード例 #2
0
ファイル: test_netcdf.py プロジェクト: lengyanyanjing/iris
 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)
コード例 #3
0
 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
         )
コード例 #4
0
 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"),)
     )
コード例 #5
0
 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)
コード例 #6
0
 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")
コード例 #7
0
 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)
コード例 #8
0
 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)
コード例 #9
0
 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)
コード例 #10
0
 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"),))
コード例 #11
0
 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")