Loop3D / map2loop

MIT License
9 stars 9 forks source link

[Question] - What is the latest available map2loop version and updated examples? #113

Closed ice-jing closed 2 weeks ago

ice-jing commented 1 month ago

Question Details

Hello, is the latest version of map2loop currently available? I tried to use three examples but got an error. Is there an up-to-date tutorial or video I can study for reference? Loop Workflow Example 1 : GEOSException: TopologyException: Input geom 0 is invalid: Ring Self-intersection at or near point 513377.91096413141 7501368.8897217009 at 513377.91096413141 7501368.8897217009 Loop Workflow Example 2 : TypeError: Map.add() got an unexpected keyword argument 'index' Loop Workflow Example3 : KeyError: "['UNITNAME_1', 'UNITNAME_2'] not in index"

Relevant code or data

example3: KeyError Traceback (most recent call last) Cell In[1], line 81 64 # Or you can run map2loop and pre-specify the stratigraphic column 65 column = [ 66 # youngest 67 'Turee_Creek_Group', (...) 79 # oldest 80 ] ---> 81 proj.run_all(user_defined_stratigraphic_column=column) 83 # Or you can get map2loop to run all column sorting algorithms it has and takes the one 84 # that has the longest total basal contact length 85 #proj.run_all(take_best=True) 86 proj.run_all()

File D:\Anaconda3\envs\map2loop3.1.8\lib\site-packages\map2loop\project.py:508, in Project.run_all(self, user_defined_stratigraphic_column, take_best) 500 """ 501 Runs the full map2loop process 502 (...) 505 A user fed list that overrides the stratigraphic column sorter. Defaults to None. 506 """ 507 # Calculate contacts before stratigraphic column --> 508 self.map_data.extract_all_contacts() 510 # Calculate the stratigraphic column 511 if issubclass(type(user_defined_stratigraphic_column), list):

File D:\Anaconda3\envs\map2loop3.1.8\lib\site-packages\map2loop\mapdata.py:1415, in MapData.extract_all_contacts(self, save_contacts) 1413 for unit2 in units: 1414 if unit1 != unit2: -> 1415 join = geopandas.overlay( 1416 geology[geology["UNITNAME"] == unit1], 1417 geology[geology["UNITNAME"] == unit2], 1418 keep_geom_type=False, 1419 )[column_names] 1420 join["geometry"] = join.buffer(1) 1421 buffered = geology[geology["UNITNAME"] == unit2][["geometry"]].copy()

File D:\Anaconda3\envs\map2loop3.1.8\lib\site-packages\geopandas\geodataframe.py:1299, in GeoDataFrame.getitem(self, key) 1293 def getitem(self, key): 1294 """ 1295 If the result is a column containing only 'geometry', return a 1296 GeoSeries. If it's a DataFrame with a 'geometry' column, return a 1297 GeoDataFrame. 1298 """ -> 1299 result = super(GeoDataFrame, self).getitem(key) 1300 geo_col = self._geometry_column_name 1301 if isinstance(result, Series) and isinstance(result.dtype, GeometryDtype):

File D:\Anaconda3\envs\map2loop3.1.8\lib\site-packages\pandas\core\frame.py:4108, in DataFrame.getitem(self, key) 4106 if is_iterator(key): 4107 key = list(key) -> 4108 indexer = self.columns._get_indexer_strict(key, "columns")[1] 4110 # take() does not accept boolean indexers 4111 if getattr(indexer, "dtype", None) == bool:

File D:\Anaconda3\envs\map2loop3.1.8\lib\site-packages\pandas\core\indexes\base.py:6200, in Index._get_indexer_strict(self, key, axis_name) 6197 else: 6198 keyarr, indexer, new_indexer = self._reindex_non_unique(keyarr) -> 6200 self._raise_if_missing(keyarr, indexer, axis_name) 6202 keyarr = self.take(indexer) 6203 if isinstance(key, Index): 6204 # GH 42790 - Preserve name from an Index

File D:\Anaconda3\envs\map2loop3.1.8\lib\site-packages\pandas\core\indexes\base.py:6252, in Index._raise_if_missing(self, key, indexer, axis_name) 6249 raise KeyError(f"None of [{key}] are in the [{axis_name}]") 6251 not_found = list(ensure_index(key)[missing_mask.nonzero()[0]].unique()) -> 6252 raise KeyError(f"{not_found} not in index")

KeyError: "['UNITNAME_1', 'UNITNAME_2'] not in index"

Additional Context

No response

AngRodrigues commented 1 month ago

Hi @ice-jing,

Thanks for sending this through.

The latest available version of map2loop is 3.1.8, available in the master branch.

The examples available in https://github.com/Loop3D/map2loop-notebooks work with the most recent version of map2loop (make sure to update both map2loop and map2loop-notebooks directories).

Let us know if there's any further issues.

AngRodrigues commented 2 weeks ago

Closing this due to inactivity.