gempy-project / gempy

GemPy is an open-source, Python-based 3-D structural geological modeling software, which allows the implicit (i.e. automatic) creation of complex geological models from interface and orientation data. It also offers support for stochastic modeling to address parameter and model uncertainties.
https://gempy.org
European Union Public License 1.2
986 stars 235 forks source link

Attribute error #912

Closed KodalAnwesha closed 5 months ago

KodalAnwesha commented 5 months ago

What is your question? It's continuously showing attribute error whenever I try to create a model or plot in 2D. Is there any prerequisite of using GemPy?

KodalAnwesha commented 5 months ago

I am using Gempy-2024.1.0 in Python-3.11

javoha commented 5 months ago

Hi, could you specify the exact error and upgrade to Python 3.12? Cheers Jan

KodalAnwesha commented 5 months ago

Yes, actually, I had installed it's current version- 2024.1.0 in Python-3.11, but while working with it, it is always showing attribute error. Like, if I am trying to create a model, I am using gp.create_model command, but it's showing module 'gempy' has no attribute 'create_model'.

Gempy- 2024.2.0 isn't even getting imported in Python 3.11.

javoha commented 5 months ago

Hi, we are aware of the importing issue regarding the 2024.2.0 release and are working on a solution. The 2024.1.0 version should work though. Are you actually using "create_model"? Because that does not exist anymore in gempy v3. There were some changes in the API and the function is now called "create_geomodel". You can take a look at the examples (I like this one) for a closer look.

KodalAnwesha commented 5 months ago

Okay, thanks! But the gempyviewer is also showing similar kind of error. Like if I run this code from GemPy tutorial:

img = mpimg.imread('wells.png') p2d = gpv.plot_2d(geo_model, show=False)

the error is: 'GeoModel' object has no attribute 'input_transform'. How to fix this?

while this code is successfully runned: geo_model: gp.data.GeoModel = gp.create_geomodel( project_name='Model1', extent=[0, 791, -200, 200, -582, 0], resolution=None, refinement=4, # We will use octrees structural_frame=gp.data.StructuralFrame.initialize_default_structure() ) geo_model

KodalAnwesha commented 5 months ago

Could you please tell me which modules should be installed before working on GemPy? And which version of PYTHON will be compatible for GemPy v3?

javoha commented 5 months ago

Hey, it seems like there are some issues also with the numpy 2.0.0 release. I was bale to reproduce your errors. For me having gempy on: gempy 2024.1.4
gempy-engine 2024.1.4.2
gempy-viewer 2024.1.4
AND numpy on 1.26.4 did the trick. Sorry for the inconvenience, hopefully we get all the dependency issues fixed soon.

KodalAnwesha commented 5 months ago

Can we work with GemPy V2? Is it compatible with all versions?

javoha commented 5 months ago

Gempy v2 is available in the gempy legacy version, but I do believe you will have more dependency issues using that. This sometimes part of being an open source project. Did my suggestions solve the problem for you though?

KodalAnwesha commented 5 months ago

I tried to solve the issue using both Python-3.11 and 3.12, but this issue is not getting solved. I will again try the versions you recommended and will let you know. Because I have tried both Gempy version 2024.1.0 and 2024.2.0, but none of them are working.

KodalAnwesha commented 5 months ago

Hi, the attribute error is now gone after using the versions you have recommended, but the problem with plotting still persists. The code:

gp.add_surface_points( geo_model=geo_model, x=[458, 612], y=[0, 0], z=[-107, -14], elements_names=['surface1', 'surface1'] )

gpv.plot_2d(geo_model, cell_number=11) gpv.plot_3d(geo_model, image=True)

The error showing: UserWarning: FigureCanvasAgg is non-interactive, and thus cannot be shown.

Please tell me how am I supposed to fix this?

javoha commented 5 months ago

Hi, if you just put the 2d and 3d plot statements into different cells it should work. If you set image to False you should also be able to get an interactive 3d plot in a new window. The warning you mentioned will always ahow, but it is just a wanring, not an error.

KodalAnwesha commented 5 months ago

Okay, thank you.

Leguark commented 5 months ago

GemPy 2024.2 compatibility with numpy and scipy version 2 has been fixed.