class MultiSurfaceWithNaNsTestCase(unittest.TestCase): def setUp(self): path = os.path.join(BASE_DATA_PATH, 'profiles08') hsmpl = 5 vsmpl = 5 idl = False alg = False prf, _ = _read_profiles(path, 'cs_50') srfc50 = KiteSurface.from_profiles(prf, vsmpl, hsmpl, idl, alg) prf, _ = _read_profiles(path, 'cs_51') srfc51 = KiteSurface.from_profiles(prf, vsmpl, hsmpl, idl, alg) coo = [] step = 0.5 for lo in np.arange(-74, -68, step): for la in np.arange(17, 20, step): coo.append([lo, la]) coo = np.array(coo) mesh = Mesh(coo[:, 0], coo[:, 1]) # Define multisurface and mesh of sites self.msrf = MultiSurface([srfc50, srfc51]) self.mesh = mesh def test_get_edge_set(self): expected = [np.array([[-70.33338023, 19.7128312, 18.75134376], [-70.38083767, 19.71732142, 18.7242976], [-70.42829775, 19.72179906, 18.69725144], [-70.47576048, 19.72626415, 18.67020527], [-70.52322584, 19.73071666, 18.64315911], [-70.57069383, 19.7351566, 18.61611295]]), np.array([[-70.14923984, 19.73051498, 18.96965629], [-70.19675982, 19.72669428, 18.88126907], [-70.24427754, 19.72286097, 18.79288186], [-70.29179300, 19.71901507, 18.70449464], [-70.33930617, 19.71515658, 18.61610742]])] # Note that method is executed when the object is initialized ess = self.msrf.edge_set for es, expct in zip(ess, expected): np.testing.assert_array_almost_equal(es, expct) # TODO def test_get_cartesian_edge_set(self): es = self.msrf._get_cartesian_edge_set() # TODO def test_get_strike(self): strike = self.msrf.get_strike() # TODO def test_get_dip(self): dip = self.msrf.get_dip() expected = 69.57436082462769 msg = 'Multi fault surface: dip is wrong' aae(dip, expected, err_msg=msg) # TODO def test_get_width(self): width = self.msrf.get_width() print(width) # TODO def test_get_area(self): area = self.msrf.get_area() # TODO def test_get_bounding_box(self): bb = self.msrf.get_bounding_box() # TODO def test_get_middle_point(self): midp = self.msrf.get_middle_point() # TODO remove NaNs def test_get_surface_boundaries(self): bnd = self.msrf.get_surface_boundaries() # TODO test the updated attributes def test_setup_gc2_framework(self): gc2f = self.msrf._setup_gc2_framework() # TODO def test_get_gc2_coordinates_for_rupture(self): es = self.msrf._get_cartesian_edge_set() gc2c = self.msrf._get_gc2_coordinates_for_rupture(es) # TODO def test_get_generalised_coordinates(self): gcoo = self.msrf.get_generalised_coordinates(self.mesh.lons, self.mesh.lats) # TODO fix the error def test_get_rx(self): dsts = self.msrf.get_rx_distance(self.mesh) # TODO fix the error def test_get_ry0(self): dsts = self.msrf.get_ry0_distance(self.mesh)
class MultiSurfaceWithNaNsTestCase(unittest.TestCase): def setUp(self): path = os.path.join(BASE_DATA_PATH, 'profiles08') hsmpl = 5 vsmpl = 5 idl = False alg = False prf, _ = _read_profiles(path, 'cs_50') srfc50 = KiteSurface.from_profiles(prf, vsmpl, hsmpl, idl, alg) prf, _ = _read_profiles(path, 'cs_51') srfc51 = KiteSurface.from_profiles(prf, vsmpl, hsmpl, idl, alg) coo = [] step = 0.5 for lo in np.arange(-74, -68, step): for la in np.arange(17, 20, step): coo.append([lo, la]) coo = np.array(coo) mesh = Mesh(coo[:, 0], coo[:, 1]) # Define multisurface and mesh of sites self.msrf = MultiSurface([srfc50, srfc51]) self.mesh = mesh def test_get_edge_set(self): expected = [ np.array([[-70.33365959, 19.71037733, 18.85108915], [-70.38106033, 19.71535823, 18.804094], [-70.42846401, 19.72032659, 18.75709885], [-70.47587061, 19.72528241, 18.7101037], [-70.52328014, 19.73022569, 18.66310854], [-70.57069257, 19.73515644, 18.61611339]]), np.array([[-70.14910201, 19.7287277, 19.03202724], [-70.19665637, 19.7253538, 18.9280474], [-70.24420873, 19.72196728, 18.82406756], [-70.29175909, 19.71856815, 18.72008771], [-70.33930743, 19.71515642, 18.61610787]]) ] # Note that method is executed when the object is initialized ess = self.msrf.edge_set for es, expct in zip(ess, expected): np.testing.assert_array_almost_equal(es, expct, decimal=2) # TODO def test_get_cartesian_edge_set(self): es = self.msrf._get_cartesian_edge_set() # TODO def test_get_strike(self): strike = self.msrf.get_strike() def test_get_dip(self): dip = self.msrf.get_dip() expected = 69.93 msg = 'Multi fault surface: dip is wrong' aae(dip, expected, err_msg=msg, decimal=2) # TODO def test_get_width(self): width = self.msrf.get_width() # TODO def test_get_area(self): area = self.msrf.get_area() # TODO def test_get_bounding_box(self): bb = self.msrf.get_bounding_box() # TODO def test_get_middle_point(self): midp = self.msrf.get_middle_point() # TODO remove NaNs def test_get_surface_boundaries(self): bnd = self.msrf.get_surface_boundaries() # TODO test the updated attributes def test_setup_gc2_framework(self): gc2f = self.msrf._setup_gc2_framework() # TODO def test_get_gc2_coordinates_for_rupture(self): es = self.msrf._get_cartesian_edge_set() gc2c = self.msrf._get_gc2_coordinates_for_rupture(es) # TODO def test_get_generalised_coordinates(self): gcoo = self.msrf.get_generalised_coordinates(self.mesh.lons, self.mesh.lats) # TODO fix the error def test_get_rx(self): dsts = self.msrf.get_rx_distance(self.mesh) # TODO fix the error def test_get_ry0(self): dsts = self.msrf.get_ry0_distance(self.mesh)