Exemple #1
0
    def test_get_discretized(self):
        """
        """
        x1, y1, x2, y2, ud, ld, dip = 0, 0, 100, 0, 10, 30, 90
        ss = SimpleSurface(x1, y1, x2, y2, ud, ld, dip)

        dss = ss.get_discretized(shape=(20, 50))
        self.assertEqual(dss.shape, (20, 50))
        self.assertEqual(dss.spacing, (1, 2))
Exemple #2
0
    def test_plot_simple_surfaces(self):
        """
        """
        upper_depth, lower_depth, dip = 0, 10, 45

        p1 = (-5, +10)
        p2 = (+5, +10)
        p3 = (+10, +5)
        p4 = (+10, -5)
        p5 = (+5, -10)
        p6 = (-5, -10)
        p7 = (-10, -5)
        p8 = (-10, +5)

        s1 = SimpleSurface(*p1, *p2, upper_depth, lower_depth, dip)
        s2 = SimpleSurface(*p2, *p3, upper_depth, lower_depth, dip)
        s3 = SimpleSurface(*p3, *p4, upper_depth, lower_depth, dip)
        s4 = SimpleSurface(*p4, *p5, upper_depth, lower_depth, dip)
        s5 = SimpleSurface(*p5, *p6, upper_depth, lower_depth, dip)
        s6 = SimpleSurface(*p6, *p7, upper_depth, lower_depth, dip)
        s7 = SimpleSurface(*p7, *p8, upper_depth, lower_depth, dip)
        s8 = SimpleSurface(*p8, *p1, upper_depth, lower_depth, dip)

        fs = os.path.join(OUTPUT_DIR, 'earth.flat.plot_simple_surfaces.png')

        plot_simple_surfaces([s1, s2, s3, s4, s5, s6, s7, s8], filespec=fs)
Exemple #3
0
    def test_ad_vector(self):
        """
        """
        ss = SimpleSurface(0, 0, 10, 0, 5, 25, 45)
        adv = ss.ad_vector
        self.assertEqual(adv.x, 0)
        self.assertEqual(round(adv.y, PRECISION), 20)
        self.assertEqual(round(adv.z, PRECISION), 20)

        ss = SimpleSurface(0, 0, 0, -10, 5, 25, 45)
        adv = ss.ad_vector
        self.assertEqual(round(adv.x, PRECISION), 20)
        self.assertEqual(adv.y, 0)
        self.assertEqual(round(adv.z, PRECISION), 20)
Exemple #4
0
    def test_as_vector(self):
        """
        """
        ss = SimpleSurface(0, 0, 10, 0, 5, 25, 45)
        asv = ss.as_vector
        self.assertEqual(asv.x, 10)
        self.assertEqual(asv.y, 0)
        self.assertEqual(asv.z, 0)

        ss = SimpleSurface(0, 0, 0, -10, 5, 25, 45)
        asv = ss.as_vector
        self.assertEqual(asv.x, 0)
        self.assertEqual(asv.y, -10)
        self.assertEqual(asv.z, 0)
Exemple #5
0
    def test_strike(self):
        """
        """
        ss = SimpleSurface(0, 0, +1, 0, 0, 1, 45)
        self.assertEqual(ss.strike, 0)

        ss = SimpleSurface(0, 0, +1, +1, 0, 1, 45)
        self.assertEqual(ss.strike, 45)

        ss = SimpleSurface(0, 0, 0, +1, 0, 1, 45)
        self.assertEqual(ss.strike, 90)

        ss = SimpleSurface(0, 0, -1, +1, 0, 1, 45)
        self.assertEqual(ss.strike, 135)

        ss = SimpleSurface(0, 0, -1, 0, 0, 1, 45)
        self.assertEqual(ss.strike, 180)

        ss = SimpleSurface(0, 0, -1, -1, 0, 1, 45)
        self.assertEqual(ss.strike, 225)

        ss = SimpleSurface(0, 0, 0, -1, 0, 1, 45)
        self.assertEqual(ss.strike, 270)

        ss = SimpleSurface(0, 0, +1, -1, 0, 1, 45)
        self.assertEqual(ss.strike, 315)
Exemple #6
0
 def test___contains__(self):
     """
     """
     x1, y1, x2, y2, ud, ld, dip = 0, 0, 10, 10, 10, 30, 45
     ss = SimpleSurface(x1, y1, x2, y2, ud, ld, dip)
     self.assertTrue(ss.lrc in ss)
     self.assertFalse((0, 0, 0) in ss)
Exemple #7
0
 def test_plane(self):
     """
     """
     x1, y1, x2, y2, ud, ld, dip = 0, 0, 100, 0, 10, 30, 90
     ss = SimpleSurface(x1, y1, x2, y2, ud, ld, dip)
     p = ss.plane
     self.assertEqual(type(p), space3.Plane)
     self.assertEqual(p.get_distance(ss.lrc), 0)
Exemple #8
0
 def test_surface(self):
     """
     """
     x1, y1, x2, y2, ud, ld, dip = 0, 0, 100, 0, 10, 30, 90
     ss = SimpleSurface(x1, y1, x2, y2, ud, ld, dip)
     s = ss.surface
     self.assertEqual(type(s), space2.RectangularSurface)
     self.assertEqual(s.w, ss.width)
     self.assertEqual(s.l, ss.length)
Exemple #9
0
    def test_properties(self):
        """
        """
        x1, y1, x2, y2, ud, ld, dip = 0, 0, 100, 0, 10, 30, 45

        ss = SimpleSurface(x1, y1, x2, y2, ud, ld, dip)
        self.assertEqual(ss.upper_depth, ud)
        self.assertEqual(ss.lower_depth, ld)
        self.assertEqual(ss.dip, dip)
        self.assertEqual(ss.ulc, (x1, y1, ud))
        self.assertEqual(ss.urc, (x2, y2, ud))
        self.assertEqual(ss.llc, (x1, ld - ud, ld))
        self.assertEqual(ss.lrc, (x2, ld - ud, ld))

        self.assertTrue(
            abs(ss.width - np.sqrt(2 * (ld - ud)**2)) < 10**-PRECISION)
        self.assertEqual(ss.length, np.sqrt(x2**2 + y2**2))
        self.assertAlmostEqual(ss.surface_width, ld - ud, PRECISION)
        self.assertEqual(ss.depth_range, ld - ud)