UMEP-dev / UMEP-processing

7 stars 9 forks source link

URock problem #73

Closed MajaWadling closed 1 week ago

MajaWadling commented 2 months ago

Hi, I got a problem with URock. When I tried to run the tool this error popped up:

QGIS version: 3.34.5-Prizren QGIS code revision: 4b308492 Qt version: 5.15.3 Python version: 3.9.18 GDAL version: 3.8.4 GEOS version: 3.12.1-CAPI-1.18.1 PROJ version: Rel. 9.3.1, December 1st, 2023 PDAL version: 2.6.0 (git-version: 3fced5) Algorithm started at: 2024-04-19T10:53:28 Algorithm 'Urban Wind Field: URock v2023a' starting… Input parameters: { 'ATTENUATION_FIELD' : '', 'BUILDINGS' : 'C:/Users/User/Documents/ES2423/Redegatan_data/SHP/urock_buildings.shp', 'HEIGHT_FIELD_BUILD' : 'ROOF_HEIGH', 'HORIZONTAL_RESOLUTION' : 2, 'INPUT_PROFILE_FILE' : '', 'INPUT_PROFILE_TYPE' : 0, 'INPUT_WIND_DIRECTION' : 295, 'INPUT_WIND_HEIGHT' : 10, 'INPUT_WIND_SPEED' : 3.8, 'LOAD_OUTPUT' : True, 'OUTPUT_FILENAME' : 'urock_output', 'RASTER_OUTPUT' : 'C:/Users/User/Documents/ES2423/Redegatan_data/TIF/New_dsm2022.tif', 'SAVE_NETCDF' : True, 'SAVE_RASTER' : True, 'SAVE_VECTOR' : True, 'UROCK_OUTPUT' : 'TEMPORARY_OUTPUT', 'VEGETATION' : 'C:/Users/User/Documents/ES2423/Redegatan_data/SHP/urock_veg.shp', 'VEGETATION_CROWN_BASE_HEIGHT' : '', 'VEGETATION_CROWN_TOP_HEIGHT' : 'VEG_HEIGHT', 'VERTICAL_RESOLUTION' : 2, 'WIND_HEIGHT' : '1.5' }

Writing settings for this model run to specified output folder (Filename: RunInfoURock_YYYY_DOY_HHMM.txt) Initiating algorithm Creates an H2GIS Instance and load data Traceback (most recent call last): File "JdbcPreparedStatement.java", line 237, in org.h2.jdbc.JdbcPreparedStatement.execute java.lang.java.lang.IndexOutOfBoundsException: java.lang.IndexOutOfBoundsException

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "JdbcPreparedStatement.java", line 237, in org.h2.jdbc.JdbcPreparedStatement.execute java.sql.java.sql.SQLException: java.sql.SQLException

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "JdbcPreparedStatement.java", line 237, in org.h2.jdbc.JdbcPreparedStatement.execute java.sql.java.sql.SQLException: java.sql.SQLException: INSERT INTO TEMPO VALUES (DEFAULT, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? ) null

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "JdbcPreparedStatement.java", line 237, in org.h2.jdbc.JdbcPreparedStatement.execute Exception: Java Exception

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "C:\Users\User\AppData\Roaming\Python\Python39\site-packages\jaydebeapi__init__.py", line 534, in execute is_rs = self._prep.execute() org.h2.jdbc.org.h2.jdbc.JdbcSQLException: org.h2.jdbc.JdbcSQLException: INSERT INTO TEMPO VALUES (DEFAULT, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? ) null; SQL statement:

DROP TABLE IF EXISTS TEMPO, build_pre_srid_20240419105328; [0-200]

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "C:\Users/User/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\processing_umep\processor\urock_processing_algorithm.py", line 447, in processAlgorithm MainCalculation.main(javaEnvironmentPath = javaEnvVar, File "C:\Users/User/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\processing_umep\functions\URock\MainCalculation.py", line 135, in main loadData.loadData(fromCad = False, File "C:\Users/User/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\processing_umep\functions\URock\loadData.py", line 120, in loadData loadFile(cursor = cursor, File "C:\Users/User/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\processing_umep\functions\URock\loadData.py", line 318, in loadFile cursor.execute(""" File "C:\Users\User\AppData\Roaming\Python\Python39\site-packages\jaydebeapi__init.py", line 536, in execute _handle_sql_exception() File "C:\Users\User\AppData\Roaming\Python\Python39\site-packages\jaydebeapi__init__.py", line 165, in _handle_sql_exception_jpype reraise(exc_type, exc_info[1], exc_info[2]) File "C:\Users\User\AppData\Roaming\Python\Python39\site-packages\jaydebeapi__init__.py", line 57, in reraise raise value.with_traceback(tb) File "C:\Users\User\AppData\Roaming\Python\Python39\site-packages\jaydebeapi\init__.py", line 534, in execute is_rs = self._prep.execute() jaydebeapi.DatabaseError: org.h2.jdbc.JdbcSQLException: INSERT INTO TEMPO VALUES (DEFAULT, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? ) null; SQL statement:

DROP TABLE IF EXISTS TEMPO, build_pre_srid_20240419105328; [0-200]

Execution failed after 0.17 seconds

Loading resulting layers Algorithm 'Urban Wind Field: URock v2023a' finished

I think it has something to to with the building vector, but I do not now exactly what it is. I have tried to modify the input values and taken buildings that have no values.

I also got a problem when I only ran with a vegetation vector. This error occured when I did that:

QGIS version: 3.34.5-Prizren QGIS code revision: 4b308492 Qt version: 5.15.3 Python version: 3.9.18 GDAL version: 3.8.4 GEOS version: 3.12.1-CAPI-1.18.1 PROJ version: Rel. 9.3.1, December 1st, 2023 PDAL version: 2.6.0 (git-version: 3fced5) Algorithm started at: 2024-04-19T11:06:05 Algorithm 'Urban Wind Field: URock v2023a' starting… Input parameters: { 'ATTENUATION_FIELD' : '', 'BUILDINGS' : None, 'HEIGHT_FIELD_BUILD' : '', 'HORIZONTAL_RESOLUTION' : 2, 'INPUT_PROFILE_FILE' : '', 'INPUT_PROFILE_TYPE' : 0, 'INPUT_WIND_DIRECTION' : 45, 'INPUT_WIND_HEIGHT' : 10, 'INPUT_WIND_SPEED' : 2, 'LOAD_OUTPUT' : True, 'OUTPUT_FILENAME' : 'urock_output', 'RASTER_OUTPUT' : 'C:/Users/User/Documents/ES2423/Redegatan_data/TIF/New_dsm2022.tif', 'SAVE_NETCDF' : True, 'SAVE_RASTER' : True, 'SAVE_VECTOR' : True, 'UROCK_OUTPUT' : 'TEMPORARY_OUTPUT', 'VEGETATION' : 'C:/Users/User/Documents/ES2423/Redegatan_data/SHP/urock_veg.shp', 'VEGETATION_CROWN_BASE_HEIGHT' : '', 'VEGETATION_CROWN_TOP_HEIGHT' : 'VEG_HEIGHT', 'VERTICAL_RESOLUTION' : 2, 'WIND_HEIGHT' : '1.5' }

Traceback (most recent call last): File "C:\Users/User/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\processing_umep\processor\urock_processing_algorithm.py", line 425, in processAlgorithm if inputBuildinglayer.crs().postgisSrid() != outputRaster.crs().postgisSrid(): AttributeError: 'NoneType' object has no attribute 'crs'

Execution failed after 0.03 seconds

Loading resulting layers Algorithm 'Urban Wind Field: URock v2023a' finished

j3r3m1 commented 2 months ago

Hi @MajaWadling thank you for reporting. Can you share with us your data ? Unfortunately I will not be available for a week but sharing your data might make others able to help you if the problem comes from the data. If it is really a bug coming from URock, I will look at that within 10 days.

MajaWadling commented 2 months ago

Okay, thank you! Here is the data. URock_data.zip

MajaWadling commented 2 months ago

I realised that it worked with a smaller area.

j3r3m1 commented 2 months ago

Thank you for the update. It actually comes from buildings or polygons being empty or having strange geometries. Thes geometries are probably not in your subset, which may explain why it works with the smaller area you have selected.

As you may know, URock is working based on the H2GIS database. The problem comes from there, I have logged an issue on the H2GIS repo and this will be solved soon (https://github.com/orbisgis/h2gis/issues/1379). But for now you can solve this problem simply saving your file as a geojson, as the problem has been solved for this type of data so far. I have tested it works fine.

However, I would advice you to split your zone in several parts since it is big right now (1000 m x 900 m). I think divided in 9 using a 2 m resolution or in 4 using a 3 m resolution should work.

MajaWadling commented 1 month ago

Thank you for the help @j3r3m1!

j3r3m1 commented 1 month ago

@MajaWadling can you please retry with the last UMEP version (download the zip file here ?

Once downloaded, you should import directly the zip into QGIS in the "Plugin" -> "Manage and install Plugins" -> "Install from zip". Reload QGIS if needed.

j3r3m1 commented 1 week ago

I consider it solved, feel free to reopen if not the case