Comments (5)
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.
from gemgis.
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
Alex
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
from gemgis.
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 [0]
before the [:,2]
at end for the command to extract depth data for each surface:
depth = geometric_data['vertices'][geometric_data[geometric_data['surface'] == val['surface']].index[0]][0][:, 2]
from gemgis.
@hntigkakis I updated the comment as I noticed this error as well. Try it now :)
from gemgis.
Will be fixed in #286
from gemgis.
Related Issues (20)
- [ENH] Rotate GemPy Input Data HOT 1
- Error extracting vertices from lines HOT 3
- Add GemGIS to pyOpenSci HOT 7
- [ENH] Check instances where to implment arr[...,n] for indexing columns of arrays
- [BUG] Reproject raster has a rasterio error caused by closing the scope too soon HOT 4
- [ENH] Replace setup.py with pyproject.toml HOT 3
- [ENH] Open MPK files in Python/GemGIS HOT 1
- [ENH] Implement CRS reprojection for seismic data (SEGY) HOT 1
- [BUG] Tutorial 35: ValueError: Cannot subset columns with a tuple with more than one element. HOT 7
- [ENH] Read raster layer from OpenFileGDB HOT 2
- Blank texture in gg.visualization.drape_array_over_dem (+ default zmax) HOT 5
- 68. Creating finite fault. HOT 28
- [BUG] No texture coordinates when loading the sample traces.shp file from tutorial 12 HOT 7
- export 3d plotted bore hole tube in vkt format HOT 1
- gempy version HOT 3
- How to display a surface as a cube HOT 6
- Tutorial 35: ERROR:root:Could not set shader program HOT 3
- conflicts between gemgis and pandas HOT 3
- create_boreholes_3d Geographical coordinate processing exists bug HOT 2
- visualization.create_polydata_from_ts not working for single surfaces HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gemgis.