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

Must have equal len keys and value #808

Closed Mehdi-EM closed 5 months ago

Mehdi-EM commented 1 year ago

Hello, I'm fairly new to gempy, and I am currently trying to create a model based on a few boreholes made following a tunnel. When I try to use the gp.compute_model command, there is an error message as follows:

File c:\users\cpothier\downloads\gempy-main\gempy-main\gempy\gempy_api.py:305, in compute_model(model, output, at, compute_mesh, reset_weights, reset_scalar, reset_block, sort_surfaces, debug, set_solutions, kwargs) 298 model.solutions.set_solutions( 299 sol, 300 compute_mesh, 301 sort_surfaces, 302 kwargs) 304 if sort_surfaces: --> 305 model.set_surface_order_from_solution() 306 return model.solutions

File c:\users\cpothier\downloads\gempy-main\gempy-main\gempy\core\model.py:1581, in ImplicitCoKriging.set_surface_order_from_solution(self) 1579 self._sfai_order_0 = sfai_order 1580 sel = self._surfaces.df['isActive'] & ~self._surfaces.df['isBasement'] -> 1581 self._surfaces.df.loc[sel, 'sfai'] = sfai_order 1582 self._surfaces.df.sort_values(by=['series', 'sfai'], inplace=True, 1583 ascending=False) 1584 self._surfaces.reset_order_surfaces()

File ~.conda\envs\gempy38\lib\site-packages\pandas\core\indexing.py:723, in _LocationIndexer.setitem(self, key, value) 720 self._has_valid_setitem_indexer(key) 722 iloc = self if self.name == "iloc" else self.obj.iloc --> 723 iloc._setitem_with_indexer(indexer, value, self.name)

File ~.conda\envs\gempy38\lib\site-packages\pandas\core\indexing.py:1730, in _iLocIndexer._setitem_with_indexer(self, indexer, value, name) 1727 # align and set the values 1728 if take_split_path: 1729 # We have to operate column-wise -> 1730 self._setitem_with_indexer_split_path(indexer, value, name) 1731 else: 1732 self._setitem_single_block(indexer, value, name)

File ~.conda\envs\gempy38\lib\site-packages\pandas\core\indexing.py:1785, in _iLocIndexer._setitem_with_indexer_split_path(self, indexer, value, name) 1780 if len(value) == 1 and not is_integer(info_axis): 1781 # This is a case like df.iloc[:3, [1]] = [0] 1782 # where we treat as df.iloc[:3, 1] = 0 1783 return self._setitem_with_indexer((pi, info_axis[0]), value[0]) -> 1785 raise ValueError( 1786 "Must have equal len keys and value " 1787 "when setting with an iterable" 1788 ) 1790 elif lplane_indexer == 0 and len(value) == len(self.obj.index): 1791 # We get here in one case via .loc with a all-False mask 1792 pass

ValueError: Must have equal len keys and value when setting with an iterable

I put everything I used in my personnal repository: https://github.com/Mehdi-EM/Tunnel

Weirdly enough, this error does not interrupt the program, but the results are weird, as the top layer replaces the basement and the bottom layers, and all the other layers are replacing the ones just above them, as seen in the image below: bug

Any help would be appreciated Thanks, Mehdi

AlexanderJuestel commented 1 year ago

Hey @Mehdi-EM,

I have downloaded the data and can rule out for now that you do not have any missing orientations (which was my first idea). I will dig a little deeper. Stay tuned.

image

Japhiolite commented 1 year ago

Some orientation values are weird though. e.g. azimuth 90 and dip 358 ?

Plus, from the looks of input point sequence of your borehole data, geology might be rather complex in your area...my advice would be to first try with a reduced set of major units and then add the others

Mehdi-EM commented 1 year ago

@Japhiolite apologies, I just put values as a mean to an end, without thinking too much about it. I changed the file so that these orientations have more sense on a physical sense.

AlexanderJuestel commented 1 year ago

@Mehdi-EM did changing the dip and azimuth solve your problem then? :)

Mehdi-EM commented 1 year ago

No, the results are strictly identical

Mehdi-EM commented 1 year ago

Hello, any updates on the situation ?

AlexanderJuestel commented 1 year ago

Not from my side, no. Did not have the chance to look further into your issue yet, sorry