Closed FLO-2DKaren closed 1 year ago
@rpachaly This issue has error messages that are printed to the log when the FLO-2D Plugin is loaded. This is a good place to start because I think they are easy but they will give you an opportunity to see the code in various files. I would say we should break them into groups in the comments and give them checkboxes.
You might find that your computer give different messages based on your installation. We should test this with the Longterm version of QGIS and the Latest version of QGIS. I can help split them up. Let's look at them during our next meeting.
@FLO-2DNoemi Hi Noemi, Here's the new project for Robson. It has 2 issues to start. Let me know if you have any questions or just want to go over these with me first.
@FLO-2DKaren Hi Karen! I fixed all the python errors when QGIS starts and loads the FLO-2D Plugin. I tested on QGIS versions 3.30.3 and 3.28.7 and no warnings were shown.
@rpachaly
Excellent.
Do a commit and push and I will test the commit. Once the test is clear, I will do a pull request and merge the code.
Do you want to get together and practice that one more time? I'm happy to do that with you.
Karen
Ooops accidentally hit close to soon.
@rpachaly Excellent. Do a commit and push and I will test the commit. Once the test is clear, I will do a pull request and merge the code.
Do you want to get together and practice that one more time? I'm happy to do that with you.
Karen
I did the commit and push. You can test the modifications. I would be happy to follow these final steps again, just to make sure that I did everything correct. We can also use this time to talk about the other issue.
@rpachaly I'm still getting these warnings. Could you check them? I'm using Version 3.28.
2023-06-06T12:38:32 WARNING warning:C:\Users/Alejandro Riano/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\flo2d\gui\infil_editor_widget.py:640: DeprecationWarning: an integer is required (got type float). Implicit conversion to integers using int is deprecated, and may be removed in a future version of Python. self.spin_scsnall.setValue(infil_glob[11] if infil_glob[11] is not None else 99)
traceback: File "C:\Users/Alejandro Riano/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\flo2d\flo2d.py", line 912, in load_gpkg_from_proj
self.setup_dock_widgets()
File "C:\Users/Alejandro Riano/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\flo2d\flo2d.py", line 166, in setup_dock_widgets
self.create_f2d_dock()
File "C:\Users/Alejandro Riano/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\flo2d\flo2d.py", line 467, in create_f2d_dock
self.f2d_widget = FLO2DWidget(self.iface, self.lyrs, self.f2d_plot, self.f2d_table)
File "C:\Users/Alejandro Riano/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\flo2d\gui\f2d_main_widget.py", line 55, in __init__
self.setup_infil_editor()
File "C:\Users/Alejandro Riano/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\flo2d\gui\f2d_main_widget.py", line 142, in setup_infil_editor
self.infil_editor = InfilEditorWidget(self.iface, self.lyrs)
File "C:\Users/Alejandro Riano/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\flo2d\gui\infil_editor_widget.py", line 45, in __init__
self.iglobal = InfilGlobal(self.iface, self.lyrs)
File "C:\Users/Alejandro Riano/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\flo2d\gui\infil_editor_widget.py", line 620, in __init__
self.populate_infilglobals()
File "C:\Users/Alejandro Riano/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\flo2d\gui\infil_editor_widget.py", line 640, in populate_infilglobals
self.spin_scsnall.setValue(infil_glob[11] if infil_glob[11] is not None else 99)
2023-06-06T12:43:04 WARNING warning:C:\Users/Alejandro Riano/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\flo2d\flo2d_tools\grid_tools.py:477: DeprecationWarning: QgsSpatialIndex.insertFeature() is deprecated index.insertFeature(feat_copy)
traceback: File "C:\Users/Alejandro Riano/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\flo2d\gui\xs_editor_widget.py", line 729, in schematize_channels
cs.create_schematized_channels()
File "C:\Users/Alejandro Riano/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\flo2d\flo2d_tools\schematic_tools.py", line 1177, in create_schematized_channels
self.set_xs_features() # Creates self.xsections_feats and self.xs_index of the user cross sections.
File "C:\Users/Alejandro Riano/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\flo2d\flo2d_tools\schematic_tools.py", line 1096, in set_xs_features
self.xsections_feats, self.xs_index = spatial_index(self.user_xsections_lyr)
File "C:\Users/Alejandro Riano/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\flo2d\flo2d_tools\grid_tools.py", line 477, in spatial_index
index.insertFeature(feat_copy)
@rpachaly Hi Robson, So I did a pull request on your commit. It should finish merging and testing in the next 5 to 10 min. You'll need to update your local master branch and build a new branch for the next part of this job.
@FLO-2DKaren I'm not getting these warnings but I'll try to fix them.
Got it, when it is done updating I'll start working.
I'm getting these warnings when I load a project. I'll fix them!
@FLO-2DKaren I pushed the branch again.
@rpachaly
Can you compare your versions to mine? I wonder why you aren't seeing some of these error messages. I wonder if I recenly updated some things that I shouldn't have.
Here are the two QGIS versions that I'm using for testing:
QGIS 3.28
QGIS 3.30
@rpachaly
There might be more of these:
Search "insertFeature" (5 hits in 3 files of 400 searched) C:\Users\Alejandro Riano\PycharmProjects\qgis-flo-2d-plugin\flo2d\flo2d_tools\grid_tools.py (3 hits) Line 477: index.insertFeature(feat_copy) Line 491: index.insertFeature(feat_copy) Line 542: index.insertFeature(feat_copy) C:\Users\Alejandro Riano\PycharmProjects\qgis-flo-2d-plugin\flo2d\flo2d_tools\infiltration_tools.py (1 hit) Line 192: land_soil_index.insertFeature(land_soil_feat) C:\Users\Alejandro Riano\PycharmProjects\qgis-flo-2d-plugin\flo2d\flo2d_tools\schematic_tools.py (1 hit) Line 1850: index.insertFeature(feat)
@rpachaly
More of these too. I'm 1 build behind your plugin so the one you fixed is still in my version.
Search "proj4" (13 hits in 4 files of 400 searched) C:\Users\Alejandro Riano\PycharmProjects\qgis-flo-2d-plugin\flo2d\flo2d.py (3 hits) Line 1287: self.gutils.set_cont_par("PROJ", self.crs.toProj4()) Line 1549: self.gutils.set_cont_par("PROJ", self.crs.toProj4()) Line 1779: self.gutils.set_cont_par("PROJ", self.crs.toProj4()) C:\Users\Alejandro Riano\PycharmProjects\qgis-flo-2d-plugin\flo2d\gui\dlg_sampling_point_elev.py (3 hits) Line 256: crs_proj4 = self.grid.crs().toProj4() Line 266: ("srs", crs_proj4), C:\Users\Alejandro Riano\PycharmProjects\qgis-flo-2d-plugin\flo2d\gui\dlg_settings.py (4 hits) Line 213: proj4 = self.crs.toProj4() Line 221: data = (self.crs.description(), crsid, auth, crsid, proj4, "") Line 347: self.gutils.set_cont_par("PROJ", self.crs.toProj4()) C:\Users\Alejandro Riano\PycharmProjects\qgis-flo-2d-plugin\flo2d\misc\calc_average_elev.py (3 hits) Line 35: # args[8] = wkt or proj4 crs string Line 133: # check if srs is Proj4 Line 134: crs.ImportFromProj4(srs)
@rpachaly
More of these:
Search "rb.reset" (3 hits in 3 files of 400 searched) C:\Users\Alejandro Riano\PycharmProjects\qgis-flo-2d-plugin\flo2d\flo2d_tools\channel_profile_tool.py (1 hit) Line 108: self.rb.reset(i) C:\Users\Alejandro Riano\PycharmProjects\qgis-flo-2d-plugin\flo2d\flo2d_tools\info_tool.py (1 hit) Line 97: self.rb.reset(i) C:\Users\Alejandro Riano\PycharmProjects\qgis-flo-2d-plugin\flo2d\layers.py (1 hit) Line 2428: self.rb.reset(i)
@rpachaly
I think you can do another commit to this branch to load the new fixes. Once you do that, I'll do the testing.
@rpachaly
I think you can do another commit to this branch to load the new fixes. Once you do that, I'll do the testing.
Done! I fixed these files and pushed the branch.
@rpachaly Testing it now. All error messages cleared. I think more error messages will come up as I access more of the code through general processing. Working through the Self-Help kit will also weed a few more out. But I will close the issue for now because my complex project didn't receive any.
Good! Let me know if everything worked as expected. I'll be waiting for further instructions.
These are the python error messages that are written to the Error Message Log when QGIS starts and loads the FLO-2D Plugin.
2023-05-31T10:28:45 WARNING warning:C:\OSGeo4W\apps\Python39\lib\site-packages\scipy__init__.py:138: UserWarning: A NumPy version >=1.16.5 and warnings.warn(f"A NumPy version >={np_minversion} and ", line 1, in File "C:\OSGeo4W/apps/qgis-ltr/./python\qgis\utils.py", line 443, in startPlugin if not _startPlugin(packageName): File "C:\OSGeo4W/apps/qgis-ltr/./python\qgis\utils.py", line 423, in _startPlugin plugins[packageName] = package.classFactory(iface) File "C:\Users/Alejandro Riano/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\flo2d__init.py", line 19, in classFactory from .flo2d import Flo2D File "C:\OSGeo4W/apps/qgis-ltr/./python\qgis\utils.py", line 888, in _import mod = _builtin_import(name, globals, locals, fromlist, level) File "", line 1007, in _find_and_load File "", line 986, in _find_and_load_unlocked File "", line 680, in _load_unlocked File "", line 855, in exec_module File "", line 228, in _call_with_frames_removed File "C:\Users/Alejandro Riano/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\flo2d\flo2d.py", line 49, in from .flo2d_ie.flo2dgeopackage import Flo2dGeoPackage File "C:\OSGeo4W/apps/qgis-ltr/./python\qgis\utils.py", line 888, in _import mod = _builtin_import(name, globals, locals, fromlist, level) File "", line 1007, in _find_and_load File "", line 986, in _find_and_load_unlocked File "", line 680, in _load_unlocked File "", line 855, in exec_module File "", line 228, in _call_with_frames_removed File "C:\Users/Alejandro Riano/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\flo2d\flo2d_ie\flo2dgeopackage.py", line 22, in from ..flo2d_tools.grid_tools import grid_compas_neighbors File "C:\OSGeo4W/apps/qgis-ltr/./python\qgis\utils.py", line 888, in _import mod = _builtin_import(name, globals, locals, fromlist, level) File "", line 1007, in _find_and_load File "", line 986, in _find_and_load_unlocked File "", line 680, in _load_unlocked File "", line 855, in exec_module File "", line 228, in _call_with_frames_removed File "C:\Users/Alejandro Riano/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\flo2d\flo2d_tools\grid_tools.py", line 43, in from scipy.stats._discrete_distns import geom File "C:\OSGeo4W/apps/qgis-ltr/./python\qgis\utils.py", line 888, in _import mod = _builtin_import(name, globals, locals, fromlist, level) File "", line 1007, in _find_and_load File "", line 972, in _find_and_load_unlocked File "", line 228, in _call_with_frames_removed File "", line 1007, in _find_and_load File "", line 972, in _find_and_load_unlocked File "", line 228, in _call_with_frames_removed File "", line 1007, in _find_and_load File "", line 986, in _find_and_load_unlocked File "", line 680, in _load_unlocked File "", line 855, in exec_module File "", line 228, in _call_with_frames_removed File "C:\OSGeo4W\apps\Python39\lib\site-packages\scipy\init__.py", line 138, in warnings.warn(f"A NumPy version >={np_minversion} and 2023-05-31T10:28:49 WARNING warning:C:\Users\Alejandro Riano\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins\flo2d\deps\pyqtgraph-0.11.1-py2.py3-none-any.whl\pyqtgraph\functions.py:41: DeprecationWarning: Flags not at the start of the expression '(?P[+-]?((((' (truncated) FLOAT_REGEX = re.compile(r'(?P[+-]?((((\d+(.\d)?)|(\d.\d+))([eE][+-]?\d+)?)|((?i)(nan)|(inf))))\s((?P[u' + SI_PREFIXES + r']?)(?P\w.))?$')
2023-05-31T10:30:39 WARNING warning:C:\Users/Alejandro Riano/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\flo2d\gui\infil_editor_widget.py:640: DeprecationWarning: an integer is required (got type float). Implicit conversion to integers using int is deprecated, and may be removed in a future version of Python. self.spin_scsnall.setValue(infil_glob[11] if infil_glob[11] is not None else 99)
2023-05-31T10:32:03 WARNING warning:C:\Users/Alejandro Riano/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\flo2d\gui\dlg_sampling_elev.py:181: ResourceWarning: unclosed file proc = Popen(