Esempio n. 1
0
    def test_make_z_mesh_new(self):

        z1_layer = 10
        z_target_depth = 5000
        n_layers = 30
        n_airlayers = 10
        pad_z = 4
        pad_stretch_v = 1.4

        mObj = Model(z1_layer=z1_layer,
                     z_target_depth=z_target_depth,
                     n_layers=n_layers,
                     n_air_layers=n_airlayers,
                     pad_z=pad_z,
                     pad_stretch_v=pad_stretch_v)
        z_nodes, z_grid = mObj.make_z_mesh_new()

        expected_air_layers = [
            10., 10., 10., 20., 20., 20., 30., 30., 40., 50.
        ]
        self.assertTrue(np.all(z_nodes[:n_airlayers] == expected_air_layers))
        expected_air_layers = [
            0., 10., 20., 30., 50., 70., 90., 120., 150., 190., 240.
        ]
        self.assertTrue(np.all(z_grid[:n_airlayers +
                                      1] == expected_air_layers))

        # check core model part
        testnodes10_5000_16 = [
            60., 70., 80., 100., 100., 100., 200., 200., 200., 300., 300.,
            400., 500., 600., 700., 800.
        ]
        testgrid10_5000_16 = [
            240., 300., 370., 450., 550., 650., 750., 950., 1150., 1350.,
            1650., 1950., 2350., 2850., 3450., 4150., 4950.
        ]
        self.assertTrue(
            np.all(z_nodes[n_airlayers:-pad_z] == testnodes10_5000_16))
        self.assertTrue(
            np.all(z_grid[n_airlayers:-pad_z] == testgrid10_5000_16))

        # check padding part
        testnodespad = np.around(
            testnodes10_5000_16[-1] * (pad_stretch_v**np.arange(1, pad_z + 1)),
            -2)
        testgridpad = np.array(
            [testnodespad[:i].sum()
             for i in range(1, pad_z + 1)]) + testgrid10_5000_16[-1]

        self.assertTrue(np.all(z_nodes[-pad_z:] == testnodespad))
        self.assertTrue(np.all(z_grid[-pad_z:] == testgridpad))
Esempio n. 2
0
    def test_make_z_mesh_new(self):

        z1_layer = 10
        z_target_depth = 5000
        n_layers = 30
        n_airlayers = 10
        pad_z = 4
        pad_stretch_v = 1.4

        mObj = Model(z1_layer=z1_layer,
                     z_target_depth=z_target_depth,
                     n_layers=n_layers,
                     n_air_layers=n_airlayers,
                     pad_z=pad_z,
                     pad_stretch_v=pad_stretch_v)
        z_nodes, z_grid = mObj.make_z_mesh_new()

        # check air layer part
        self.assertTrue(
            np.all(z_nodes[:n_airlayers] == np.ones(n_airlayers) * z1_layer))
        self.assertTrue(
            np.all(z_grid[:n_airlayers +
                          1] == np.linspace(0, n_airlayers *
                                            z1_layer, n_airlayers + 1)))

        # check core model part
        testnodes10_5000_16 = np.array([
            10., 10., 20., 30., 40., 50., 70., 100., 100., 200., 300., 400.,
            500., 700., 1000., 1400.
        ])
        testgrid10_5000_16 = np.array([
            testnodes10_5000_16[:i].sum()
            for i in range(len(testnodes10_5000_16) + 1)
        ]) + n_airlayers * z1_layer

        self.assertTrue(
            np.all(z_nodes[n_airlayers:-pad_z] == testnodes10_5000_16))
        self.assertTrue(
            np.all(z_grid[n_airlayers:-pad_z] == testgrid10_5000_16))

        # check padding part
        testnodespad = np.around(
            testnodes10_5000_16[-1] * (pad_stretch_v**np.arange(1, pad_z + 1)),
            -2)
        testgridpad = np.array(
            [testnodespad[:i].sum()
             for i in range(1, pad_z + 1)]) + testgrid10_5000_16[-1]

        self.assertTrue(np.all(z_nodes[-pad_z:] == testnodespad))
        self.assertTrue(np.all(z_grid[-pad_z:] == testgridpad))