Jannik-Schilling / generate_swmm_inp

a QGIS plugin for the import and export of SWMM input files (conversion of geodata, e.g. shapefiles or geopackage into SWMM models and vice versa)
GNU General Public License v2.0
35 stars 10 forks source link

Unknown Error #48

Closed felixxsr closed 1 year ago

felixxsr commented 1 year ago

Hello Jannik, first of all I would like to thank you for this amazing tool! My question is related to a error that I am getting when I try to import an specific .INP to QGIS. Can you help me? I get the following error message:

style files saved to folder C:\Users\gabri\Desktop\Teste reading inp ... generating options file ... generating inflows file ... generating patterns file ... generating quality file ... generating raingages file ... Traceback (most recent call last): File "C:/Users/gabri/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\generate_swmm_inp\generate_swmm_import_inp_file.py", line 704, in processAlgorithm geodata_driver_num, File "C:/Users/gabri/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\generate_swmm_inp\g_s_read_write_data.py", line 223, in create_layer_from_table data_df.apply(lambda x: create_feature_from_df(x, pr, geom_type), axis =1) File "C:\PROGRA1\QGIS31.18\apps\Python37\lib\site-packages\pandas\core\frame.py", line 6878, in apply return op.get_result() File "C:\PROGRA1\QGIS31.18\apps\Python37\lib\site-packages\pandas\core\apply.py", line 186, in get_result return self.apply_standard() File "C:\PROGRA1\QGIS31.18\apps\Python37\lib\site-packages\pandas\core\apply.py", line 296, in apply_standard values, self.f, axis=self.axis, dummy=dummy, labels=labels File "pandas_libs\reduction.pyx", line 618, in pandas._libs.reduction.compute_reduction File "pandas_libs\reduction.pyx", line 128, in pandas._libs.reduction.Reducer.get_result File "C:/Users/gabri/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\generate_swmm_inp\g_s_read_write_data.py", line 223, in data_df.apply(lambda x: create_feature_from_df(x, pr, geom_type), axis =1) File "C:/Users/gabri/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\generate_swmm_inp\g_s_read_write_data.py", line 172, in create_feature_from_df f.setGeometry(df.geometry) TypeError: QgsFeature.setGeometry(): arguments did not match any overloaded call: overload 1: argument 1 has unexpected type 'QVariant' overload 2: argument 1 has unexpected type 'QVariant'

Thank you very much!

Jannik-Schilling commented 1 year ago

Hello felixxsr, thanks for reporting this. Apparently I forgot to write an exception for this case: it seems like there are no symbol coordinates for the rain gage(s) in your inp file. A quick solution: you can add a [SYMBOLS] section at the end of the inp file if it is not already there and then you add (any) coordinates for each rain gage in your model, e.g. for a rain gage with the name 'R_1':

[SYMBOLS]
;;Gage           X-Coord            Y-Coord        
;;-------------- ------------------ ------------------
R_1             309239.059         5998337.220
Jannik-Schilling commented 1 year ago

fix: 68a15c5

Jannik-Schilling commented 1 year ago

still needs some testing

felixxsr commented 1 year ago

Thank you very much for your fast reply, I am writting my thesis now so I really thank you for the help haha !

I added the coordiantes to the Rain Gauge and it runs with no error message. But it is for like 30 min running to generate the subcatchments (I have like 80.000 subcatchments maybe thats why is taking long?)

I will in let it running overnight and let you know if it worked tomorrow! :)

running

Jannik-Schilling commented 1 year ago

But it is for like 30 min running to generate the subcatchments (I have like 80.000 subcatchments maybe thats why is taking long?)

yep, 80000 will take some time...especially, if you have a lot of vertices for complex subcatchment polygons.

Good luck!

felixxsr commented 1 year ago

Worked!

It worked !! Thank you so much :D

Jannik-Schilling commented 1 year ago

seems to be fixed