-
Notifications
You must be signed in to change notification settings - Fork 42
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG] gg.visualization.create_depth_maps_from_gempy ValueError #288
Comments
Hello and welcome! Thanks for posting your first issue in the GemGIS project! Someone from our developers will get back to you. If your question is support related, we may transfer it to the Discussions. |
Dear @hntigkakis, this is a known error. It was fixed in 781c594 and will be merged and released soon. Please copy the function below to have a hot fix for your issue. Let me know if any other issues arise. Cheers def create_depth_maps_from_gempy(geo_model, # gp.core.model,
surfaces: Union[str, List[str]]) \
-> Dict[str, List[Union[pv.core.pointset.PolyData, np.ndarray, List[str]]]]:
# Checking if geo_model is a GemPy geo_model
if not isinstance(geo_model, gp.core.model.Project):
raise TypeError('geo_model must be a GemPy geo_model')
# Checking that the model was computed
if all(pd.isna(geo_model.surfaces.df.vertices)) == True and all(pd.isna(geo_model.surfaces.df.edges)) == True:
raise ValueError('Model must be created before depth map extraction')
# Checking if surface is of type string
if not isinstance(surfaces, (str, list)):
raise TypeError('Surface name must be of type string')
# Converting string to list if only one surface is provided
if isinstance(surfaces, str):
surfaces = [surfaces]
# Extracting surface data_df for all surfaces
data_df = geo_model.surfaces.df.copy(deep=True)
# Checking that surfaces are valid
if not all(item in data_df.surface.unique().tolist() for item in surfaces):
raise ValueError('One or more invalid surface names provided')
# Extracting geometric data of selected surfaces
geometric_data = pd.concat([data_df.groupby('surface').get_group(group) for group in surfaces])
# Creating empty dict to store data
surfaces_poly = {}
for idx, val in geometric_data[['vertices', 'edges', 'color', 'surface', 'id']].dropna().iterrows():
# Creating PolyData from each surface
surf = pv.PolyData(val['vertices'][0], np.insert(val['edges'][0], 0, 3, axis=1).ravel())
# Append depth to PolyData
surf['Depth [m]'] = val['vertices'][0][:,2]
# Store mesh, depth values and color values in dict
surfaces_poly[val['surface']] = [surf, val['color']]
return surfaces_poly |
Thank you @AlexanderJuestel. I tried it and I'm now getting the following: Correct me if I'm doing something wrong, but it works by adding
|
@hntigkakis I updated the comment as I noticed this error as well. Try it now :) |
Will be fixed in #286 |
Using the function gg.visualization.create_depth_maps_from_gempy produces a ValueError:
I believe (I might be wrong) that it is some incompatibility with pyvista 0.39, which is required by the latest version of gempy. More specifically, I'm using:
python=3.10.12
gemgis=1.0.11
gempy=2.3.0
pyvista=0.39.1
The text was updated successfully, but these errors were encountered: