def prepare_area_defs(self, test_dict): """Prepare calculated and expected area definitions for equal checking.""" earth_model = test_dict['earth_model'] dataset_id = test_dict['dataset_id'] is_full_disk = test_dict['is_full_disk'] header = self.create_test_header(earth_model, dataset_id, is_full_disk) trailer = self.create_test_trailer() expected_area_def = test_dict['expected_area_def'] with mock.patch( 'satpy.readers.seviri_l1b_native.np.fromfile') as fromfile: fromfile.return_value = header with mock.patch('satpy.readers.seviri_l1b_native.recarray2dict' ) as recarray2dict: recarray2dict.side_effect = (lambda x: x) with mock.patch( 'satpy.readers.seviri_l1b_native.NativeMSGFileHandler._get_memmap' ) as _get_memmap: _get_memmap.return_value = np.arange(3) with mock.patch( 'satpy.readers.seviri_l1b_native.NativeMSGFileHandler._read_trailer' ): fh = NativeMSGFileHandler(None, {}, None) fh.header = header fh.trailer = trailer calc_area_def = fh.get_area_def(dataset_id) return (calc_area_def, expected_area_def)
def prepare_is_roi(self, test_dict): """Prepare calculated and expected check for region of interest data for equal checking.""" earth_model = 2 dataset_id = make_dataid(name='VIS006') is_full_disk = test_dict['is_full_disk'] is_rapid_scan = test_dict['is_rapid_scan'] header = self.create_test_header(earth_model, dataset_id, is_full_disk, is_rapid_scan) trailer = self.create_test_trailer(is_rapid_scan) expected_is_roi = test_dict['is_roi'] with mock.patch( 'satpy.readers.seviri_l1b_native.np.fromfile') as fromfile: fromfile.return_value = header with mock.patch('satpy.readers.seviri_l1b_native.recarray2dict' ) as recarray2dict: recarray2dict.side_effect = (lambda x: x) with mock.patch( 'satpy.readers.seviri_l1b_native.NativeMSGFileHandler._get_memmap' ) as _get_memmap: _get_memmap.return_value = np.arange(3) with mock.patch( 'satpy.readers.seviri_l1b_native.NativeMSGFileHandler._read_trailer' ): fh = NativeMSGFileHandler(None, {}, None) fh.header = header fh.trailer = trailer calc_is_roi = fh.is_roi() return (calc_is_roi, expected_is_roi)