Example #1
0
    def padding_mask_matrix(self, mask_topography=True, shift=2):
        """Pad as many elements as in shift to the masking arrays. This is done
         to guarantee intersection of layers if masked marching cubes are done

        Args:
            mask_topography (bool): if True mask also the topography. Default True
            shift: Number of voxels shifted for the topology. Default 1.

        Returns:
              numpy.ndarray: masked regular grid
        """

        self.mask_matrix_pad = []
        series_type = self.stack.df['BottomRelation']
        for e, mask_series in enumerate(self.mask_matrix):
            mask_series_reshape = mask_series.reshape(
                self.grid.regular_grid.resolution)

            mask_pad = (mask_series_reshape + find_interfaces_from_block_bottoms(
                mask_series_reshape, True, shift=shift))

            if series_type[e] == 'Fault':
                mask_pad = np.invert(mask_pad)

            if mask_topography and self.grid.regular_grid.mask_topo.size != 0:
                mask_pad *= np.invert(self.grid.regular_grid.mask_topo)
            self.mask_matrix_pad.append(mask_pad)
        return self.mask_matrix_pad
Example #2
0
    def padding_mask_matrix(self, mask_topography=True, shift=2):
        """Pad as many elements as in shift to the masking arrays. This is done to guarantee intersection of layers
        if masked marching cubes are done"""
        self.mask_matrix_pad = []
        for mask_series in self.mask_matrix:
            mask_series_reshape = mask_series.reshape((self.grid.regular_grid.resolution[0],
                                                       self.grid.regular_grid.resolution[1],
                                                       self.grid.regular_grid.resolution[2]))

            mask_pad = (mask_series_reshape + find_interfaces_from_block_bottoms(
                mask_series_reshape, True, shift=shift))

            if mask_topography and self.grid.regular_grid.mask_topo.size != 0:
                mask_pad = self.mask_topo(mask_pad)

            self.mask_matrix_pad.append(mask_pad)
        return True
#
# Sometimes we need to find the voxels that contain the each fault. To do
# so we can use gempy's functionality to find interfaces as follows. Lets
# use the first fault as an example:
#

# %%
gp.plot_2d(geo_model_graben,
           regular_grid=geo_model_graben.solutions.block_matrix[0, 0, :125000],
           show_data=True)

# %%
# Remember the fault block is stored on:
geo_model_graben.solutions.block_matrix[0, 0, :125000]

# %%
# Now we can find where is the intersection of the values 1 by calling the following function.
# This will return Trues on those voxels on the intersection
intersection = find_interfaces_from_block_bottoms(
    geo_model_graben.solutions.block_matrix[0, 0, :125000].reshape(50, 50, 50), 1, shift=1)

# %%
# We can manually plotting together to see exactly what we have done
ax = gp.plot_2d(geo_model_graben,
                block=geo_model_graben.solutions.block_matrix[0, 0, :125000],
                show_data=True, show=False)

plt.imshow(intersection[:, 25, :].T, origin='lower', extent=(0, 1000, -1000, 0), alpha=.5)
plt.show()

gp.save_model(geo_model)