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

add_orientations function does not work with orientation argument #921

Closed benk-mira closed 1 week ago

benk-mira commented 2 months ago

Describe the bug The orientation argument to add_orientations is a Sequence[np.ndarray] in the docstrings. Passing a list of arrays as the docstring implies fails at line 130 of manipulate_points.py since slicing is not supported for lists. Ignoring the doctrings and passing an array instead fails at line 128 of the same file because arrays are not truthy in that way.

To Reproduce

        extent = [-1000, 1000, -1000, 1000, -500, 500]
        geo_model = gp.create_geomodel(
            project_name="test",
            extent=extent,
            refinement=4,
            structural_frame=gp.data.StructuralFrame.initialize_default_structure()
        )
        gp.add_orientations(geo_model, x=[0], y=[0], z=[0], elements_names=['surface1'], orientation=[[0, 0, 0]])

image

        extent = [-1000, 1000, -1000, 1000, -500, 500]
        geo_model = gp.create_geomodel(
            project_name="test",
            extent=extent,
            refinement=4,
            structural_frame=gp.data.StructuralFrame.initialize_default_structure()
        )
        gp.add_orientations(geo_model, x=[0], y=[0], z=[0], elements_names=['surface1'], orientation=np.array([0, 0, 0]))

image

javoha commented 1 month ago

Hi, sorry for not replying for a while and thanks for the catch. I made a pull request to fix this, hopefully it will be resolved soon.

agzimmerman commented 3 weeks ago

Hi, sorry for not replying for a while and thanks for the catch. I made a pull request to fix this, hopefully it will be resolved soon.

i.e. #929

javoha commented 1 week ago

This should now be fixed in main. The pip release will follow in the future.

benk-mira commented 1 week ago

Thank you for addressing this! I'll test the fix on main.