def test_pad_later_segments_area_for_FCI_padding(self, AreaDefinition): """Test _pad_later_segments_area() in the FCI padding case.""" from satpy.readers.yaml_reader import _pad_later_segments_area as plsa seg1_area = MagicMock() seg1_area.proj_dict = 'proj_dict' seg1_area.area_extent = [0, 1000, 200, 500] seg1_area.shape = [556, 11136] get_area_def = MagicMock() get_area_def.return_value = seg1_area fh_1 = MagicMock() filetype_info = {'expected_segments': 2, 'file_type': 'fci_l1c_fdhsi'} filename_info = {'segment': 1} fh_1.filetype_info = filetype_info fh_1.filename_info = filename_info fh_1.get_area_def = get_area_def file_handlers = [fh_1] dataid = 'dataid' res = plsa(file_handlers, dataid) self.assertEqual(len(res), 2) # the previous chunk size is 556, which is exactly double the size of the FCI chunk 2 size (278) # therefore, the new vertical area extent should be half of the previous size (1000-500)/2=250. # The new area extent lower-left row is therefore 1000+250=1250 seg2_extent = (0, 1250, 200, 1000) expected_call = ('fill', 'fill', 'fill', 'proj_dict', 11136, 278, seg2_extent) AreaDefinition.assert_called_once_with(*expected_call)
def test_pad_later_segments_area(self, AreaDefinition): """Test _pad_later_segments_area().""" from satpy.readers.yaml_reader import _pad_later_segments_area as plsa seg1_area = MagicMock() seg1_area.proj_dict = 'proj_dict' seg1_area.area_extent = [0, 1000, 200, 500] seg1_area.shape = [200, 500] get_area_def = MagicMock() get_area_def.return_value = seg1_area fh_1 = MagicMock() filetype_info = {'expected_segments': 2} filename_info = {'segment': 1} fh_1.filetype_info = filetype_info fh_1.filename_info = filename_info fh_1.get_area_def = get_area_def file_handlers = [fh_1] dataid = 'dataid' res = plsa(file_handlers, dataid) self.assertEqual(len(res), 2) seg2_extent = (0, 1500, 200, 1000) expected_call = ('fill', 'fill', 'fill', 'proj_dict', 500, 200, seg2_extent) AreaDefinition.assert_called_once_with(*expected_call)