-
-
Notifications
You must be signed in to change notification settings - Fork 261
Open
Labels
bug?Possible bugPossible bug
Description
I have used the set_custom_grid method to compute solutions on a pre-existing grid. I am retrieving the solution from Solutions.raw_arrays.custom but I find that the solution is all floats and contains values that are not clearly in one of the categories:
Many of the floats are close to one of the integer values and converting to integer takes care of most of issues, but I am left with some bad values in the array:
I expected that the solution in the custom array would be integer valued.
Here is my code to reproduce the slice of data pictured above.
import numpy as np
import gempy as gp
from geoh5py import Workspace
from geoh5py.objects import BlockModel
import matplotlib.pyplot as plt
from scipy.spatial import cKDTree
color_generator = gp.core.data.ColorsGenerator()
extents = [311730, 318467, 6068686, 6076023, -750, 350]
x = np.arange(extents[0], extents[1], 50)
y = np.arange(extents[2], extents[3], 50)
z = np.arange(extents[4], extents[5], 50)
X, Y, Z = np.meshgrid(x, y, z)
grid = np.c_[X.flatten(), Y.flatten(), Z.flatten()]
# Create structural frame
elements = [
gp.core.data.StructuralElement(
name="unit3",
color=next(color_generator),
surface_points=gp.data.SurfacePointsTable.from_arrays(
x=[314283.60, 314436.64, 314793.11, 314593.63, 314503.53, 314624.43],
y=[6074135.65, 6072641.68, 6071800.08, 6071350.68, 6070537.54, 6069821.63,],
z=[301.47, 301.57, 301.60, 301.64, 301.67, 301.72],
names=["unit3"]*6,
),
orientations=gp.data.OrientationsTable.initialize_empty(),
),
gp.core.data.StructuralElement(
name="unit2",
color=next(color_generator),
surface_points=gp.data.SurfacePointsTable.from_arrays(
x=[313803.07, 314057.46, 314030.63],
y=[6073334.87, 6071265.75, 6070534.66],
z=[301.52, 301.63, 301.67],
names=["unit2"]*3,
),
orientations=gp.data.OrientationsTable.from_arrays(
x=[313632.11],
y=[ 6072104.38],
z=[301.59],
G_x=[0.96671406],
G_y=[0.18791018],
G_z=[0.17364818],
names=["unit2"]
),
),
gp.core.data.StructuralElement(
name="unit1",
color=next(color_generator),
surface_points=gp.data.SurfacePointsTable.from_arrays(
x=[316326.99, 315571.08],
y=[6070539.09, 6072716.70],
z=[301.67, 301.55],
names=["unit1"] * 2,
),
orientations=gp.data.OrientationsTable.from_arrays(
x=[315905.12],
y=[6071471.84],
z=[301.62],
G_x=[0.94177634],
G_y=[0.28792992],
G_z=[0.17364818],
names=["unit1"]
),
),
]
structural_group = gp.core.data.StructuralGroup(
name="Series1",
elements=elements,
structural_relation = gp.core.data.StackRelationType.ERODE,
)
structural_frame = gp.core.data.StructuralFrame(
structural_groups=[structural_group], color_gen=color_generator
)
# Compute model
geo_model = gp.create_geomodel(
project_name="test",
extent=extents,
refinement=4,
structural_frame=structural_frame,
)
gp.set_custom_grid(geo_model.grid, grid)
solution = gp.compute_model(geo_model)
model = solution.raw_arrays.custom
def plot_slice(ax, elevation):
ind = grid[:, 2] == elevation
ax.imshow(model.astype(np.int32)[ind].reshape(len(y), len(x)))
fig, ax = plt.subplots(figsize=(10,10))
plot_slice(ax, -50)
Metadata
Metadata
Assignees
Labels
bug?Possible bugPossible bug


