Ejemplo n.º 1
0
    def test_pad_earlier_segments_area_for_FCI_padding(self, AreaDefinition):
        """Test _pad_earlier_segments_area() for the FCI case."""
        from satpy.readers.yaml_reader import _pad_earlier_segments_area as pesa

        seg2_area = MagicMock()
        seg2_area.proj_dict = 'proj_dict'
        seg2_area.area_extent = [0, 1000, 200, 500]
        seg2_area.shape = [278, 5568]
        get_area_def = MagicMock()
        get_area_def.return_value = seg2_area
        fh_2 = MagicMock()
        filetype_info = {'expected_segments': 2, 'file_type': 'fci_l1c_fdhsi'}
        filename_info = {'segment': 2}
        fh_2.filetype_info = filetype_info
        fh_2.filename_info = filename_info
        fh_2.get_area_def = get_area_def
        file_handlers = [fh_2]
        dataid = 'dataid'
        area_defs = {2: seg2_area}
        res = pesa(file_handlers, dataid, area_defs)
        self.assertEqual(len(res), 2)

        # the previous chunk size is 278, which is exactly double the size of the FCI chunk 1 size (139)
        # 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 500-250=250
        seg1_extent = (0, 500, 200, 250)
        expected_call = ('fill', 'fill', 'fill', 'proj_dict', 5568, 139,
                         seg1_extent)
        AreaDefinition.assert_called_once_with(*expected_call)
Ejemplo n.º 2
0
    def test_pad_earlier_segments_area(self, AreaDefinition):
        """Test _pad_earlier_segments_area()."""
        from satpy.readers.yaml_reader import _pad_earlier_segments_area as pesa

        seg2_area = MagicMock()
        seg2_area.proj_dict = 'proj_dict'
        seg2_area.area_extent = [0, 1000, 200, 500]
        seg2_area.shape = [200, 500]
        get_area_def = MagicMock()
        get_area_def.return_value = seg2_area
        fh_2 = MagicMock()
        filetype_info = {'expected_segments': 2}
        filename_info = {'segment': 2}
        fh_2.filetype_info = filetype_info
        fh_2.filename_info = filename_info
        fh_2.get_area_def = get_area_def
        file_handlers = [fh_2]
        dataid = 'dataid'
        area_defs = {2: seg2_area}
        res = pesa(file_handlers, dataid, area_defs)
        self.assertEqual(len(res), 2)
        seg1_extent = (0, 500, 200, 0)
        expected_call = ('fill', 'fill', 'fill', 'proj_dict', 500, 200,
                         seg1_extent)
        AreaDefinition.assert_called_once_with(*expected_call)