def test_io_dpred(self): pp_data = Data(survey=self.pp_survey, dobs=self.dobs) dpdp_data = Data(survey=self.dpdp_survey, dobs=self.dobs) filename = "dpred.dc" # Test for pole-pole write_dcip3d_ubc( filename, pp_data, "secondary_potential", "dpred", format_type="general" ) data_loaded = read_dcip3d_ubc(filename, "secondary_potential") os.remove(filename) A = np.c_[ self.pp_survey.locations_a, self.pp_survey.locations_b, self.pp_survey.locations_m, self.pp_survey.locations_n, self.dobs, ] B = np.c_[ data_loaded.survey.locations_a, data_loaded.survey.locations_b, data_loaded.survey.locations_m, data_loaded.survey.locations_n, data_loaded.dobs, ] passed = np.all(np.isclose(A, B)) self.assertTrue(passed, True) # Test for dipole-dipole write_dcipoctree_ubc( filename, dpdp_data, "volt", "dpred", format_type="general" ) data_loaded = read_dcipoctree_ubc(filename, "volt") os.remove(filename) A = np.c_[ self.dpdp_survey.locations_a, self.dpdp_survey.locations_b, self.dpdp_survey.locations_m, self.dpdp_survey.locations_n, self.dobs, ] B = np.c_[ data_loaded.survey.locations_a, data_loaded.survey.locations_b, data_loaded.survey.locations_m, data_loaded.survey.locations_n, data_loaded.dobs, ] passed = np.all(np.isclose(A, B)) self.assertTrue(passed, True) print("PREDICTED DATA FILE IO FOR DCIP3D PASSED")
def test_io_dobs(self): pp_data = Data(survey=self.pp_survey, dobs=self.dobs, standard_deviation=self.std) dpdp_data = Data(survey=self.dpdp_survey, dobs=self.dobs, standard_deviation=self.std) filename = "dobs.dc" # Test for pole-pole write_dcip3d_ubc(filename, pp_data, "secondary_potential", "dobs", format_type="general") data_loaded = read_dcip3d_ubc(filename, "secondary_potential") os.remove(filename) A = np.c_[self.pp_survey.a_locations, self.pp_survey.b_locations, self.pp_survey.m_locations, self.pp_survey.n_locations, self.dobs, self.std, ] B = np.c_[data_loaded.survey.a_locations, data_loaded.survey.b_locations, data_loaded.survey.m_locations, data_loaded.survey.n_locations, data_loaded.dobs, data_loaded.standard_deviation, ] passed = np.all(np.isclose(A, B)) self.assertTrue(passed, True) # Test for dipole-dipole write_dcipoctree_ubc(filename, dpdp_data, "volt", "dobs", format_type="general") data_loaded = read_dcipoctree_ubc(filename, "volt") os.remove(filename) A = np.c_[self.dpdp_survey.a_locations, self.dpdp_survey.b_locations, self.dpdp_survey.m_locations, self.dpdp_survey.n_locations, self.dobs, self.std, ] B = np.c_[data_loaded.survey.a_locations, data_loaded.survey.b_locations, data_loaded.survey.m_locations, data_loaded.survey.n_locations, data_loaded.dobs, data_loaded.standard_deviation, ] passed = np.all(np.isclose(A, B)) self.assertTrue(passed, True) print("OBSERVATIONS FILE IO FOR DCIP3D PASSED")
def test_io_survey(self): pp_data = Data(survey=self.pp_survey) dpdp_data = Data(survey=self.dpdp_survey) filename = "survey.dc" # Test for pole-pole write_dcip3d_ubc(filename, pp_data, "secondary_potential", "survey", format_type="general") data_loaded = read_dcip3d_ubc(filename, "secondary_potential") os.remove(filename) A = np.c_[self.pp_survey.a_locations, self.pp_survey.b_locations, self.pp_survey.m_locations, self.pp_survey.n_locations, ] B = np.c_[data_loaded.survey.a_locations, data_loaded.survey.b_locations, data_loaded.survey.m_locations, data_loaded.survey.n_locations, ] passed = np.all(np.isclose(A, B)) self.assertTrue(passed, True) # Test for dipole-dipole write_dcipoctree_ubc(filename, dpdp_data, "volt", "survey", format_type="general") data_loaded = read_dcipoctree_ubc(filename, "volt") os.remove(filename) A = np.c_[self.dpdp_survey.a_locations, self.dpdp_survey.b_locations, self.dpdp_survey.m_locations, self.dpdp_survey.n_locations, ] B = np.c_[data_loaded.survey.a_locations, data_loaded.survey.b_locations, data_loaded.survey.m_locations, data_loaded.survey.n_locations, ] passed = np.all(np.isclose(A, B)) self.assertTrue(passed, True) print("SURVEY FILE IO FOR DCIP3D PASSED")