Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tree planter tool bug #52

Closed
HarshKamath opened this issue Nov 25, 2023 · 5 comments
Closed

Tree planter tool bug #52

HarshKamath opened this issue Nov 25, 2023 · 5 comments
Assignees

Comments

@HarshKamath
Copy link

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
Copy link
Author

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 nilswallenberg self-assigned this Nov 29, 2023
nilswallenberg added a commit that referenced this issue Dec 11, 2023
Fixed problem with TreePlanter error "0 possible locations for trees"
@nilswallenberg
Copy link
Collaborator

nilswallenberg commented Dec 11, 2023

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
Copy link
Collaborator

Is this resolved? Can I close this issue?

Cheers,
Nils

@HarshKamath
Copy link
Author

Hi Nils,

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

Many thanks,
Harsh

@nilswallenberg
Copy link
Collaborator

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants