Esempio n. 1
0
 def setUp(self):
     self.cube = stock.simple_3d()
     self.representer = CubeRepresentation(self.cube)
     self.representer._get_bits(self.representer._get_lines())
     col_span = self.representer.ndims
     self.row = self.representer._make_row('title', body='first',
                                           col_span=col_span)
Esempio n. 2
0
 def test_handle_newline(self):
     cube = self.cube
     cube.attributes['lines'] = 'first\nsecond'
     representer = CubeRepresentation(cube)
     representer._get_bits(representer._get_lines())
     result = representer._make_content()
     self.assertIn('first<br>second', result)
Esempio n. 3
0
 def test_no_attrs(self):
     self.cube.attributes = {}
     representer = CubeRepresentation(self.cube)
     result = representer.repr_html().lower()
     self.assertIn('dimension coordinates', result)
     self.assertIn('auxiliary coordinates', result)
     self.assertIn('scalar coordinates', result)
     self.assertNotIn('attributes', result)
Esempio n. 4
0
 def test_no_dim_coords(self):
     dim_coords = [c.name() for c in self.cube.coords(dim_coords=True)]
     for coord in dim_coords:
         self.cube.remove_coord(coord)
     representer = CubeRepresentation(self.cube)
     result = representer.repr_html().lower()
     self.assertNotIn('dimension coordinates', result)
     self.assertIn('auxiliary coordinates', result)
     self.assertIn('scalar coordinates', result)
     self.assertIn('attributes', result)
Esempio n. 5
0
 def test_no_aux_coords(self):
     aux_coords = ["forecast_period"]
     for coord in aux_coords:
         self.cube.remove_coord(coord)
     representer = CubeRepresentation(self.cube)
     result = representer.repr_html().lower()
     self.assertIn("dimension coordinates", result)
     self.assertNotIn("auxiliary coordinates", result)
     self.assertIn("scalar coordinates", result)
     self.assertIn("attributes", result)
Esempio n. 6
0
 def test_no_coords(self):
     all_coords = [coord.name() for coord in self.cube.coords()]
     for coord in all_coords:
         self.cube.remove_coord(coord)
     representer = CubeRepresentation(self.cube)
     result = representer.repr_html().lower()
     self.assertNotIn("dimension coordinates", result)
     self.assertNotIn("auxiliary coordinates", result)
     self.assertNotIn("scalar coordinates", result)
     self.assertIn("attributes", result)
Esempio n. 7
0
 def test_no_scalar_coords(self):
     aux_coords = ['air_pressure']
     for coord in aux_coords:
         self.cube.remove_coord(coord)
     representer = CubeRepresentation(self.cube)
     result = representer.repr_html().lower()
     self.assertIn('dimension coordinates', result)
     self.assertIn('auxiliary coordinates', result)
     self.assertNotIn('scalar coordinates', result)
     self.assertIn('attributes', result)
Esempio n. 8
0
 def setUp(self):
     self.cube = stock.realistic_4d()
     cmth = CellMethod("mean", "time", "6hr")
     self.cube.add_cell_method(cmth)
     cms = CellMeasure([0, 1, 2, 3, 4, 5], long_name="foo")
     self.cube.add_cell_measure(cms, 0)
     avr = AncillaryVariable([0, 1, 2, 3, 4, 5], long_name="bar")
     self.cube.add_ancillary_variable(avr, 0)
     scms = CellMeasure([0], long_name="baz")
     self.cube.add_cell_measure(scms)
     self.representer = CubeRepresentation(self.cube)
     self.representer._get_bits(self.representer._get_lines())
Esempio n. 9
0
 def setUp(self):
     self.cube = stock.realistic_4d()
     cmth = CellMethod('mean', 'time', '6hr')
     self.cube.add_cell_method(cmth)
     cms = CellMeasure([0, 1, 2, 3, 4, 5], measure='area', long_name='foo')
     self.cube.add_cell_measure(cms, 0)
     avr = AncillaryVariable([0, 1, 2, 3, 4, 5], long_name='bar')
     self.cube.add_ancillary_variable(avr, 0)
     scms = CellMeasure([0], measure='area', long_name='baz')
     self.cube.add_cell_measure(scms)
     self.representer = CubeRepresentation(self.cube)
     self.representer._get_bits(self.representer._get_lines())
Esempio n. 10
0
 def setUp(self):
     self.cube = stock.realistic_4d()
     self.dim_names = [c.name() for c in self.cube.coords(dim_coords=True)]
     self.representer = CubeRepresentation(self.cube)
Esempio n. 11
0
 def setUp(self):
     self.cube = stock.lat_lon_cube()
     # Check we're not tripped up by names containing spaces.
     self.cube.rename('Electron density')
     self.cube.units = '1e11 e/m^3'
     self.representer = CubeRepresentation(self.cube)
Esempio n. 12
0
 def setUp(self):
     self.cube = stock.simple_3d()
     representer = CubeRepresentation(self.cube)
     self.result = representer.repr_html()
Esempio n. 13
0
 def setUp(self):
     self.cube = stock.simple_3d()
     self.representer = CubeRepresentation(self.cube)
Esempio n. 14
0
 def setUp(self):
     self.cube = stock.simple_3d()
     cm = CellMethod('mean', 'time', '6hr')
     self.cube.add_cell_method(cm)
     self.representer = CubeRepresentation(self.cube)
     self.representer._get_bits(self.representer._get_lines())
Esempio n. 15
0
 def setUp(self):
     self.cube = stock.simple_3d()
     self.representer = CubeRepresentation(self.cube)
     self.representer._get_bits(self.representer._get_lines())
     self.result = self.representer._make_content()
Esempio n. 16
0
 def setUp(self):
     self.cube = stock.simple_3d()
     self.representer = CubeRepresentation(self.cube)
     self.representer._get_bits(self.representer._get_lines())
     self.result = self.representer._make_shapes_row().split('\n')
Esempio n. 17
0
 def setUp(self):
     self.cube = stock.simple_3d()
     self.representer = CubeRepresentation(self.cube)
     self.representer._get_bits(self.representer._get_lines())
     self.header_emts = self.representer._make_header().split('\n')
Esempio n. 18
0
 def test_no_cell_methods(self):
     representer = CubeRepresentation(self.cube)
     result = representer.repr_html().lower()
     self.assertNotIn('cell methods', result)
Esempio n. 19
0
 def setUp(self):
     self.cube = stock.realistic_3d()[0, 0, 0]
     self.representer = CubeRepresentation(self.cube)
     self.representer.repr_html()
Esempio n. 20
0
 def setUp(self):
     self.shape = (2, 3, 4)
     self.cube = Cube(np.arange(24).reshape(self.shape))
     self.representer = CubeRepresentation(self.cube)
     self.representer.repr_html()