UMEP-dev / UMEP-processing

7 stars 9 forks source link

Treeplanter 0 possible location for trees #34

Closed dawgermany closed 6 months ago

dawgermany commented 11 months ago

Hi, when trying to use Treeplanter with a shapefile containing a single polygon, Treeplanter runs but says there are 0 possible locations. it then proceeds to place all three tree on top of each other in the upper left corner of the layer.

QGIS version: 3.32.0-Lima
QGIS code revision: b9862de816
Qt version: 5.15.2
Python version: 3.9.5
GDAL version: 3.3.2
GEOS version: 3.9.1-CAPI-1.14.2
PROJ version: Rel. 8.1.1, September 1st, 2021
PDAL version: 2.3.0 (git-version: Release)
Algorithm started at: 2023-07-21T18:53:03
Algorithm 'Outdoor Thermal Comfort: TreePlanter v1.0.1' starting…
Input parameters:
{ 'DIA' : 5, 'END_HOUR' : 15, 'GREEDY_ALGORITHM' : False, 'HEIGHT' : 10, 'INCLUDE_OUTSIDE' : True, 'INPUT_POLYGONLAYER' : '/Users/USERNAME/Desktop/Uni_2/Bachelor/GIS_Daten/BA/platz_shp.shp', 'ITERATIONS' : 2000, 'NTREE' : 3, 'OUTPUT_CDSM' : 'TEMPORARY_OUTPUT', 'OUTPUT_POINTFILE' : 'TEMPORARY_OUTPUT', 'RANDOM_STARTING' : False, 'SOLWEIG_DIR' : '/Users/USERNAME/Desktop/Uni_2/Bachelor/GIS_Daten/BA/solweig_test', 'START_HOUR' : 13, 'TRANS_VEG' : 3, 'TRUNK' : 3, 'TTYPE' : 0 }

Starting model at 2023-07-21 18:53:03.554962...
Initializing and loading layers...
Loading /Users/USERNAME/Desktop/Uni_2/Bachelor/GIS_Daten/BA/solweig_test/Shadow_2022_200_1300D.tif..
Loading /Users/USERNAME/Desktop/Uni_2/Bachelor/GIS_Daten/BA/solweig_test/Tmrt_2022_200_1300D.tif..
Loading /Users/USERNAME/Desktop/Uni_2/Bachelor/GIS_Daten/BA/solweig_test/Shadow_2022_200_1400D.tif..
Loading /Users/USERNAME/Desktop/Uni_2/Bachelor/GIS_Daten/BA/solweig_test/Tmrt_2022_200_1400D.tif..
Running hill climbing algorithm with genetic algorithm for starting positions...
0 possible locations for trees...
10.0 percent of iterations finished...
20.0 percent of iterations finished...
30.0 percent of iterations finished...
40.0 percent of iterations finished...
50.0 percent of iterations finished...
60.0 percent of iterations finished...
70.0 percent of iterations finished...
80.0 percent of iterations finished...
90.0 percent of iterations finished...
TreePlanter: Model calculation finished.
Execution completed in 12.57 seconds
Results:
{'OUTPUT_CDSM': '/private/var/folders/pj/9cktp88d6n5d6n8rld_4bksh0000gn/T/processing_hqHHbR/7b15650a72d045cabaec9ddb7d6b95c6/OUTPUT_CDSM.tif',
'OUTPUT_POINTFILE': '/private/var/folders/pj/9cktp88d6n5d6n8rld_4bksh0000gn/T/processing_hqHHbR/22f1edc808af4e11a96e1c599368544f/OUTPUT_POINTFILE.gpkg'}

Loading resulting layers
Algorithm 'Outdoor Thermal Comfort: TreePlanter v1.0.1' finished

The output looks like this:

Bildschirmfoto 2023-07-21 um 19 01 49

The Version of UMEP-processing used was cloned from this repo today Also when trying to use vector on .gpkg format it doesn´t work at all... The SOLWEIG output was generated with "save files for treeplanter" checked

dawgermany commented 11 months ago

I also tried to modify planting_area.shp from the demo data, but it produces the same kind of behaviour as with mine made from scratch. tried using crs:3007 instead gf crs:25832, didn´t change anything. same result when trying selected features only as #35. i do not have any idea what could be wrong with my data or setup and am really at the ends of my (limited) wits

dawgermany commented 11 months ago

Tried reprojecting to epsg:4326 which gave me this output trying to use the temporary layer

QGIS version: 3.32.0-Lima
QGIS code revision: b9862de816
Qt version: 5.15.2
Python version: 3.9.5
GDAL version: 3.3.2
GEOS version: 3.9.1-CAPI-1.14.2
PROJ version: Rel. 8.1.1, September 1st, 2021
PDAL version: 2.3.0 (git-version: Release)
Algorithm started at: 2023-07-21T19:47:31
Algorithm 'Outdoor Thermal Comfort: TreePlanter v1.0.1' starting…
Input parameters:
{ 'DIA' : 5, 'END_HOUR' : 15, 'GREEDY_ALGORITHM' : False, 'HEIGHT' : 10, 'INCLUDE_OUTSIDE' : True, 'INPUT_POLYGONLAYER' : 'memory://MultiPolygon?crs=EPSG:4326&field=id:long(10,0)&uid={2b1faa9d-4f6c-4275-9485-3cfe7ef6deca}', 'ITERATIONS' : 2000, 'NTREE' : 3, 'OUTPUT_CDSM' : 'TEMPORARY_OUTPUT', 'OUTPUT_POINTFILE' : 'TEMPORARY_OUTPUT', 'RANDOM_STARTING' : False, 'SOLWEIG_DIR' : '/Users/USERNAME/Desktop/Uni_2/Bachelor/GIS_Daten/BA/solweig_test', 'START_HOUR' : 13, 'TRANS_VEG' : 3, 'TRUNK' : 3, 'TTYPE' : 0 }

Starting model at 2023-07-21 19:47:31.738658...
Initializing and loading layers...
Loading /Users/USERNAME/Desktop/Uni_2/Bachelor/GIS_Daten/BA/solweig_test/Shadow_2022_200_1300D.tif..
Loading /Users/USERNAME/Desktop/Uni_2/Bachelor/GIS_Daten/BA/solweig_test/Tmrt_2022_200_1300D.tif..
Loading /Users/USERNAME/Desktop/Uni_2/Bachelor/GIS_Daten/BA/solweig_test/Shadow_2022_200_1400D.tif..
Loading /Users/USERNAME/Desktop/Uni_2/Bachelor/GIS_Daten/BA/solweig_test/Tmrt_2022_200_1400D.tif..
Traceback (most recent call last):
File "/Users/USERNAME/Library/Application Support/QGIS/QGIS3/profiles/default/python/plugins/UMEP-processing-main/postprocessor/treeplanter_algorithm.py", line 279, in processAlgorithm
tree_input = Inputdata(r_range, sh_fl, tmrt_fl, infolder, inputPolygonlayer, feedback)
File "/Users/USERNAME/Library/Application Support/QGIS/QGIS3/profiles/default/python/plugins/UMEP-processing-main/functions/TreePlanter/TreePlanter/TreePlanterClasses.py", line 95, in __init__
self.selected_area = dataSetSel.ReadAsArray().astype(float)
AttributeError: 'NoneType' object has no attribute 'ReadAsArray'

Execution failed after 0.02 seconds

after saving as shapefile it gave me a different error

QGIS version: 3.32.0-Lima
QGIS code revision: b9862de816
Qt version: 5.15.2
Python version: 3.9.5
GDAL version: 3.3.2
GEOS version: 3.9.1-CAPI-1.14.2
PROJ version: Rel. 8.1.1, September 1st, 2021
PDAL version: 2.3.0 (git-version: Release)
Algorithm started at: 2023-07-21T19:48:44
Algorithm 'Outdoor Thermal Comfort: TreePlanter v1.0.1' starting…
Input parameters:
{ 'DIA' : 5, 'END_HOUR' : 15, 'GREEDY_ALGORITHM' : False, 'HEIGHT' : 10, 'INCLUDE_OUTSIDE' : True, 'INPUT_POLYGONLAYER' : '/Users/USERNAME/Desktop/Uni_2/Bachelor/GIS_Daten/BA/testplatz_wgs84.shp', 'ITERATIONS' : 2000, 'NTREE' : 3, 'OUTPUT_CDSM' : 'TEMPORARY_OUTPUT', 'OUTPUT_POINTFILE' : 'TEMPORARY_OUTPUT', 'RANDOM_STARTING' : False, 'SOLWEIG_DIR' : '/Users/USERNAME/Desktop/Uni_2/Bachelor/GIS_Daten/BA/solweig_test', 'START_HOUR' : 13, 'TRANS_VEG' : 3, 'TRUNK' : 3, 'TTYPE' : 0 }

Starting model at 2023-07-21 19:48:44.834968...
Initializing and loading layers...
Loading /Users/USERNAME/Desktop/Uni_2/Bachelor/GIS_Daten/BA/solweig_test/Shadow_2022_200_1300D.tif..
Loading /Users/USERNAME/Desktop/Uni_2/Bachelor/GIS_Daten/BA/solweig_test/Tmrt_2022_200_1300D.tif..
Loading /Users/USERNAME/Desktop/Uni_2/Bachelor/GIS_Daten/BA/solweig_test/Shadow_2022_200_1400D.tif..
Loading /Users/USERNAME/Desktop/Uni_2/Bachelor/GIS_Daten/BA/solweig_test/Tmrt_2022_200_1400D.tif..
Traceback (most recent call last):
File "/Users/USERNAME/Library/Application Support/QGIS/QGIS3/profiles/default/python/plugins/UMEP-processing-main/postprocessor/treeplanter_algorithm.py", line 350, in processAlgorithm
cropped_rasters = ClippedInputdata(tree_input, treerasters)
File "/Users/USERNAME/Library/Application Support/QGIS/QGIS3/profiles/default/python/plugins/UMEP-processing-main/functions/TreePlanter/TreePlanter/TreePlanterClasses.py", line 280, in __init__
self.clip_rows[0] = sa_rows.min() - treerasters.buffer_y[0]
File "/Applications/QGIS_3.32.app/Contents/MacOS/lib/python3.9/site-packages/numpy/core/_methods.py", line 44, in _amin
return umr_minimum(a, axis, None, out, keepdims, initial, where)
ValueError: zero-size array to reduction operation minimum which has no identity

Execution failed after 0.34 seconds

Loading resulting layers
Algorithm 'Outdoor Thermal Comfort: TreePlanter v1.0.1' finished
dawgermany commented 11 months ago

testing with some previous version:

umep processing version 1.1 downloaded from the codesource linked in the paper "Locating trees to mitigate outdoor radiant load of humans in urban areas using a metaheuristic hill-climbing algorithm – introducing TreePlanter v1.0" works on the same setup as before (allthough a bit unstable depending on changed parameters other then treenumber - which is probably to be expected given the amount of newer umep versions since then)


cloned github repo doesnt work with versions (Date of the commithistory downloaded)

Bildschirmfoto 2023-07-24 um 12 02 27

Issue #35 is present in umep processing v1.1

nilswallenberg commented 10 months ago

Hi,

Could you please attach your data and I will see what's wrong.

Cheers, Nils

rishiraj88 commented 10 months ago

Quite interesting! I'd love to follow closely, learn and contribute.

dawgermany commented 10 months ago

Hi,

Could you please attach your data and I will see what's wrong.

Cheers, Nils

tp_issue_attachment.zip

There should be all necessary data in here, i cut a lot of unecessary stuff so dont worry about missing files in the project

cheers

nilswallenberg commented 10 months ago

Sorry for the delay. I have uploaded some new code that hopefully fixes your problem. :)

Cheers, Nils

dawgermany commented 7 months ago

I tried to use the latest version of umep-processing and this issue persists

nilswallenberg commented 7 months ago

I am looking into this.

nilswallenberg commented 6 months ago

Hi again,

Sorry for the delay. Please give the new code a try (download from the repository and install in qgis via zip) and hopefully it works this time. Not sure how I got it to work last time but I have done some updates of the code now.

Cheers, Nils

nilswallenberg commented 6 months ago

Is this resolved? Can I close this issue?

Cheers, Nils

dawgermany commented 6 months ago

I am sorry for my lacking interaction on this matter 😅. I used UMEP a lot for a paper and my bachelors thesis in uni; since then I have started my masters and so i have to focus on different things again unfortunately. Right now I am so busy with these things, that it is hard for me to find time for further testing of UMEP. I loved (and hated but mostly loved) working with UMEP though so when I had a spare minute I quickly tested a past setup with the newer version of UMEP and noticed that the issue persisted in my case, so I thought id just drop a quick note. As I am on an apple M1 system the whole qgis environment is a bit of a mess, so it would take some time setting up my current version of QGIS to work with UMEP and to check that errors around coordinates and stuff is not due to PROJ being not set up correctly as well as checking that any python errors are not due to M1 architecture or apple specific installation caveats etc pp. If I find a minute I will do some testing, but atm that is not possible unfortunately. So please go ahead and close it for now👍. Also I appreciate all the efford you and the team put into the continued development and support of UMEP! Best Daw

nilswallenberg commented 6 months ago

Thank you! I will close this issue now.

Best, Nils