Exemple #1
0
    def test_get_area1(self):
        pntsa = npoints_towards(lon=0.32,
                                lat=0.0,
                                depth=0.0,
                                azimuth=45,
                                hdist=10.0,
                                vdist=0.0,
                                npoints=2)
        pntsb = npoints_towards(lon=pntsa[0][1],
                                lat=pntsa[1][1],
                                depth=pntsa[2][1],
                                azimuth=45 + 90,
                                hdist=10.0,
                                vdist=10.0,
                                npoints=2)
        pntsc = npoints_towards(lon=0.32,
                                lat=0.0,
                                depth=0.0,
                                azimuth=45 + 90,
                                hdist=10.0,
                                vdist=10.0,
                                npoints=2)
        tmp = Point(pntsc[0][1], pntsc[1][1], pntsc[2][1])
        prf3 = Line([Point(0.32, 0, 0), tmp])
        tmp1 = Point(pntsa[0][1], pntsa[1][1], pntsa[2][1])
        tmp2 = Point(pntsb[0][1], pntsb[1][1], pntsb[2][1])
        prf4 = Line([tmp1, tmp2])
        sfcb = KiteSurface.from_profiles([prf3, prf4], 0.2, 0.2)

        computed = sfcb.get_area()
        expected = 10.0 * 14.14
        msg = 'Multi fault surface: area is wrong'
        aae(expected, computed, decimal=-1, err_msg=msg)
Exemple #2
0
 def setUp(self):
     # First surface - Almost vertical dipping to south
     prf1 = Line([Point(0, 0, 0), Point(0, -0.00001, 20.)])
     prf2 = Line([Point(0.15, 0, 0), Point(0.15, -0.00001, 20.)])
     prf3 = Line([Point(0.3, 0, 0), Point(0.3, -0.00001, 20.)])
     sfca = KiteSurface.from_profiles([prf1, prf2, prf3], 1., 1.)
     self.msrf = MultiSurface([sfca])
Exemple #3
0
    def setUp(self):
        path = os.path.join(BASE_DATA_PATH, 'profiles08')

        hsmpl = 2
        vsmpl = 2
        idl = False
        alg = False

        # Read the profiles with prefix cs_50. These profiles dip toward
        # north
        prf, _ = _read_profiles(path, 'cs_50')
        srfc50 = KiteSurface.from_profiles(prf, vsmpl, hsmpl, idl, alg)

        # Read the profiles with prefix cs_52. These profiles dip toward
        # north. This section is west to the section defined by cs_50
        prf, _ = _read_profiles(path, 'cs_51')
        srfc51 = KiteSurface.from_profiles(prf, vsmpl, hsmpl, idl, alg)

        clo = []
        cla = []
        step = 0.01
        for lo in np.arange(-71.8, -69, step):
            tlo = []
            tla = []
            for la in np.arange(19.25, 20.25, step):
                tlo.append(lo)
                tla.append(la)
            clo.append(tlo)
            cla.append(tla)
        self.clo = np.array(clo)
        self.cla = np.array(cla)
        mesh = Mesh(lons=self.clo.flatten(), lats=self.cla.flatten())

        # Define multisurface and mesh of sites
        self.srfc50 = srfc50
        self.srfc51 = srfc51

        self.msrf = MultiSurface([srfc50, srfc51])
        self.mesh = mesh

        self.los = [
            self.msrf.surfaces[0].mesh.lons, self.msrf.surfaces[1].mesh.lons
        ]
        self.las = [
            self.msrf.surfaces[0].mesh.lats, self.msrf.surfaces[1].mesh.lats
        ]
Exemple #4
0
    def setUp(self):

        # First surface
        prf1 = Line([Point(0, 0, 0), Point(0, -0.001, 20.)])
        prf2 = Line([Point(0.15, 0, 0), Point(0.15, -0.001, 20.)])
        prf3 = Line([Point(0.3, 0, 0), Point(0.3, -0.001, 20.)])
        sfcA = KiteSurface.from_profiles([prf1, prf2, prf3], 5., 5.)

        # Second surface
        prf3 = Line([Point(0.32, 0, 0), Point(0.32, 0.001, 20.)])
        prf4 = Line([Point(0.45, 0.15, 0), Point(0.45, 0.1501, 20.)])
        sfcB = KiteSurface.from_profiles([prf3, prf4], 5., 5.)

        self.msrf = MultiSurface([sfcA, sfcB])

        coo = np.array([[-0.1, 0.0], [0.0, 0.1]])
        self.mesh = Mesh(coo[:, 0], coo[:, 1])
Exemple #5
0
 def surface(self) -> KiteSurface:
     """
     :returns:
         The surface of the fault
     """
     # Get the surface of the fault
     # TODO we must automate the definition of the idl parameter
     return KiteSurface.from_profiles(self.profiles,
                                      self.profiles_sampling,
                                      self.rupture_mesh_spacing,
                                      idl=False, align=False)
Exemple #6
0
    def setUp(self):

        # First surface - Almost vertical dipping to south
        prf1 = Line([Point(0, 0, 0), Point(0, -0.00001, 20.)])
        prf2 = Line([Point(0.15, 0, 0), Point(0.15, -0.00001, 20.)])
        prf3 = Line([Point(0.3, 0, 0), Point(0.3, -0.00001, 20.)])
        sfca = KiteSurface.from_profiles([prf1, prf2, prf3], 1., 1.)

        # Second surface - Strike to NE and dip to SE
        pntsa = npoints_towards(lon=0.32,
                                lat=0.0,
                                depth=0.0,
                                azimuth=45,
                                hdist=10.0,
                                vdist=0.0,
                                npoints=2)
        pntsb = npoints_towards(lon=pntsa[0][1],
                                lat=pntsa[1][1],
                                depth=pntsa[2][1],
                                azimuth=45 + 90,
                                hdist=10.0,
                                vdist=10.0,
                                npoints=2)
        pntsc = npoints_towards(lon=0.32,
                                lat=0.0,
                                depth=0.0,
                                azimuth=45 + 90,
                                hdist=10.0,
                                vdist=10.0,
                                npoints=2)
        tmp = Point(pntsc[0][1], pntsc[1][1], pntsc[2][1])
        prf3 = Line([Point(0.32, 0, 0), tmp])
        tmp1 = Point(pntsa[0][1], pntsa[1][1], pntsa[2][1])
        tmp2 = Point(pntsb[0][1], pntsb[1][1], pntsb[2][1])
        prf4 = Line([tmp1, tmp2])
        sfcb = KiteSurface.from_profiles([prf3, prf4], 0.2, 0.2)

        # Create surface and mesh needed for the test
        self.msrf = MultiSurface([sfca, sfcb])
        self.coo = np.array([[-0.1, 0.0], [0.0, 0.1]])
        self.mesh = Mesh(self.coo[:, 0], self.coo[:, 1])
Exemple #7
0
    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
Exemple #8
0
 def test_rx_kite(self):
     spc = 2.0
     pro1 = Line([Point(0.2, 0.0, 0.0), Point(0.2, 0.05, 15.0)])
     pro2 = Line([Point(0.0, 0.0, 0.0), Point(0.0, 0.05, 15.0)])
     sfc1 = KiteSurface.from_profiles([pro1, pro2], spc, spc)
     msurf = MultiSurface([sfc1])
     pcoo = numpy.array([[0.2, 0.1], [0.0, -0.1]])
     mesh = Mesh(pcoo[:, 0], pcoo[:, 1])
     # Compute expected distances
     lo = pro1.points[0].longitude
     la = pro1.points[0].longitude
     tmp0 = geodetic_distance(lo, la, pcoo[0, 0], pcoo[0, 1])
     lo = pro2.points[0].longitude
     la = pro2.points[0].longitude
     tmp1 = geodetic_distance(lo, la, pcoo[1, 0], pcoo[1, 1])
     # Checking
     rx = msurf.get_rx_distance(mesh)
     expected = numpy.array([tmp0, -tmp1])
     numpy.testing.assert_almost_equal(expected, rx, decimal=5)