コード例 #1
0
 def test_function_check_file_healthiness_2(self):
     """test unhealthiness because of missing AMSR file"""
     test_archive = Archive()
     test_archive.RM_SWATH = 0
     test_archive.WINDOW_SIZE = (50, 50)
     # the second case of unhealthy file
     fil = mock.Mock(variables=['polygon_icechart'])
     test_archive.AMSR_LABELS = ["btemp_6.9h"]
     self.assertFalse(test_archive.check_file_healthiness(fil, "fake_name"))
コード例 #2
0
 def test_function_check_file_healthiness_4(self):
     """test healthiness file for a healthy file"""
     test_archive = Archive()
     test_archive.RM_SWATH = 0
     test_archive.WINDOW_SIZE = (50, 50)
     test_archive.AMSR_LABELS = ["btemp_6.9h"]
     # file is healthy
     fil = mock.Mock(variables=['polygon_icechart', 'btemp_6.9h'],
                     aoi_upperleft_sample=3,
                     aoi_lowerright_sample=120,
                     aoi_lowerright_line=200,
                     aoi_upperleft_line=14,
                    )
     self.assertTrue(test_archive.check_file_healthiness(fil, "fake_name"))
コード例 #3
0
 def test_function_check_file_healthiness_3(self):
     """test unhealthiness because of small data window size"""
     test_archive = Archive()
     test_archive.RM_SWATH = 0
     test_archive.WINDOW_SIZE = (50, 50)
     test_archive.AMSR_LABELS = ["btemp_6.9h"]
     # the third case of unhealthy file
     fil = mock.Mock(variables=['polygon_icechart', 'btemp_6.9h'],
                     aoi_upperleft_sample=3,
                     aoi_lowerright_sample=12,
                     aoi_lowerright_line=2,
                     aoi_upperleft_line=14,
                    )
     self.assertFalse(test_archive.check_file_healthiness(fil, "fake_name"))
コード例 #4
0
 def test_function_calculate_batches_for_masks(self, mock_view_as_win):
     """
     Test that self.mask_batches aand self.mask_batches_amsr2 are correctly created by correct
     call of view_as_windows function
     """
     test_archive = Archive()
     test_archive.final_ful_mask = 1
     test_archive.WINDOW_SIZE = (2, 2)
     test_archive.STRIDE_SAR_SIZE = 3
     test_archive.final_mask_with_amsr2_size = 4
     test_archive.WINDOW_SIZE_AMSR2 = (5, 5)
     test_archive.STRIDE_AMS2_SIZE = 6
     test_archive.calculate_batches_for_masks()
     self.assertEqual(mock_view_as_win.call_args_list[0], mock.call(1, (2, 2), 3))
     self.assertEqual(mock_view_as_win.call_args_list[1], mock.call(4, (5, 5), 6))