def test7_ten_degrees_distance(self): surface = self._test1to7surface() sites = Mesh.from_points_list([Point(0, -10), Point(-15, 10)]) dists = surface.get_rx_distance(sites) expected_dists = [1111.9505230826488, -1111.9505230826488] self.assertTrue(numpy.allclose(dists, expected_dists))
class SiteCollectionFilterTestCase(unittest.TestCase): SITES = [ Site(location=Point(10, 20, 30), vs30=1.2, vs30measured=True, z1pt0=3, z2pt5=5, id=0), Site(location=Point(11, 12, 13), vs30=55.4, vs30measured=False, z1pt0=6, z2pt5=8, id=1), Site(location=Point(0, 2, 0), vs30=2, vs30measured=True, z1pt0=9, z2pt5=17, id=2), Site(location=Point(1, 1, 3), vs30=4, vs30measured=False, z1pt0=22, z2pt5=11, id=3) ] def test_filter(self): col = SiteCollection(self.SITES) filtered = col.filter(numpy.array([True, False, True, False])) self.assertIsInstance(filtered, FilteredSiteCollection) arreq = numpy.testing.assert_array_equal arreq(filtered.vs30, [1.2, 2]) arreq(filtered.vs30measured, [True, True]) arreq(filtered.z1pt0, [3, 9]) arreq(filtered.z2pt5, [5, 17]) arreq(filtered.mesh.lons, [10, 0]) arreq(filtered.mesh.lats, [20, 2]) arreq(filtered.sids, [0, 2]) arreq([site.id for site in filtered], [0, 2]) self.assertIs(filtered.mesh.depths, None) filtered = col.filter(numpy.array([False, True, True, True])) self.assertIsInstance(filtered, FilteredSiteCollection) arreq(filtered.vs30, [55.4, 2, 4]) arreq(filtered.vs30measured, [False, True, False]) arreq(filtered.z1pt0, [6, 9, 22]) arreq(filtered.z2pt5, [8, 17, 11]) arreq(filtered.mesh.lons, [11, 0, 1]) arreq(filtered.mesh.lats, [12, 2, 1]) self.assertIs(filtered.mesh.depths, None) def test_filter_all_out(self): col = SiteCollection(self.SITES) filtered = col.filter(numpy.zeros(len(self.SITES), bool)) self.assertIs(filtered, None) def test_filter_all_in(self): col = SiteCollection(self.SITES) filtered = col.filter(numpy.ones(len(self.SITES), bool)) self.assertIs(filtered, col) def test_double_filter(self): col = SiteCollection(self.SITES) filtered = col.filter(numpy.array([True, False, True, True])) filtered2 = filtered.filter(numpy.array([False, True, False])) arreq = numpy.testing.assert_array_equal arreq(filtered2.vs30, [2]) arreq(filtered2.vs30measured, [True]) arreq(filtered2.z1pt0, [9]) arreq(filtered2.z2pt5, [17]) arreq(filtered2.mesh.lons, [0]) arreq(filtered2.mesh.lats, [2]) self.assertIs(filtered2.mesh.depths, None) arreq(filtered.indices, [0, 2, 3]) arreq(filtered2.indices, [2]) filtered2 = filtered.filter(numpy.array([True, False, True])) arreq(filtered2.indices, [0, 3]) def test_expand_2d(self): col = SiteCollection(self.SITES).filter( numpy.array([False, True, False, True])) data_condensed = numpy.array([ [1, 2, 3], [5, 6, 7], ]) data_expanded = col.expand(data_condensed, placeholder=-1) data_expanded_expected = numpy.array([ [-1, -1, -1], [1, 2, 3], [-1, -1, -1], [5, 6, 7], ]) numpy.testing.assert_array_equal(data_expanded, data_expanded_expected) def test_expand_1d(self): col = SiteCollection(self.SITES) col = col.filter(numpy.array([1, 0, 1, 1])) data_condensed = numpy.array([5, 6, 7]) data_expanded = col.expand(data_condensed, placeholder=100) data_expanded_expected = numpy.array([5, 100, 6, 7]) numpy.testing.assert_array_equal(data_expanded, data_expanded_expected) def test_expand_no_filtering(self): col = SiteCollection(self.SITES) data_condensed = numpy.array([3, 2, 1, 0]) data_expanded = col.expand(data_condensed, placeholder=100) data_expanded_expected = data_condensed numpy.testing.assert_array_equal(data_expanded, data_expanded_expected)
def test_build_fault_model(self): ''' Tests the constuction of a fault model with two faults (1 simple, 1 complex) each with two mfd rates - should produce four sources ''' self.model = mtkActiveFaultModel('001', 'A Fault Model', faults=[]) x0 = Point(30., 30., 0.) x1 = x0.point_at(30., 0., 30.) x2 = x1.point_at(30., 0., 60.) # Total length is 60 km trace = Line([x0, x1, x2]) simple_fault = SimpleFaultGeometry(trace, 90., 0., 20.) # Creates a trace ~60 km long made of 3 points upper_edge = Line([x0, x1, x2]) lower_edge = Line([ x0.point_at(40., 20., 130.), x1.point_at(42., 25., 130.), x2.point_at(41., 22., 130.) ]) complex_fault = ComplexFaultGeometry([upper_edge, lower_edge], 2.0) config = [{ 'MFD_spacing': 0.1, 'Maximum_Magnitude': 7.0, 'Maximum_Uncertainty': None, 'Model_Name': 'Characteristic', 'Model_Weight': 0.5, 'Sigma': 0.1, 'Lower_Bound': -1., 'Upper_Bound': 1. }, { 'MFD_spacing': 0.1, 'Maximum_Magnitude': 7.5, 'Maximum_Uncertainty': None, 'Model_Name': 'Characteristic', 'Model_Weight': 0.5, 'Sigma': 0.1, 'Lower_Bound': -1., 'Upper_Bound': 1. }] fault1 = mtkActiveFault('001', 'Simple Fault 1', simple_fault, [(10.0, 1.0)], -90., None, aspect_ratio=1.0, scale_rel=[(WC1994(), 1.0)], shear_modulus=[(30.0, 1.0)], disp_length_ratio=[(1E-5, 1.0)]) fault1.generate_config_set(config) fault2 = mtkActiveFault('002', 'Complex Fault 1', complex_fault, [(10.0, 1.0)], -90., None, aspect_ratio=1.0, scale_rel=[(WC1994(), 1.0)], shear_modulus=[(30.0, 1.0)], disp_length_ratio=[(1E-5, 1.0)]) fault2.generate_config_set(config) self.model.faults = [fault1, fault2] # Generate source model self.model.build_fault_model() self.assertEqual(len(self.model.source_model.sources), 4) # First source should be an instance of a mtkSimpleFaultSource model1 = self.model.source_model.sources[0] self.assertTrue(isinstance(model1, mtkSimpleFaultSource)) self.assertEqual(model1.id, '001_1') self.assertAlmostEqual(model1.mfd.min_mag, 6.9) np.testing.assert_array_almost_equal( np.log10(np.array(model1.mfd.occurrence_rates)), np.array([-2.95320041, -2.54583708, -2.953200413])) # Second source should be an instance of a mtkSimpleFaultSource model2 = self.model.source_model.sources[1] self.assertTrue(isinstance(model2, mtkSimpleFaultSource)) self.assertEqual(model2.id, '001_2') self.assertAlmostEqual(model2.mfd.min_mag, 7.4) np.testing.assert_array_almost_equal( np.log10(np.array(model2.mfd.occurrence_rates)), np.array([-3.70320041, -3.29583708, -3.70320041])) # Third source should be an instance of a mtkComplexFaultSource model3 = self.model.source_model.sources[2] self.assertTrue(isinstance(model3, mtkComplexFaultSource)) self.assertEqual(model3.id, '002_1') self.assertAlmostEqual(model3.mfd.min_mag, 6.9) np.testing.assert_array_almost_equal( np.log10(np.array(model3.mfd.occurrence_rates)), np.array([-2.59033387, -2.18297054, -2.59033387])) # Fourth source should be an instance of a mtkComplexFaultSource model4 = self.model.source_model.sources[3] self.assertTrue(isinstance(model4, mtkComplexFaultSource)) self.assertEqual(model4.id, '002_2') self.assertAlmostEqual(model4.mfd.min_mag, 7.4) np.testing.assert_array_almost_equal( np.log10(np.array(model4.mfd.occurrence_rates)), np.array([-3.34033387, -2.93297054, -3.34033387]))
def test_vertical_planar_surface(self): p1 = Point(0.1, 0.1, 0.0) p2 = Point(0.1, 0.126979648178, 0.0) surface = SimpleFaultSurface.from_fault_data(Line([p1, p2]), 2.0, 4.0, 90.0, 1.0) self.assertAlmostEqual(surface.get_width(), 2.0)
def get_cdppvalue(self, target, buf=1.0, delta=0.01, space=2.): """ Get the directivity prediction value, centred DPP(cdpp) at a given site as described in Spudich et al. (2013), and this cdpp is used in Chiou and Young(2014) GMPE for near-fault directivity term prediction. :param target_site: A mesh object representing the location of the target sites. :param buf: A float vaule presents the buffer distance in km to extend the mesh borders to. :param delta: A float vaule presents the desired distance between two adjacent points in mesh :param space: A float vaule presents the tolerance for the same distance of the sites (default 2 km) :returns: A float value presents the centreed directivity predication value which used in Chioud and Young(2014) GMPE for directivity term """ min_lon, max_lon, max_lat, min_lat = self.surface.get_bounding_box() min_lon -= buf max_lon += buf min_lat -= buf max_lat += buf lons = numpy.arange(min_lon, max_lon + delta, delta) lats = numpy.arange(min_lat, max_lat + delta, delta) lons, lats = numpy.meshgrid(lons, lats) target_rup = self.surface.get_min_distance(target) mesh = RectangularMesh(lons=lons, lats=lats, depths=None) mesh_rup = self.surface.get_min_distance(mesh) target_lons = target.lons target_lats = target.lats cdpp = numpy.empty(len(target_lons)) for iloc, (target_lon, target_lat) in enumerate(zip(target_lons, target_lats)): cdpp_sites_lats = mesh.lats[(mesh_rup <= target_rup[iloc] + space) & (mesh_rup >= target_rup[iloc] - space)] cdpp_sites_lons = mesh.lons[(mesh_rup <= target_rup[iloc] + space) & (mesh_rup >= target_rup[iloc] - space)] dpp_sum = [] dpp_target = self.get_dppvalue(Point(target_lon, target_lat)) for lon, lat in zip(cdpp_sites_lons, cdpp_sites_lats): site = Point(lon, lat, 0.) dpp_one = self.get_dppvalue(site) dpp_sum.append(dpp_one) mean_dpp = numpy.mean(dpp_sum) cdpp[iloc] = dpp_target - mean_dpp return cdpp
def setUp(self): super(MakeContextsTestCase, self).setUp() self.site1_location = Point(1, 2) self.site2_location = Point(-2, -3) self.site1 = Site(vs30=456, vs30measured=False, z1pt0=12.1, z2pt5=15.1, location=self.site1_location) self.site2 = Site(vs30=1456, vs30measured=True, z1pt0=112.1, z2pt5=115.1, location=self.site2_location) min_distance = numpy.array([10, 11]) rx_distance = numpy.array([4, 5]) jb_distance = numpy.array([6, 7]) ry0_distance = numpy.array([8, 9]) azimuth = numpy.array([12, 34]) top_edge_depth = 30 width = 15 strike = 60.123 class FakeSurface(object): call_counts = collections.Counter() def get_azimuth(self, mesh): self.call_counts['get_azimuth'] += 1 return azimuth def get_strike(self): self.call_counts['get_strike'] += 1 return strike def get_dip(self): self.call_counts['get_dip'] += 1 return 45.4545 def get_min_distance(fake_surface, mesh): self.assertIsInstance(mesh, Mesh) [point1, point2] = mesh self.assertEqual(point1, self.site1_location) self.assertEqual(point2, self.site2_location) fake_surface.call_counts['get_min_distance'] += 1 return min_distance def get_rx_distance(fake_surface, mesh): self.assertIsInstance(mesh, Mesh) [point1, point2] = mesh self.assertEqual(point1, self.site1_location) self.assertEqual(point2, self.site2_location) fake_surface.call_counts['get_rx_distance'] += 1 return rx_distance def get_ry0_distance(fake_surface, mesh): self.assertIsInstance(mesh, Mesh) [point1, point2] = mesh self.assertEqual(point1, self.site1_location) self.assertEqual(point2, self.site2_location) fake_surface.call_counts['get_ry0_distance'] += 1 return ry0_distance def get_joyner_boore_distance(fake_surface, mesh): self.assertIsInstance(mesh, Mesh) [point1, point2] = mesh self.assertEqual(point1, self.site1_location) self.assertEqual(point2, self.site2_location) fake_surface.call_counts['get_joyner_boore_distance'] += 1 return jb_distance def get_top_edge_depth(fake_surface): fake_surface.call_counts['get_top_edge_depth'] += 1 return top_edge_depth def get_width(fake_surface): fake_surface.call_counts['get_width'] += 1 return width self.rupture_hypocenter = Point(2, 3, 40) self.rupture = BaseRupture( mag=123.45, rake=123.56, tectonic_region_type=const.TRT.VOLCANIC, hypocenter=self.rupture_hypocenter, surface=FakeSurface(), source_typology=object() ) self.gsim_class.DEFINED_FOR_TECTONIC_REGION_TYPE = const.TRT.VOLCANIC self.fake_surface = FakeSurface
def test_get_strike_along_meridian(self): line = Line([Point(0, 0), Point(1e-5, 1e-3), Point(0, 2e-3)]) surface = SimpleFaultSurface.from_fault_data(line, 1.0, 6.0, 89.9, 0.1) self.assertAlmostEquals(0, surface.get_strike(), delta=6e-2)
def test1_site_on_the_edges(self): surface = self._test_rectangular_surface() sites = Mesh.from_points_list([Point(0.0, 0.05), Point(0.0, -0.05)]) dists = surface.get_ry0_distance(sites) expected_dists = [0, 0] numpy.testing.assert_allclose(dists, expected_dists)
def test2_site_on_the_foot_wall(self): surface = self._test1to7surface() sites = Mesh.from_points_list([Point(0.05, -0.05), Point(-140, -0.05)]) dists = surface.get_rx_distance(sites) expected_dists = [-5.559752615413244] * 2 numpy.testing.assert_allclose(dists, expected_dists, rtol=.01)
# Get parameters based on domain # loop through domains and find point in poly for neo_dom, mmax, dom_shape in zip(neo_doms, dom_mmax, dom_shapes): dom_poly = Polygon(dom_shape.points) # check if leonard centroid in domains poly if shapely_pt.within(dom_poly): tmp_dom = neo_dom max_mag = mmax for zone_trt, zone_dep, l_shape in zip(ltrt, ldep, l08_shapes): l_poly = Polygon(l_shape.points) if shapely_pt.within(l_poly): trt = zone_trt depth = zone_dep # print max_mag, trt, depth point = Point(lons[j], lats[j], depth) # Openquake geometry Point mfd = TruncatedGRMFD(min_mag, max_mag, 0.1, a_vals[j], b_vals[j]) hypo_depth_dist = PMF([(1.0, depth)]) nodal_plane_dist = PMF([(0.3, NodalPlane(0, 30, 90)), (0.2, NodalPlane(90, 30, 90)), (0.3, NodalPlane(180, 30, 90)), (0.2, NodalPlane(270, 30, 90))]) point_source = mtkPointSource(identifier, name, geometry=point, mfd=mfd, mag_scale_rel='Leonard2014_SCR', rupt_aspect_ratio=1.0, upper_depth=0.1, lower_depth=20.0, trt=trt,
def test_point_outside(self): corners = [[(0.1, -0.1, 1), (-0.1, -0.1, 1)], [(0.1, 0.1, 2), (-0.1, 0.1, 2)]] surface = DummySurface(corners) sites = Mesh.from_points_list([ Point(-0.2, -0.2), Point(1, 1, 1), Point(4, 5), Point(8, 10.4), Point(0.05, 0.15, 10) ]) dists = surface.get_joyner_boore_distance(sites) expected_dists = [ Point(-0.2, -0.2).distance(Point(-0.1, -0.1)), Point(1, 1).distance(Point(0.1, 0.1)), Point(4, 5).distance(Point(0.1, 0.1)), Point(8, 10.4).distance(Point(0.1, 0.1)), Point(0.05, 0.15).distance(Point(0.05, 0.1)) ] numpy.testing.assert_allclose(dists, expected_dists, rtol=0.01)
def test_several_sites(self): surface = DummySurface(test_data.TEST_7_RUPTURE_2_MESH) sites = Mesh.from_points_list([Point(0, 0), Point(-0.3, 0.4)]) dists = surface.get_min_distance(sites) expected_dists = [7.01186304977, 55.6159556] self.assertTrue(numpy.allclose(dists, expected_dists))
def test_1(self): surface = DummySurface(test_data.TEST_7_RUPTURE_6_MESH) sites = Mesh.from_points_list([Point(0, 0)]) self.assertAlmostEqual(8.01185807319, surface.get_min_distance(sites)[0])
def _create_mesh(self): points = [[Point(*coordinates) for coordinates in row] for row in self.coordinates_list] return RectangularMesh.from_points_list(points)
def test_4(self): surface = DummySurface(_planar_test_data.TEST_7_RUPTURE_2_MESH) sites = Mesh.from_points_list([Point(-0.3, 0.4)]) self.assertAlmostEqual(55.58568426746, surface.get_min_distance(sites)[0], places=4)
def test3_site_on_centroid(self): surface = self._test1to7surface() sites = Mesh.from_points_list([Point(0.05, 0)]) self.assertAlmostEqual(surface.get_rx_distance(sites)[0], 0)
def test_several_sites(self): surface = DummySurface(_planar_test_data.TEST_7_RUPTURE_2_MESH) sites = Mesh.from_points_list([Point(0, 0), Point(-0.3, 0.4)]) dists = surface.get_min_distance(sites) expected_dists = [7.01186301, 55.58568427] numpy.testing.assert_allclose(dists, expected_dists)
def test6_one_degree_distance(self): surface = self._test1to7surface() sites = Mesh.from_points_list([Point(0.05, -1), Point(20, 1)]) dists = surface.get_rx_distance(sites) expected_dists = [-111.19505230826488, +111.19505230826488] numpy.testing.assert_allclose(dists, expected_dists, rtol=.01)
min_mag = 4.5 max_mag = 7.2 #bval = 1.0 # just define as 1 for time being # Read in data again to solve number fomatting issue in smoother.data # For some reason it just returns 0 for all a values data = np.genfromtxt(smoother_filename, delimiter=',', skip_header=1) #print max(data[:,4]) #print data[:,4] #print len(data[:,4]) tom = PoissonTOM(50) # Dummy temporal occurence model for building pt sources msr = Leonard2014_SCR() for j in range(len(data[:, 2])): # print smoother.data[j,:] identifier = 'ASS' + str(j) name = 'Helmstetter' + str(j) point = Point(data[j, 0], data[j, 1], 10) rate = data[j, 2] # Convert rate to a value?? #aval = rate aval = np.log10(rate) + bvalue * config["mmin"] #print rate, aval mfd = TruncatedGRMFD(min_mag, max_mag, 0.1, aval, bvalue) hypo_depth_dist = PMF([(0.5, 10.0), (0.25, 5.0), (0.25, 15.0)]) nodal_plane_dist = PMF([(0.3, NodalPlane(0, 30, 90)), (0.2, NodalPlane(90, 30, 90)), (0.3, NodalPlane(180, 30, 90)), (0.2, NodalPlane(270, 30, 90))]) point_source = PointSource(identifier, name, 'Non_cratonic', mfd, 2, msr, 2.0, tom, 0.1, 20.0, point, nodal_plane_dist, hypo_depth_dist) # upper_depth = 0.1, lower_depth = 20.0,
def test7_ten_degrees_distance(self): surface = self._test1to7surface() sites = Mesh.from_points_list([Point(0, -10), Point(-15, 10)]) dists = surface.get_rx_distance(sites) expected_dists = [-1111.9505230826488, +1111.9505230826488] numpy.testing.assert_allclose(dists, expected_dists, rtol=.01)
def setUp(self): self.fault_trace = Line([Point(0.0, 0.0), Point(1.0, 1.0)])
def __init__(self, coordinates_list): points = [[Point(*coordinates) for coordinates in row] for row in coordinates_list] self.mesh = RectangularMesh.from_points_list(points)
def test_fault_trace_on_surface(self): fault_trace = Line([Point(0.0, 0.0, 1.0), Point(1.0, 1.0, 0.0)]) self.assertRaises(ValueError, SimpleFaultSurface.check_fault_data, fault_trace, 0.0, 1.0, 90.0, 1.0)
def test_get_middle_point(self): corners = [[(0.0, 0.0, 0.0), (0.0, 0.089932, 0.0)], [(0.0, 0.0, 10.0), (0.0, 0.089932, 10.0)]] surface = DummySurface(corners) self.assertTrue( Point(0.0, 0.044966, 5.0) == surface.get_middle_point())
def test_one_point_in_an_edge(self): edges = [Line([Point(0, 0), Point(0, 1)]), Line([Point(0, 0, 1), Point(0, 1, 1)]), Line([Point(0, 0, 2)])] self.assertRaises(ValueError, ComplexFaultSurface.from_fault_data, edges, mesh_spacing=1)
def test_2(self): surface = DummySurface(_planar_test_data.TEST_7_RUPTURE_6_MESH) sites = Mesh.from_points_list([Point(-0.25, 0.25)]) self.assertAlmostEqual(40.09707543926, surface.get_min_distance(sites)[0], places=4)
def test_dumps_and_loads(self): point = Point(1, 2, 3) site1 = Site(point, 760.0, True, 100.0, 5.0) site2 = pickle.loads(pickle.dumps(site1)) self.assertEqual(site1, site2)
def test_3(self): surface = DummySurface(_planar_test_data.TEST_7_RUPTURE_2_MESH) sites = Mesh.from_points_list([Point(0, 0)]) self.assertAlmostEqual(7.01186304977, surface.get_min_distance(sites)[0])
def _parse_distance_data(self, event, site, metadata): """ Read in the distance related metadata and return an instance of the :class: smtk.sm_database.RecordDistance """ # Compute various distance metrics # Add calculation of Repi, Rhypo from event and station localizations # (latitudes, longitudes, depth, elevation)? target_site = Mesh(np.array([site.longitude]), np.array([site.latitude]), np.array([-site.altitude / 1000.0])) # Warning ratio fixed to 1.5 ratio=1.5 surface_modeled = rcfg.create_planar_surface( Point(event.longitude, event.latitude, event.depth), event.mechanism.nodal_planes.nodal_plane_1['strike'], event.mechanism.nodal_planes.nodal_plane_1['dip'], event.rupture.area, ratio) hypocenter = rcfg.get_hypocentre_on_planar_surface( surface_modeled, event.rupture.hypo_loc) try: surface_modeled._create_mesh() except: dip = surface_modeled.get_dip() dip_dir = (surface_modeled.get_strike() - 90.) % 360. ztor = surface_modeled.top_left.depth d_x = ztor * np.tan(np.radians(90.0 - dip)) top_left_surface = surface_modeled.top_left.point_at(d_x, -ztor, dip_dir) top_left_surface.depth = 0. top_right_surface = surface_modeled.top_right.point_at(d_x, -ztor, dip_dir) top_right_surface.depth = 0. surface_modeled = SimpleFaultSurface.from_fault_data( Line([top_left_surface, top_right_surface]), surface_modeled.top_left.depth, surface_modeled.bottom_left.depth, surface_modeled.get_dip(), 1.0) # Rhypo Rhypo = get_float(metadata["Hypocentral Distance (km)"]) if Rhypo is None: Rhypo = hypocenter.distance_to_mesh(target_site) # Repi Repi = get_float(metadata["Epicentral Distance (km)"]) if Repi is None: Repi= hypocenter.distance_to_mesh(target_site, with_depths=False) # Rrup Rrup = get_float(metadata["Rupture Distance (km)"]) if Rrup is None: Rrup = surface_modeled.get_min_distance(target_site) # Rjb Rjb = get_float(metadata["Joyner-Boore Distance (km)"]) if Rjb is None: Rjb = surface_modeled.get_joyner_boore_distance(target_site) # Need to check if Rx and Ry0 are consistant with the other metrics # when those are coming from the flatfile? # Rx Rx = surface_modeled.get_rx_distance(target_site) # Ry0 Ry0 = surface_modeled.get_ry0_distance(target_site) distance = RecordDistance( repi = float(Repi), rhypo = float(Rhypo), rjb = float(Rjb), rrup = float(Rrup), r_x = float(Rx), ry0 = float(Ry0)) distance.azimuth = get_float(metadata["Source to Site Azimuth (deg)"]) #distance.hanging_wall = get_float(metadata["FW/HW Indicator"]) if metadata["FW/HW Indicator"] == "HW": distance.hanging_wall = True elif metadata["FW/HW Indicator"] == "FW": distance.hanging_wall = False else: pass return distance
def test6_one_degree_distance(self): surface = self._test1to7surface() sites = Mesh.from_points_list([Point(0.05, -1), Point(20, 1)]) dists = surface.get_rx_distance(sites) expected_dists = [111.19505230826488, -111.19505230826488] self.assertTrue(numpy.allclose(dists, expected_dists))