Closed Cylv1 closed 5 days ago
Hi! So it seems a problem related to the version 1.0.1 of geopandas that uses the pyogyro backend to read and write. For a quick fix you can run the following:
python -m pip install geopandas==0.14
in your terminal (if you have anaconda then in the conda terminal once you have activated the environment)!
This is now solved in version 1.5.1. To upgrade run the following:
python -m pip install fracability --upgrade
Describe the bug, what's wrong, and what you expected.
The following error message appears with FractureNetwork.save_shp() instruction.
ValueError Traceback (most recent call last) File ~\test_script_bahrija.py:47 41 fitter.plot_summary(sort_by='Mean_rank') 43 # ~ fitter.fit_result_to_excel(set_path_excel) 44 45 46 # ~ fracture_net.save_csv(path=path_fn) ---> 47 fracture_net.save_shp(path=path_fn)
File ~\anaconda3\Lib\site-packages\fracability\Entities.py:1431, in FractureNetwork.save_shp(self, path) 1424 """ 1425 Save the entity df as shp 1426 :param path: 1427 :return: 1428 """ 1430 if self.nodes is not None: -> 1431 self.nodes.save_shp(path) 1433 if self.fractures is not None: 1434 self.fractures.save_shp(path)
File ~\anaconda3\Lib\site-packages\fracability\AbstractClasses.py:311, in BaseEntity.save_shp(self, path) 309 final_path = os.path.join(output_path, f'{self.name}.shp') 310 entity_df = self.entity_df --> 311 entity_df.to_file(final_path, crs=self.crs) 313 qgis_style_paths = QgisStyle().available_paths 315 for qgis_path in qgis_style_paths:
File ~\anaconda3\Lib\site-packages\geopandas\geodataframe.py:1536, in GeoDataFrame.to_file(self, filename, driver, schema, index, kwargs) 1441 """Write the
GeoDataFrame
to a file. 1442 1443 By default, an ESRI shapefile is written, but any OGR data source (...) 1532 1533 """ 1534 from geopandas.io.file import _to_file -> 1536 _to_file(self, filename, driver, schema, index, kwargs)File ~\anaconda3\Lib\site-packages\geopandas\io\file.py:686, in _to_file(df, filename, driver, schema, index, mode, crs, engine, metadata, kwargs) 683 raise ValueError(f"'mode' should be one of 'w' or 'a', got '{mode}' instead") 685 if engine == "pyogrio": --> 686 _to_file_pyogrio(df, filename, driver, schema, crs, mode, metadata, kwargs) 687 elif engine == "fiona": 688 _to_file_fiona(df, filename, driver, schema, crs, mode, metadata, **kwargs)
File ~\anaconda3\Lib\site-packages\geopandas\io\file.py:742, in _to_file_pyogrio(df, filename, driver, schema, crs, mode, metadata, **kwargs) 739 kwargs["append"] = True 741 if crs is not None: --> 742 raise ValueError("Passing 'crs' is not supported with the 'pyogrio' engine.") 744 # for the fiona engine, this check is done in gdf.iterfeatures() 745 if not df.columns.is_unique:
ValueError: Passing 'crs' is not supported with the 'pyogrio' engine.
Steps to reproduce the bug.
set_path='path' set_path_boundary='path' path_fn = 'path'
set_a = Entities.Fractures(shp=set_path, set_n=1)
boundary = Entities.Boundary(shp=set_path_boundary, group_n=1)
fracture_net = Entities.FractureNetwork()
fracture_net.add_fractures(set_a) fracture_net.add_boundaries(boundary)
fracture_net.calculate_topology()
fitter = Statistics.NetworkFitter(fracture_net)
fitter.fit('lognorm') fitter.fit('expon') fitter.fit('norm') fitter.fit('gengamma') fitter.fit('powerlaw') fitter.fit('weibull_min')
fitter.fit_records(sort_by='Akaike').iloc[:,:-1]
fracture_net.save_shp(path=path_fn)
System Information
Screenshots and/or videos
No response
Datasets