Git Product home page Git Product logo

Comments (16)

rarygit avatar rarygit commented on September 26, 2024

Trying to understand the error by interpreting the Traceback output.

(i) In relation to the error, are the following issues linked?
"0 possible locations for trees..." This is the starting point
mtran.pyx: 'a' cannot be empty unless no samples are taken

(ii) Does my error begin with this function script: "StartingPositions.py"?

To a novice the Traceback output seems obtuse and hard to follow.

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Running hill climbing algorithm with genetic algorithm for starting positions...
0 possible locations for trees...

File "/home/l1nux/.local/share/QG
IS/QGIS3/profiles/default/python/plugins/UMEP-processing-main/processor/treeplanter_algorithm.py",
line 373, in processAlgorithm t_y, t_x, tmrt_max = TreePlanterHillClimber.treeoptinit(treerasters, cropped_rasters, positions, treedata,

File "/home/l1nux/.local/share/QGIS/QGIS3/profiles/default/python/plugins/UMEP-processing-main/functions/TreePlanter/TreePlanter/TreePlanterHillClimber.py",
line 73, in treeoptinit StartingPositions.genetic_start(tree_pos_x, tree_pos_y, tree_pos_c, positions, trees, tree_pos_all,

File "/home/l1nux/.local/share/QGIS/QGIS3/profiles/default/python/plugins/UMEP-processing-main/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 "/home/l1nux/.local/share/QGIS/QGIS3/profiles/default/python/plugins/UMEP-processing-main/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 909, in numpy.random.mtrand.RandomState.choice
ValueError: 'a' cannot be empty unless no samples are taken

from umep-processing.

rarygit avatar rarygit commented on September 26, 2024

Started new test with QGIS v3.16 and both UMEP Processing v1.1 (Zenodo) and v1.3 (GitHub)

It seems the From time parameter setting in the TreePlanter tutorial doesn't work for either 13:00 or 10:00 (hour).
From time parameter setting 11:00 works.

From (hour): 11:00
Thru (hour): 15:00

Successfully tested for 1, 2, and 3 trees

From (hour): 10:00 or 13:00, both failed with same error: ValueError: 'a' cannot be empty unless no samples are taken

In future, how can I determine the appropriate From and Thru (hour) time settings?

OS: Ubuntu 20.04 (conda activate qgis_16)
QGIS version: 3.16.4-Hannover
Qt version: 5.12.9
GDAL version: 3.2.1
GEOS version: 3.9.0-CAPI-1.14.1
PROJ version: Rel. 7.2.0, November 1st, 2020
Processing algorithm…
Algorithm 'Outdoor Thermal Comfort: TreePlanter' starting…
Input parameters:
{ 'DIA' : 5, 'END_HOUR' : 15, 'GREEDY_ALGORITHM' : False, 'HEIGHT' : 10, 'INCLUDE_OUTSIDE' : True, 'INPUT_POLYGONLAYER' : '/media/l1nux/SAN240/SIM/WIP_UMEP/TreePlantTut/TreePlanterTestData/planting_area.shp', 'ITERATIONS' : 2000, 'NTREE' : 3, 'OUTPUT_CDSM' : 'TEMPORARY_OUTPUT', 'OUTPUT_POINTFILE' : 'TEMPORARY_OUTPUT', 'RANDOM_STARTING' : False, 'SOLWEIG_DIR' : '/media/l1nux/SAN240/SIM/WIP_UMEP/TreePlantTut/TreePlanterTestData/SOLWEIG_OUT2', 'START_HOUR' : 11, 'TRANS_VEG' : 3, 'TRUNK' : 3, 'TTYPE' : 0 }

Initializing and loading layers...
Loading /media/l1nux/SAN240/SIM/WIP_UMEP/TreePlantTut/TreePlanterTestData/SOLWEIG_OUT2/Shadow_1983_173_1100D.tif..
Loading /media/l1nux/SAN240/SIM/WIP_UMEP/TreePlantTut/TreePlanterTestData/SOLWEIG_OUT2/Tmrt_1983_173_1500D.tif..
Loading /media/l1nux/SAN240/SIM/WIP_UMEP/TreePlantTut/TreePlanterTestData/SOLWEIG_OUT2/Shadow_1983_173_0400D.tif..
Loading /media/l1nux/SAN240/SIM/WIP_UMEP/TreePlantTut/TreePlanterTestData/SOLWEIG_OUT2/Tmrt_1983_173_2000D.tif..
Loading /media/l1nux/SAN240/SIM/WIP_UMEP/TreePlantTut/TreePlanterTestData/SOLWEIG_OUT2/Shadow_1983_173_1900D.tif..
Loading /media/l1nux/SAN240/SIM/WIP_UMEP/TreePlantTut/TreePlanterTestData/SOLWEIG_OUT2/Tmrt_1983_173_0300N.tif..
Loading /media/l1nux/SAN240/SIM/WIP_UMEP/TreePlantTut/TreePlanterTestData/SOLWEIG_OUT2/Shadow_1983_173_2100D.tif..
Loading /media/l1nux/SAN240/SIM/WIP_UMEP/TreePlantTut/TreePlanterTestData/SOLWEIG_OUT2/Tmrt_1983_173_0400D.tif..
Loading /media/l1nux/SAN240/SIM/WIP_UMEP/TreePlantTut/TreePlanterTestData/SOLWEIG_OUT2/Shadow_1983_173_0100N.tif..
Loading /media/l1nux/SAN240/SIM/WIP_UMEP/TreePlantTut/TreePlanterTestData/SOLWEIG_OUT2/Tmrt_1983_173_0200N.tif..
Running hill climbing algorithm with genetic algorithm for starting positions...
1606 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 368.43 seconds
Results:
{'OUTPUT_CDSM': '/tmp/processing_ytzApy/7f317aa4cd0949f9b291c2187fcf504b/OUTPUT_CDSM.tif',
'OUTPUT_POINTFILE': '/tmp/processing_ytzApy/eec2f50deb3647898eb385136ee68a62/OUTPUT_POINTFILE.gpkg'}

Loading resulting layers
Algorithm 'Outdoor Thermal Comfort: TreePlanter' finished

from umep-processing.

nilswallenberg avatar nilswallenberg commented on September 26, 2024

Hi rarygit,

Thank you for trying out TreePlanter! Much appreciated!

I have located the error, which seems to be glob.glob (when loading input data), which isn't necessarily sorting files by name (depends on operating system, it does in Windows, but not in Linux).

I have attached a new version. Hope it works!
UMEP-processing-main_rarygit.zip

Cheers,
Nils

from umep-processing.

rarygit avatar rarygit commented on September 26, 2024

Hi Nils, thanks for the explanation and upload!

I will test it now.

In the metadata.txt file it says that this is UMEP-Processing, version 1.1

Should the new version be given as 1.3.1 ?
That is, with the previous bug fixes?

from umep-processing.

rarygit avatar rarygit commented on September 26, 2024

Recreated all the inputs using your new version (SVF, SOLWEIG etc)

No; TreePlanterfailed with same error if time period is 13:00 to 15:00
Succeeds with 11:00 to 15:00

Initializing and loading layers...
Running hill climbing algorithm with genetic algorithm for starting positions...
0 possible locations for trees...
Traceback (most recent call last):
File "/home/l1nux/.local/share/QGIS/QGIS3/profiles/default/python/plugins/UMEP-processing-main/processor/treeplanter_algorithm.py", line 373, in processAlgorithm
t_y, t_x, tmrt_max = TreePlanterHillClimber.treeoptinit(treerasters, cropped_rasters, positions, treedata,
File "/home/l1nux/.local/share/QGIS/QGIS3/profiles/default/python/plugins/UMEP-processing-main/functions/TreePlanter/TreePlanter/TreePlanterHillClimber.py", line 73, in treeoptinit
StartingPositions.genetic_start(tree_pos_x, tree_pos_y, tree_pos_c, positions, trees, tree_pos_all,
File "/home/l1nux/.local/share/QGIS/QGIS3/profiles/default/python/plugins/UMEP-processing-main/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 "/home/l1nux/.local/share/QGIS/QGIS3/profiles/default/python/plugins/UMEP-processing-main/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 909, in numpy.random.mtrand.RandomState.choice
ValueError: 'a' cannot be empty unless no samples are taken

Execution failed after 0.35 seconds

from umep-processing.

rarygit avatar rarygit commented on September 26, 2024

The Date/Time stamps for all the files in your new archive is 2021-03-18 09:37
Only the folders have 2021-05-31 10:14

Did you change any of the files?

from umep-processing.

nilswallenberg avatar nilswallenberg commented on September 26, 2024

It doesn't seem to load any layers. Initializing and loading layers doesn't return anything as compared to your third entry, where it did return, but order was weird due to glob.glob.

What layers do you have in your SOLWEIG output directory that you use as input in TreePlanter?

UMEP-processing/processor/treeplanter_algorithm.py should be changed.

from umep-processing.

rarygit avatar rarygit commented on September 26, 2024

SOLWEIG_OUT3.zip

Attached is the input I created this morning using the new version - all in one folder, including the .qgz file

Inside you will find the SOLWEIG layers

from umep-processing.

rarygit avatar rarygit commented on September 26, 2024

There are three shadow maps (rasters) with false values (1.79769e+308):

Shadow_1983_173_0000N.tif to Shadow_1983_173_0300N.tif

from umep-processing.

nilswallenberg avatar nilswallenberg commented on September 26, 2024

Those shadow raster's are fine, they are when sun is below the horizon, i.e. no shadows.

Hmm, have to think a bit. I can run with your SOLWEIG output on Ubuntu 20.04 with QGIS 3.18.3 and the code attached above.

What version of numpy do you have?

from umep-processing.

rarygit avatar rarygit commented on September 26, 2024

Hi Nils, if I experiment with different From (hours), Thru (hours) combinations, some work, others don't.

e.g. From 09:00 Thru 15:00 or 16:00 fails
From (hour) 09:00 Thru 17:00 (hour) succeeds

+++++++++++++++++++++++++++++++++++++++++++++

QGIS version: 3.16.4-Hannover
Qt version: 5.12.9
GDAL version: 3.2.1
GEOS version: 3.9.0-CAPI-1.14.1
PROJ version: Rel. 7.2.0, November 1st, 2020
Processing algorithm…
Algorithm 'Outdoor Thermal Comfort: TreePlanter' starting…
Input parameters:
{ 'DIA' : 5, 'END_HOUR' : 17, 'GREEDY_ALGORITHM' : False, 'HEIGHT' : 10, 'INCLUDE_OUTSIDE' : False, 'INPUT_POLYGONLAYER' : '/media/l1nux/SAN240/SIM/WIP_UMEP/TreePlantTut/TreePlanterTestData/planting_area.shp', 'ITERATIONS' : 2000, 'NTREE' : 1, 'OUTPUT_CDSM' : 'TEMPORARY_OUTPUT', 'OUTPUT_POINTFILE' : 'TEMPORARY_OUTPUT', 'RANDOM_STARTING' : False, 'SOLWEIG_DIR' : '/media/l1nux/SAN240/SIM/WIP_UMEP/TreePlantTut/TreePlanterTestData/SOLWEIG_OUT3', 'START_HOUR' : 9, 'TRANS_VEG' : 3, 'TRUNK' : 3, 'TTYPE' : 0 }

Initializing and loading layers...
Loading /media/l1nux/SAN240/SIM/WIP_UMEP/TreePlantTut/TreePlanterTestData/SOLWEIG_OUT3/Shadow_1983_173_0900D.tif..
Loading /media/l1nux/SAN240/SIM/WIP_UMEP/TreePlantTut/TreePlanterTestData/SOLWEIG_OUT3/Tmrt_1983_173_1600D.tif..
Loading /media/l1nux/SAN240/SIM/WIP_UMEP/TreePlantTut/TreePlanterTestData/SOLWEIG_OUT3/Shadow_1983_173_1100D.tif..
Loading /media/l1nux/SAN240/SIM/WIP_UMEP/TreePlantTut/TreePlanterTestData/SOLWEIG_OUT3/Tmrt_1983_173_1500D.tif..
Loading /media/l1nux/SAN240/SIM/WIP_UMEP/TreePlantTut/TreePlanterTestData/SOLWEIG_OUT3/Shadow_1983_173_0400D.tif..
Loading /media/l1nux/SAN240/SIM/WIP_UMEP/TreePlantTut/TreePlanterTestData/SOLWEIG_OUT3/Tmrt_1983_173_2000D.tif..
Loading /media/l1nux/SAN240/SIM/WIP_UMEP/TreePlantTut/TreePlanterTestData/SOLWEIG_OUT3/Shadow_1983_173_1900D.tif..
Loading /media/l1nux/SAN240/SIM/WIP_UMEP/TreePlantTut/TreePlanterTestData/SOLWEIG_OUT3/Tmrt_1983_173_0300N.tif..
Loading /media/l1nux/SAN240/SIM/WIP_UMEP/TreePlantTut/TreePlanterTestData/SOLWEIG_OUT3/Shadow_1983_173_2100D.tif..
Loading /media/l1nux/SAN240/SIM/WIP_UMEP/TreePlantTut/TreePlanterTestData/SOLWEIG_OUT3/Tmrt_1983_173_0400D.tif..
Loading /media/l1nux/SAN240/SIM/WIP_UMEP/TreePlantTut/TreePlanterTestData/SOLWEIG_OUT3/Shadow_1983_173_0100N.tif..
Loading /media/l1nux/SAN240/SIM/WIP_UMEP/TreePlantTut/TreePlanterTestData/SOLWEIG_OUT3/Tmrt_1983_173_0200N.tif..
Loading /media/l1nux/SAN240/SIM/WIP_UMEP/TreePlantTut/TreePlanterTestData/SOLWEIG_OUT3/Shadow_1983_173_1500D.tif..
Loading /media/l1nux/SAN240/SIM/WIP_UMEP/TreePlantTut/TreePlanterTestData/SOLWEIG_OUT3/Tmrt_1983_173_0900D.tif..
Loading /media/l1nux/SAN240/SIM/WIP_UMEP/TreePlantTut/TreePlanterTestData/SOLWEIG_OUT3/Shadow_1983_173_0200N.tif..
Loading /media/l1nux/SAN240/SIM/WIP_UMEP/TreePlantTut/TreePlanterTestData/SOLWEIG_OUT3/Tmrt_1983_173_1100D.tif..
Loading /media/l1nux/SAN240/SIM/WIP_UMEP/TreePlantTut/TreePlanterTestData/SOLWEIG_OUT3/Shadow_1983_173_0000N.tif..
Loading /media/l1nux/SAN240/SIM/WIP_UMEP/TreePlantTut/TreePlanterTestData/SOLWEIG_OUT3/Tmrt_1983_173_2100D.tif..
Loading /media/l1nux/SAN240/SIM/WIP_UMEP/TreePlantTut/TreePlanterTestData/SOLWEIG_OUT3/Shadow_1983_173_0700D.tif..
Loading /media/l1nux/SAN240/SIM/WIP_UMEP/TreePlantTut/TreePlanterTestData/SOLWEIG_OUT3/Tmrt_average.tif..
Loading /media/l1nux/SAN240/SIM/WIP_UMEP/TreePlantTut/TreePlanterTestData/SOLWEIG_OUT3/Shadow_1983_173_0600D.tif..
Loading /media/l1nux/SAN240/SIM/WIP_UMEP/TreePlantTut/TreePlanterTestData/SOLWEIG_OUT3/Tmrt_1983_173_0100N.tif..
Loading /media/l1nux/SAN240/SIM/WIP_UMEP/TreePlantTut/TreePlanterTestData/SOLWEIG_OUT3/Shadow_1983_173_1300D.tif..
Loading /media/l1nux/SAN240/SIM/WIP_UMEP/TreePlantTut/TreePlanterTestData/SOLWEIG_OUT3/Tmrt_1983_173_0600D.tif..
Loading /media/l1nux/SAN240/SIM/WIP_UMEP/TreePlantTut/TreePlanterTestData/SOLWEIG_OUT3/Shadow_1983_173_1000D.tif..
Loading /media/l1nux/SAN240/SIM/WIP_UMEP/TreePlantTut/TreePlanterTestData/SOLWEIG_OUT3/Tmrt_1983_173_1000D.tif..
Tree shade ineffective outside planting area...
Running hill climbing algorithm with genetic algorithm for starting positions...
TreePlanter: Model calculation finished.
Execution completed in 10.59 seconds
Results:
{'OUTPUT_CDSM': '/tmp/processing_AHeByT/4171aed2d2614f22846447b4ed2fa93e/OUTPUT_CDSM.tif',
'OUTPUT_POINTFILE': '/tmp/processing_AHeByT/a94a1336f7694720bf6558b533d61e82/OUTPUT_POINTFILE.gpkg'}

Loading resulting layers
Algorithm 'Outdoor Thermal Comfort: TreePlanter' finished

from umep-processing.

nilswallenberg avatar nilswallenberg commented on September 26, 2024

Have you tried removing the plugin and close QGIS, then reopen and install the new one that I attached here? It is still sorting the files in a weird order.

from umep-processing.

rarygit avatar rarygit commented on September 26, 2024

Ok, i will try this. And report back in an hour.

from umep-processing.

rarygit avatar rarygit commented on September 26, 2024

Now it worked! From (hour) 13:00 Thru (hour) 15:00
As below.

Can I install UMEP-Processing v1.3 and then overwrite treeplanter_algorithm.py with your new version?
Or will you upload v1.3.1 to GitHub?

+++++++++++++++++++++++++++++++++++++++++++

QGIS version: 3.16.4-Hannover
Qt version: 5.12.9
GDAL version: 3.2.1
GEOS version: 3.9.0-CAPI-1.14.1
PROJ version: Rel. 7.2.0, November 1st, 2020
Processing algorithm…
Algorithm 'Outdoor Thermal Comfort: TreePlanter' starting…
Input parameters:
{ 'DIA' : 5, 'END_HOUR' : 15, 'GREEDY_ALGORITHM' : False, 'HEIGHT' : 10, 'INCLUDE_OUTSIDE' : True, 'INPUT_POLYGONLAYER' : '/media/l1nux/SAN240/SIM/WIP_UMEP/TreePlantTut/TreePlanterTestData/planting_area.shp', 'ITERATIONS' : 2000, 'NTREE' : 3, 'OUTPUT_CDSM' : '/media/l1nux/SAN240/SIM/WIP_UMEP/TreePlantTut/TreePlanterTestData/SOLWEIG_OUT3/TreePlanter_OUT/treeplanter_cdsm.tif', 'OUTPUT_POINTFILE' : '/media/l1nux/SAN240/SIM/WIP_UMEP/TreePlantTut/TreePlanterTestData/SOLWEIG_OUT3/TreePlanter_OUT/treeplanter_points.shp', 'RANDOM_STARTING' : False, 'SOLWEIG_DIR' : '/media/l1nux/SAN240/SIM/WIP_UMEP/TreePlantTut/TreePlanterTestData/SOLWEIG_OUT3', 'START_HOUR' : 13, 'TRANS_VEG' : 3, 'TRUNK' : 3, 'TTYPE' : 0 }

Initializing and loading layers...
Loading /media/l1nux/SAN240/SIM/WIP_UMEP/TreePlantTut/TreePlanterTestData/SOLWEIG_OUT3/Shadow_1983_173_1300D.tif..
Loading /media/l1nux/SAN240/SIM/WIP_UMEP/TreePlantTut/TreePlanterTestData/SOLWEIG_OUT3/Tmrt_1983_173_1300D.tif..
Loading /media/l1nux/SAN240/SIM/WIP_UMEP/TreePlantTut/TreePlanterTestData/SOLWEIG_OUT3/Shadow_1983_173_1400D.tif..
Loading /media/l1nux/SAN240/SIM/WIP_UMEP/TreePlantTut/TreePlanterTestData/SOLWEIG_OUT3/Tmrt_1983_173_1400D.tif..
Running hill climbing algorithm with genetic algorithm for starting positions...
1600 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 64.05 seconds
Results:
{'OUTPUT_CDSM': '/media/l1nux/SAN240/SIM/WIP_UMEP/TreePlantTut/TreePlanterTestData/SOLWEIG_OUT3/TreePlanter_OUT/treeplanter_cdsm.tif',
'OUTPUT_POINTFILE': '/media/l1nux/SAN240/SIM/WIP_UMEP/TreePlantTut/TreePlanterTestData/SOLWEIG_OUT3/TreePlanter_OUT/treeplanter_points.shp'}

Loading resulting layers
Algorithm 'Outdoor Thermal Comfort: TreePlanter' finished

from umep-processing.

rarygit avatar rarygit commented on September 26, 2024

Hi Nils, thanks for fixing that problem.
The code now runs faster than before.

Which line was the problem in "treeplanter_algorithm.py" ?

from umep-processing.

nilswallenberg avatar nilswallenberg commented on September 26, 2024

Great! It was in line 256-257.

I have to check if there will be an update today, or later.

Thank you again for testing! :)

from umep-processing.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.