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
955 stars 232 forks source link

Geological Map is rotated and Surfaces are not showing in 3D plot #446

Closed AlexanderJuestel closed 2 years ago

AlexanderJuestel commented 4 years ago

Describe the bug Using the new plottig API, the geological map does not fit the input data (see image). The issue was observed in two independent projects.

The geological map was created using:

gp.plot_2d(geo_model, section_names=['topography'], show_contours = False)

In addition, surfaces do not appear in interactive 3D plots. However, the geological map is oriented correctly in this case.

The 3D plot was created using:

gpv = gp.plot_3d(geo_model, 
                 show_surfaces=True,
                 show_lith=True, 
                 image=False, 
                 show_results=True,
                 plotter_type='basic', 
                 ve=3)

Expected behavior The geological map should fit to the input data and surfaces should be displayed in the 3D plot.

Screenshots Geological map oriented incorrectly If applicable, add screenshots to help explain your problem. image

Missing surfaces in 3D plot image

Correctly oriented geological map image

Desktop (please complete the following information):

AlexanderJuestel commented 4 years ago

@Leguark see this issue for the problem with the rotated geological map ;)

Wh20-fly commented 4 years ago

Hi @AlexanderJuestel ,how the upper model construct,do you have the code making the upper 3D geological model,thank you.

AlexanderJuestel commented 4 years ago

Hey @wh19971014,

This was just a sample model. The code originated from the documentation and tutorials of GemPy. I just changed the input data. So, just have a look there.

https://docs.gempy.org/tutorials/index.html

Cheers Alex

AlexanderJuestel commented 4 years ago

@Leguark, got the same problem for another model now ;)

image

endarthur commented 4 years ago

It seems that's an issue with the DEM loading process. If you change the line

https://github.com/cgre-aachen/gempy/blob/233944433890d482265537610618574bd930df33/gempy/plot/visualization_2d.py#L615

to something like

shape = self.model._grid.topography.values_2d[:, :, 2].shape

it seems to work (with also transposing the block data after reshape, to correct for the flip). As far as I have understood, the issue seems to be related with the fact that the grid for the topography is first created from the block model grid, taking from it its resolution, and that's not updated after the DEM is loaded using GDAL:

https://github.com/cgre-aachen/gempy/blob/233944433890d482265537610618574bd930df33/gempy/core/grid_modules/topography.py#L90-L93

As set_value doesn't change the resolution attribute.

Leguark commented 4 years ago

can some of you to create a test (somewhere in test/test_core/test_grids) replicating one of the models that fail and make a pull request?

I agree with @endarthur that the problem seems to be in the LoadDEMGDAL class but without debugging I cannot tell

AlexanderJuestel commented 3 years ago

@endarthur this we need to tackle!

AlexanderJuestel commented 3 years ago

@Leguark Do you think we could fix that for the next release that you indicated? It has bothered me a long time now :D But we haven't made any tests yet.

Maybe @endarthur has the time to create some soon :)

AlexanderJuestel commented 3 years ago

Will be fixed in #640

AlexanderJuestel commented 2 years ago

It seems like the issue does not appear in GemPy 2.2.9 anymore. Will keep it open until #640 is merged