Exemple #1
0
 def test_single_ds(self):
     """Test a single dataset is returned unharmed."""
     from satpy.composites import CompositeBase
     ds1 = self._get_test_ds()
     comp = CompositeBase('test_comp')
     ret_datasets = comp.check_areas((ds1, ))
     self.assertIs(ret_datasets[0], ds1)
Exemple #2
0
 def test_nondimensional_coords(self):
     from satpy.composites import CompositeBase
     ds = self._get_test_ds(shape=(2, 2))
     ds['acq_time'] = ('y', [0, 1])
     comp = CompositeBase('test_comp')
     ret_datasets = comp.match_data_arrays([ds, ds])
     self.assertNotIn('acq_time', ret_datasets[0].coords)
Exemple #3
0
 def test_single_ds(self):
     """Test a single dataset is returned unharmed."""
     from satpy.composites import CompositeBase
     ds1 = self._get_test_ds()
     comp = CompositeBase('test_comp')
     ret_datasets = comp.check_areas((ds1,))
     self.assertIs(ret_datasets[0], ds1)
Exemple #4
0
 def test_mult_ds_area(self):
     """Test multiple datasets successfully pass."""
     from satpy.composites import CompositeBase
     ds1 = self._get_test_ds()
     ds2 = self._get_test_ds()
     comp = CompositeBase('test_comp')
     ret_datasets = comp.check_areas((ds1, ds2))
     self.assertIs(ret_datasets[0], ds1)
     self.assertIs(ret_datasets[1], ds2)
Exemple #5
0
 def test_mult_ds_area(self):
     """Test multiple datasets successfully pass."""
     from satpy.composites import CompositeBase
     ds1 = self._get_test_ds()
     ds2 = self._get_test_ds()
     comp = CompositeBase('test_comp')
     ret_datasets = comp.check_areas((ds1, ds2))
     self.assertIs(ret_datasets[0], ds1)
     self.assertIs(ret_datasets[1], ds2)
Exemple #6
0
 def test_mult_ds_diff_dims(self):
     """Test that datasets with different dimensions still pass."""
     from satpy.composites import CompositeBase
     # x is still 50, y is still 100, even though they are in
     # different order
     ds1 = self._get_test_ds(shape=(50, 100), dims=('y', 'x'))
     ds2 = self._get_test_ds(shape=(3, 100, 50), dims=('bands', 'x', 'y'))
     comp = CompositeBase('test_comp')
     ret_datasets = comp.check_areas((ds1, ds2))
     self.assertIs(ret_datasets[0], ds1)
     self.assertIs(ret_datasets[1], ds2)
Exemple #7
0
 def test_mult_ds_diff_dims(self):
     """Test that datasets with different dimensions still pass."""
     from satpy.composites import CompositeBase
     # x is still 50, y is still 100, even though they are in
     # different order
     ds1 = self._get_test_ds(shape=(50, 100), dims=('y', 'x'))
     ds2 = self._get_test_ds(shape=(3, 100, 50), dims=('bands', 'x', 'y'))
     comp = CompositeBase('test_comp')
     ret_datasets = comp.check_areas((ds1, ds2))
     self.assertIs(ret_datasets[0], ds1)
     self.assertIs(ret_datasets[1], ds2)
Exemple #8
0
 def test_mult_ds_no_area(self):
     """Test that all datasets must have an area attribute."""
     from satpy.composites import CompositeBase
     ds1 = self._get_test_ds()
     ds2 = self._get_test_ds()
     del ds2.attrs['area']
     comp = CompositeBase('test_comp')
     self.assertRaises(ValueError, comp.check_areas, (ds1, ds2))
Exemple #9
0
 def test_mult_ds_diff_size(self):
     """Test that datasets with different sizes fail."""
     from satpy.composites import CompositeBase, IncompatibleAreas
     # x is 50 in this one, 100 in ds2
     # y is 100 in this one, 50 in ds2
     ds1 = self._get_test_ds(shape=(50, 100), dims=('x', 'y'))
     ds2 = self._get_test_ds(shape=(3, 50, 100), dims=('bands', 'y', 'x'))
     comp = CompositeBase('test_comp')
     self.assertRaises(IncompatibleAreas, comp.check_areas, (ds1, ds2))
Exemple #10
0
 def test_mult_ds_diff_area(self):
     """Test that datasets with different areas fail."""
     from satpy.composites import CompositeBase, IncompatibleAreas
     from pyresample.geometry import AreaDefinition
     ds1 = self._get_test_ds()
     ds2 = self._get_test_ds()
     ds2.attrs['area'] = AreaDefinition('test', 'test', 'test', {
         'proj': 'eqc',
         'lon_0': 0.0,
         'lat_0': 0.0
     }, 100, 50, (-30037508.34, -20018754.17, 10037508.34, 18754.17))
     comp = CompositeBase('test_comp')
     self.assertRaises(IncompatibleAreas, comp.check_areas, (ds1, ds2))