storm-fsv-cvut / smoderp2d

SMODERP2D - Distributed event-based model for surface and subsurface runoff and erosion
https://storm-fsv-cvut.github.io/smoderp2d-manual/
GNU General Public License v3.0
7 stars 4 forks source link

Batch processing #392

Closed landam closed 1 month ago

landam commented 1 month ago

Tasks:

landam commented 1 month ago

@pesekon2 Are you sure that's it related to this PR? I will check it later.

landam commented 1 month ago

This could be caused (wild guess) by None assigned to points/streams.

landam commented 1 month ago

@pesekon2 Are you sure that's it related to this PR? I will check it later.

I can confirm that this bug was introduced by this PR.

landam commented 1 month ago

When I run this branch in QGIS, I get the following warning: WARNING Failed to historical item (see logs for details)

And indeed, it is not added to the history tab.

It fails due to tuple index out of range. After removing input_maps variable the run variable has only two items:

('2024-05-23 19:15:32.315153',
{'elevation': '/home/martin/git/storm-fsv-cvut/smoderp2d/tests/data/rain_sim/dem.tif', 'soil': '/home/martin/git/storm-fsv-cvut/smoderp2d/tests/data/rain_sim/soils.shp', 'soil_type_fieldname': 'Soil', 'vegetation': '/home/martin/git/storm-fsv-cvut/smoderp2d/tests/data/rain_sim/landuse.shp', 'vegetation_type_fieldname': 'LandUse', 'points': '/home/martin/git/storm-fsv-cvut/smoderp2d/tests/data/rain_sim/points.shp', 'points_fieldname': 'point_id', 'streams': '/home/martin/git/storm-fsv-cvut/smoderp2d/tests/data/rain_sim/streams.shp', 'rainfall_file': '/home/martin/git/storm-fsv-cvut/smoderp2d/tests/data/rainfall_rain_sim.txt', 'end_time': 5.0, 'maxdt': 5.0, 'table_soil_vegetation': '/home/martin/git/storm-fsv-cvut/smoderp2d/tests/data/rain_sim/soil_veg_tab.csv', 'table_soil_vegetation_fieldname': 'soilveg', 'channel_properties_table': '/home/martin/git/storm-fsv-cvut/smoderp2d/tests/data/rain_sim/streams_shape.dbf', 'streams_channel_type_fieldname': 'channel_id', 'flow_direction': 'single', 'wave': 'kinematic', 'generate_temporary': True, 'output': '/tmp/tmpuvl246mn'})

But the code requires three items:

('2024-05-23 19:19:30.431610',
{'elevation': 'elevation', 'soil': 'soil', 'soil_type_fieldname': 'Soil', 'vegetation': 'vegetation', 'vegetation_type_fieldname': 'LandUse', 'points': 'points', 'points_fieldname': 'point_id', 'streams': 'streams', 'rainfall_file': '/home/martin/git/storm-fsv-cvut/smoderp2d/tests/data/rainfall_rain_sim.txt', 'end_time': 5.0, 'maxdt': 5.0, 'table_soil_vegetation': 'table_soil_vegetation', 'table_soil_vegetation_fieldname': 'soilveg', 'channel_properties_table': 'channel_properties_table', 'streams_channel_type_fieldname': 'channel_id', 'flow_direction': 'single', 'wave': 'kinematic', 'generate_temporary': True, 'output': '/tmp/tmpobwkj2k_'},
{'elevation': '/home/martin/git/storm-fsv-cvut/smoderp2d/tests/data/rain_sim/dem.tif', 'soil': '/home/martin/git/storm-fsv-cvut/smoderp2d/tests/data/rain_sim/soils.shp', 'vegetation': '/home/martin/git/storm-fsv-cvut/smoderp2d/tests/data/rain_sim/landuse.shp', 'points': '/home/martin/git/storm-fsv-cvut/smoderp2d/tests/data/rain_sim/points.shp', 'streams': '/home/martin/git/storm-fsv-cvut/smoderp2d/tests/data/rain_sim/streams.shp', 'table_soil_vegetation': '/home/martin/git/storm-fsv-cvut/smoderp2d/tests/data/rain_sim/soil_veg_tab.csv', 'channel_properties_table': '/home/martin/git/storm-fsv-cvut/smoderp2d/tests/data/rain_sim/streams_shape.dbf', 'streams_channel_type_fieldname': 'channel_id'})
pesekon2 commented 1 month ago

Now I get 2024-05-24T09:34:13 WARNING TypeError: cannot pickle 'QgsRasterLayer' object when I ran it in QGIS.

Then I turned off QGIS, turned it on, and now I cannot even open the SMODERP2D plugin, getting the following error:

An error has occurred while executing Python code: 

TypeError: unable to convert a C++ 'QVariantList' instance to a Python object 
Traceback (most recent call last):
  File "/home/pesek/.local/share/QGIS/QGIS3/profiles/default/python/plugins/smoderp2d-plugin/smoderp_2D.py", line 210, in run
    self.dockwidget = Smoderp2DDockWidget()
  File "/home/pesek/.local/share/QGIS/QGIS3/profiles/default/python/plugins/smoderp2d-plugin/smoderp_2D_dockwidget.py", line 188, in __init__
    self.retranslateUi()
  File "/home/pesek/.local/share/QGIS/QGIS3/profiles/default/python/plugins/smoderp2d-plugin/smoderp_2D_dockwidget.py", line 253, in retranslateUi
    self._loadHistory()
  File "/home/pesek/.local/share/QGIS/QGIS3/profiles/default/python/plugins/smoderp2d-plugin/smoderp_2D_dockwidget.py", line 492, in _loadHistory
    runs = self.settings.value('historical_runs')
TypeError: unable to convert a C++ 'QVariantList' instance to a Python object
landam commented 1 month ago

Now I get 2024-05-24T09:34:13 WARNING TypeError: cannot pickle 'QgsRasterLayer' object when I ran it in QGIS.

This issue should be addressed by ff31c4cf

landam commented 1 month ago

@pesekon2 Based on discussion with @kavkapet we prefer match based on file path.

landam commented 1 month ago

When I load something from the history pane in QGIS, the Maximum time step [s] is not updated.

Fixed in 95a78f7.

landam commented 1 month ago

I know that I am going to be annoying but are you sure it fixes loading Maximum time step [s]? Because it does not do so at my side.

It seems to work for me:

Screencast from 2024-05-28 10-39-32.webm

BTW, maxdt was also missing in test parameters, see b4bd0df.