UMEP-dev / UMEP

Urban Multi-scale Environmental Predictor
https://umep-docs.readthedocs.io/
59 stars 15 forks source link

Error in URock Analyzer #546

Closed biglimp closed 9 months ago

biglimp commented 10 months ago

I am getting an error when trying to make a profile plot following the instructions from the URock tutorial.

QGIS version: 3.30.3-'s-Hertogenbosch
QGIS code revision: 2411cec1
Qt version: 5.15.3
Python version: 3.9.5
GDAL version: 3.7.0
GEOS version: 3.11.2-CAPI-1.17.2
PROJ version: Rel. 9.2.0, March 1st, 2023
PDAL version: 2.5.3 (git-version: 7ec4e6)
Algorithm started at: 2023-09-07T16:02:24
Algorithm 'Urban Wind Field: URock AnalyZer' starting…
Input parameters:
{ 'ID_FIELD_LINES' : 'fid', 'ID_FIELD_POLYGONS' : '', 'INPUT_LINES' : 'C:/temp/URockTutorial/Annedal_EPSG3006/lineprofile.gpkg|layername=lineprofile', 'INPUT_POLYGONS' : None, 'INPUT_WIND_FILE' : 'C:\\temp\\URockTutorial\\urock_out\\urock_output.nc', 'IS_STREAM' : True, 'OUTPUT_DIRECTORY' : 'C:\\temp\\URockTutorial\\urock_out', 'SIMULATION_NAME' : '' }

Load NetCDF file in Python and save as csv file...
Load csv file into H2GIS Database...
Calculates vertical sectional plot (along lines)...
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\xlinfr\AppData\Roaming\Python\Python39\site-packages\jaydebeapi\__init__.py", line 534, in execute
is_rs = self._prep.execute()
org.h2.jdbc.org.h2.jdbc.JdbcSQLSyntaxErrorException: org.h2.jdbc.JdbcSQLSyntaxErrorException: Function "NONE" not found; SQL statement:

CALL None('C:/temp/URockTutorial/Annedal_EPSG3006/lineprofile.gpkg','TEMPO');
CREATE TABLE LINES_20230907160224
AS SELECT *
FROM TEMPO;
[90022-200]

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "C:\Users/xlinfr/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\processing_umep\postprocessor\urock_analyser_algorithm.py", line 251, in processAlgorithm
plotSectionalViews(pluginDirectory = plugin_directory,
File "C:\Users/xlinfr/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\processing_umep\functions\URock\urock_analyser_functions.py", line 198, in plotSectionalViews
loadFile(cursor = cursor,
File "C:\Users/xlinfr/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\processing_umep\functions\URock\loadData.py", line 318, in loadFile
cursor.execute("""
File "C:\Users\xlinfr\AppData\Roaming\Python\Python39\site-packages\jaydebeapi\__init__.py", line 536, in execute
_handle_sql_exception()
File "C:\Users\xlinfr\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\xlinfr\AppData\Roaming\Python\Python39\site-packages\jaydebeapi\__init__.py", line 57, in reraise
raise value.with_traceback(tb)
File "C:\Users\xlinfr\AppData\Roaming\Python\Python39\site-packages\jaydebeapi\__init__.py", line 534, in execute
is_rs = self._prep.execute()
jaydebeapi.DatabaseError: org.h2.jdbc.JdbcSQLSyntaxErrorException: Function "NONE" not found; SQL statement:

CALL None('C:/temp/URockTutorial/Annedal_EPSG3006/lineprofile.gpkg','TEMPO');
CREATE TABLE LINES_20230907160224
AS SELECT *
FROM TEMPO;
[90022-200]

Execution failed after 136.46 seconds (2 minutes 16 seconds)

Loading resulting layers
Algorithm 'Urban Wind Field: URock AnalyZer' finished
j3r3m1 commented 10 months ago

Vector files should be .shp or .geojson. Is there a simple way to set this constraint on the input ?

biglimp commented 10 months ago

No error when using shape but no output was created? What should come out, a jpg?

image

j3r3m1 commented 10 months ago

yes jpg in the figure folder you have selected

biglimp commented 10 months ago

No file created: image image

j3r3m1 commented 10 months ago

aha that is a bug ! Can you share netcdf and line files ?

biglimp commented 10 months ago

Too big for GH. Check your email.

biglimp commented 10 months ago

In the meantime I try to see if I can find a way to just include shp and json as input...

j3r3m1 commented 10 months ago

deal !

biglimp commented 10 months ago

I actually cant see any code to be used in the Processing framework that can allow for certain vector formats, only types of geometry (e.g. lines). My workaround suggestion is to convert to shape if any other format than shp or json is used.

j3r3m1 commented 9 months ago

OK I think I have found the problem. URock analyze is made to work using lines defined using only two points, your has 3. The idea of using one row per "two points line" is to use the ID of each line as figure name when plotting.

Two solutions:

What do you think ?

biglimp commented 9 months ago

Yes! Now it works. I suggest that you give an error and that the user must have lines with only two points. In QGIS language, points is called vertex (pl: vertices).

j3r3m1 commented 9 months ago

Solved in https://github.com/UMEP-dev/UMEP-processing/commit/4353e226de90cd81b6237797c595f789810d6525