UMEP-dev / UMEP-processing

7 stars 9 forks source link

Tree planter tool bug #52

Closed HarshKamath closed 6 months ago

HarshKamath commented 7 months ago

Hi,

I am trying to use the tree planter tool over Austin, Texas USA. I am using the latest version of UMEP for processing (2.0.13). I could run the SOLWEIG model to generate the mean radiant temperature maps successfully. However, I ran into some issues while using the tree planter tool. Here is the issue:

  1. When greedy algorithm is not used: It says '0 possible locations for trees...' and throws the following error Traceback (most recent call last): File "C:/Users/user/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\processing_umep\postprocessor\treeplanter_algorithm.py", line 408, in processAlgorithm shadow_rg, tmrt_1d, nTree, ITERATIONS, sa, feedback) File "C:/Users/user/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\processing_umep\functions\TreePlanter\TreePlanter\TreePlanterHillClimber.py", line 74, in treeoptinit r_iters, counter, dia) File "C:/Users/userAppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\processing_umep\functions\TreePlanter\TreePlanter\StartingPositions.py", line 35, in genetic_start tree_pos, tp_c, break_loop = random_start(pos, trees, tree_pos_all, r_iters) File "C:/Users/user/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\processing_umep\functions\TreePlanter\TreePlanter\StartingPositions.py", line 7, in random_start tree_pos = np.random.choice(pos, trees) # Random positions for trees File "mtrand.pyx", line 915, in numpy.random.mtrand.RandomState.choice ValueError: 'a' cannot be empty unless no samples are taken

Execution failed after 1.91 seconds

  1. When the greedy algorithm is used: There is no error but it says the the following Running with greedy algorithm... 0 possible locations for trees... Not enough space for all trees! Found locations for 0 out of 3 trees. TreePlanter: Model calculation finished. Execution completed in 2.06 seconds Results: {'OUTPUT_DIR': 'C:\Users\user\Desktop\Tree_planter\Tree_planter_output'} When greedy algorithm is used, it does create a CDSM.tif and points.shp file but the point.shp does not have any trees and CDSM.tif is the same as input CDSM.

I am facing the same issue on both Windows and Ubuntu systems. Please find my input files, SOLWEIG output and planting area shape file here: https://utexas.box.com/s/wcra2gb0voujfrpkcbprdst63f52wq32

All the files can be imported to QGIS using the 'Example.qgz' project file.

Any help will be much appreciated.

Thank you

HarshKamath commented 7 months ago

Also, the model runs correctly and produces desired results with the example data provided (https://umep-docs.readthedocs.io/projects/tutorial/en/latest/Tutorials/IntroductionToTreePlanter.html). This issue comes up when I am using my data.

Thanks

nilswallenberg commented 6 months ago

Hi,

I have updated the code. Hopefully it works now. Please give it a try (download from the repository and install in qgis via zip). :)

Cheers, Nils

nilswallenberg commented 6 months ago

Is this resolved? Can I close this issue?

Cheers, Nils

HarshKamath commented 6 months ago

Hi Nils,

Yes, the issue is now resolved. I could successfully run the model over my study area.

Many thanks, Harsh

nilswallenberg commented 6 months ago

Good to hear Harsh!

A side note and maybe you're already aware of this, but I saw that you ran SOLWEIG with UTC0, whereas Austin is UTC-6 (I think).

I will close this issue now.

Best, Nils