def new_surface(self, loc_data: Dict[str, Any]) -> SurfaceData: """ create a new surface location object from the provided data, and add it to the list of surface locations """ surf = SurfaceData(self.cst, self.chd, self.surfaces_count, **loc_data) self.surfaces_count += 1 self.add_surface(surf) surf.compute_surf_sat_vector() surf.compute_angular_azimuth_beam_resolution(self.chd.pri_sar) return surf
def test_surface_location_algorithm_02(self): """ surface location algorithm test 02 ---------------------------------- loads multiple input ISPs and one input surface location. expected result is for the surface location algorithm to determine that a new surface location should not yet be calculated """ # load input data inputs = TestDataLoader(self.input_02, delim=' ') self.initialise_algorithm(inputs) # generate input packet objects isps = [ L1AProcessingData(self.cst, self.chd, i, time_sar_ku=time, lat_sar_sat=inputs["lat_sar_sat"][i], lon_sar_sat=inputs["lon_sar_sat"][i], alt_sar_sat=inputs["alt_sar_sat"][i], win_delay_sar_ku=inputs["win_delay_sar_ku"][i]) \ for i, time in enumerate(inputs["time_sar_ku"]) ] for packet in isps: packet.compute_location_sar_surf() # create prior surface location object surf = SurfaceData(self.cst, self.chd, time_surf=inputs["time_surf"], x_surf=inputs["x_surf"], y_surf=inputs["y_surf"], z_surf=inputs["z_surf"], x_sat=inputs["x_sat"], y_sat=inputs["y_sat"], z_sat=inputs["z_sat"], x_vel_sat=inputs["x_vel_sat"], y_vel_sat=inputs["y_vel_sat"], z_vel_sat=inputs["z_vel_sat"] ) surf.compute_surf_sat_vector() surf.compute_angular_azimuth_beam_resolution( inputs["pri_sar_pre_dat"] ) # execute surface location algorithm new_surf = self.surface_location_algorithm([surf], isps) # confirm that no new surface is generated self.assertFalse(new_surf, msg="erroneously created new surface")
def new_surface(self, loc_data: Dict[str, Any]) -> SurfaceData: """ create a new surface location object from the provided data, and add it to the list of surface locations """ surf = SurfaceData( self.cst, self.chd, self.surfaces_count, **loc_data ) self.surfaces_count += 1 self.add_surface(surf) surf.compute_surf_sat_vector() surf.compute_angular_azimuth_beam_resolution( self.chd.pri_sar ) return surf
def test_surface_location_algorithm_03(self): """ surface location algorithm test 03 ---------------------------------- loads multiple input ISPs and one input surface location. expected result is for the surface location algorithm to generate a new surface location. The attributes of this new surface location are then validated against the expected values. """ # load the expected data expected_data = TestDataLoader(self.expected_03, delim=' ') # load the input data inputs = TestDataLoader(self.input_03, delim=' ') self.initialise_algorithm(inputs) # create all input packet objects isps = [ L1AProcessingData(self.cst, self.chd, i, time_sar_ku=time, lat_sar_sat=inputs["lat_sar_sat"][i], lon_sar_sat=inputs["lon_sar_sat"][i], alt_sar_sat=inputs["alt_sar_sat"][i], win_delay_sar_ku=inputs["win_delay_sar_ku"][i], x_sar_sat=0, y_sar_sat=0, z_sar_sat=0, alt_rate_sat_sar=0, roll_sar=0, pitch_sar=0, yaw_sar=0, x_vel_sat_sar=0, y_vel_sat_sar=0, z_vel_sat_sar=0, days=inputs["time_sar_ku"] // self.cst.sec_in_day, seconds=inputs["time_sar_ku"] % self.cst.sec_in_day) \ for i, time in enumerate(inputs["time_sar_ku"]) ] # calculate surface position for each packet for packet in isps: packet.compute_location_sar_surf() # create the prior surface location object surf = SurfaceData(self.cst, self.chd, time_surf=inputs["time_surf"], x_surf=inputs["x_surf"], y_surf=inputs["y_surf"], z_surf=inputs["z_surf"], x_sat=inputs["x_sat"], y_sat=inputs["y_sat"], z_sat=inputs["z_sat"], x_vel_sat=inputs["x_vel_sat"], y_vel_sat=inputs["y_vel_sat"], z_vel_sat=inputs["z_vel_sat"] ) # compute properties of the surface location surf.compute_surf_sat_vector() surf.compute_angular_azimuth_beam_resolution( inputs["pri_sar_pre_dat"] ) # execute the surface location algorithm new_surf = self.surface_location_algorithm([surf], isps) # confirm new surface has been created self.assertTrue(new_surf, msg="failed to create new surface") # retreive properties of the surface location surf = self.surface_location_algorithm.get_surface() # validate properties self.assertAlmostEqual(surf["time_surf"], expected_data["time_surf"]) self.assertAlmostEqual(surf["x_surf"], expected_data["x_surf"], delta=1e-5) self.assertAlmostEqual(surf["y_surf"], expected_data["y_surf"], delta=1e-5) self.assertAlmostEqual(surf["z_surf"], expected_data["z_surf"], delta=1e-5) self.assertAlmostEqual(surf["lat_surf"], expected_data["lat_surf"], delta=1e-12) self.assertAlmostEqual(surf["lon_surf"], expected_data["lon_surf"], delta=1e-12) self.assertAlmostEqual(surf["alt_surf"], expected_data["alt_surf"], delta=1e-4)
def test_surface_location_algorithm_04(self): """ surface location algorithm test 04 ---------------------------------- loads multiple input ISPs and two input surface locations. expected result is for the surface location algorithm to generate a new surface location and focus the position of the previous one towards the target position. The attributes of these surface locations are then validated against the expected values. """ # load the expected data expected_data = TestDataLoader(self.expected_04, delim=' ') # load the input data inputs = TestDataLoader(self.inputs_04, delim=' ') self.initialise_algorithm(inputs) # create all input packet objects isps = [ L1AProcessingData(self.cst, self.chd, i, time_sar_ku=time, lat_sar_sat=inputs["lat_sar_sat"][i], lon_sar_sat=inputs["lon_sar_sat"][i], alt_sar_sat=inputs["alt_sar_sat"][i], win_delay_sar_ku=inputs["win_delay_sar_ku"][i], x_sar_sat=inputs["x_sar_sat"][i], y_sar_sat=inputs["y_sar_sat"][i], z_sar_sat=inputs["z_sar_sat"][i], alt_rate_sat_sar=0, roll_sar=inputs["roll_sar"][i], pitch_sar=inputs["pitch_sar"][i], yaw_sar=inputs["yaw_sar"][i], x_vel_sat_sar=inputs["x_vel_sat_sar"][i], y_vel_sat_sar=inputs["y_vel_sat_sar"][i], z_vel_sat_sar=inputs["z_vel_sat_sar"][i], days=inputs["time_sar_ku"] // self.cst.sec_in_day, seconds=inputs["time_sar_ku"] % self.cst.sec_in_day) \ for i, time in enumerate(inputs["time_sar_ku"]) ] # calculate surface position for each packet for packet in isps: packet.compute_location_sar_surf() surfs = [] # create the prior surface location object for i, time in enumerate(inputs["time_surf"]): surf = SurfaceData( self.cst, self.chd, time_surf=time, x_surf=inputs["x_surf"][i], y_surf=inputs["y_surf"][i], z_surf=inputs["z_surf"][i], lat_surf=inputs["lat_surf"][i], lon_surf=inputs["lon_surf"][i], alt_surf=inputs["alt_surf"][i], x_sat=inputs["x_sat"][i], y_sat=inputs["y_sat"][i], z_sat=inputs["z_sat"][i], lat_sat=inputs["lat_sat"][i], lon_sat=inputs["lon_sat"][i], alt_sat=inputs["alt_sat"][i], x_vel_sat=inputs["x_vel_sat"][i], y_vel_sat=inputs["y_vel_sat"][i], z_vel_sat=inputs["z_vel_sat"][i], focus_target_distance=inputs["focus_target_distance"][i], win_delay_surf=inputs["win_delay_surf"][i] ) surf.compute_surf_sat_vector() surf.compute_angular_azimuth_beam_resolution( inputs["pri_sar_pre_dat"][i] ) surfs.append(surf) # execute the surface location algorithm new_surf = self.surface_location_algorithm(surfs, isps) # confirm new surface has been created self.assertTrue(new_surf, msg="failed to create new surface") # retreive properties of the surface location surf = surfs[1] # validate properties self.assertAlmostEqual(surf.time_surf, expected_data["time_surf"]) self.assertAlmostEqual(surf.x_surf, expected_data["x_surf"], delta=1e-5) self.assertAlmostEqual(surf.y_surf, expected_data["y_surf"], delta=1e-5) self.assertAlmostEqual(surf.z_surf, expected_data["z_surf"], delta=1e-5) self.assertAlmostEqual(surf.lat_surf, expected_data["lat_surf"], delta=1e-12) self.assertAlmostEqual(surf.lon_surf, expected_data["lon_surf"], delta=1e-12) self.assertAlmostEqual(surf.alt_surf, expected_data["alt_surf"], delta=1e-4) self.assertAlmostEqual(surf.win_delay_surf, expected_data["win_delay_surf"])