Closed rarygit closed 2 years ago
I assume when you write canopy height you mean crown height? This seems to be a rounding issue somewhere in the code. I will check when I find the time.
Can you please also attach your DSM
Thanks for replying!
Yes, crown height
I temporarily circumvented the problem by reducing the trunk height for the "pergola" structures to 1 m H. Attached are both the cdsm and tdsm files.
You can use the Serval plugin to change those "rectangular pergola" trunk heights to 2 m, thereby reducing the pergola crown height to 1 m.
Nevertheless, your first example should be possible.
Could you also send me your DSM so that I can try.
Sure, here are all the relevant files attached. I tested them just now with UMEP Daily Shadow Pattern
You can see the differences in shadows, e.g. 14:00 between the two sets of DSM files.
The DSM "fail" folder contains the 2 m trunk height The other folder has trunk height at 1 mH and works OK. But the trunk height is impractical ...
I have also included other files, if it helps to make sense with another simulation. One of the pergolas sits on top of a building terrace. The rest sit on the ground.
The simulation where the error occurred is back in time;
the specific earlier tdsm file is now one of several, consigned to a 'fail' folder.
However the pair of DSM files, tsdm.tif and cdsm.tif, repeat the error.
I would be very interested in the steps you take to debug this. Earlier I had a look at the python scripts, but ran out of ideas how to analyse the problem.
Thanks!
Just to let you know that I have not forgot about this.
Now I think I know what is happening. Now I just need to try to find a solution.
It has actually nothing to do with the fact that the crown height is 1 meter or less. It has to do with that during one iteration of the shadowcasting algorithm, both the cdsm and the tdsm becomes negative AND that it is not the first iteration cos for that I have a solution. See e.g. Lindberg and Grimmond for details on how the algorithm is working. Also, I am testing this with the function shadowingfunction_20 found in Utilities/shadowingfunctions.py. Below you see an example from a cutout using your data. As I change the sun altitude (50,60,70), the shadows from the pergola appears and disappears (I use your DEM as DSM so that no building shadows are generated:
A 50 degrees, tdsm and cdsm becomes negative in different iterations At 60, negative at the same time At 70, tdsm goes negative at first iteration (special case fixed in line174)
I will think of a solution...
Thanks for replying! I was away for the week and returned yesterday.
I will follow along with your description and the function shadowingfunction_20 found in Utilities/shadowingfunctions.py
Well, I might have solved this. This algorithm was written long time ago and it took some time to get into the code again. I would be very grateful if you could test the code before I release it. I have pushed UMEP to a branch called PergolaShadows where the new shadow algorithms are included.
Thanks for working on this!
It failed the first crown height test (i.e. height = 1 m) for the pergolas, as attached. I think there are shading artifacts associated where trunk height = 0.5
I dont see where it has failed. The pergolas at the top has shadows?
The tdsm and cdsm shapefiles (in red outline) show the location of the rectangular pergolas. The pergolas are located at bottom RHS. Are are looking at the rectangular building shadows at the top?
I can send the building shapefile as well, if you need it? I thought the cdsm and tdsm outlines would be easier to detect where the shadows have artifacts.
There are also some small trees and small pergolas elsewhere, that have a crown height = 1 m
The comparatively larger pergolas are easier to detect. But they are not located at the top of these images.
There is a building there according to the DSM you send before.
Yes, so in the images I sent there shouldn't be a 1 m wide strip of shadows missing or cut-out from the shading.
I will show the place on your image.
And here is a comparison with the crown height = 2 m (it is a slightly modified pergola outline).
Even though the pergola outlines are different, I am seeing a strip cut away from the shading. Where crown height = 2 m, I am seeing a relatively solid black shading where the trunk height = 0.5 m
Ok, Now I see. I will investigate.
As above, which is the bottom of the original image I posted, slightly to the right. Can you load the tdsm and cdsm shapefiles and check the shadows?
Three quasi blue arrows for the location:
One question before I move on. Do you tick in "facade shadow"?
Ok, I generated these shadows using SOLWEIG and not the Daily Shadow Pattern. But your question made me check again ;- )
Just push a new version to the PergolaShadows branch. Please try it out. I have to think if this is the way to go. What this version will do is, that in some cases you will see one pixel longer shadows from some vegetation units. This is a philosophical issue. Before I always produced shadows that were rounded downwards i.e., shorter shadows by one pixel. Now it is the other way around...
Hold on. There is something strange with the facade version (solweig). I will look into it. In the meantime, you can test the DailyShadowPattern without facade shadows
Your new version pushed today I call test2 - and it seems to be working much better than yesterdays test1 version. What do you think?
I have attached the Daily Shadow Pattern results (no facade shadows) as zip files.
DailyShadowPattern_test1.zip DailyShadowPattern_test2.zip
Test2 (today's push version) screenshot:
Test1 (yesterday's push version) screenshot:
Ok, now it should be fixed so that facade shadows works also.
Great, thanks for that!
Yes, now it looks better.
Please try some different cases and see if you find some strange behaviour
I will -- now I take a break and test it later when I come back.
Testing code: https://github.com/UMEP-dev/UMEP/tree/PergolaShadows
There seems to be slightly strange behaviour between paired time intervals, where the tree shadows change but not the pergola shadows, which remain fixed.
In particular 12:00 - 12:30 and 10:00 - 10:30
At some time periods, the pergola shadows have individual pixels which remain unshaded. These might be/not artifacts.
I have attached a subset of the shadow tiff output from Solweig (Date: 2015, DOY 218, 09:00 - 13:30. T = 10 min intervals) Along with some screenshots showing where the pergola shadows don't change.
As this is a raster-based method and it could probably happen, that shadows do not change where other tree shadows change since the pergolas are close to ground and movement of the shadow is small.
Then we can ignore these artifacts as trivial in terms of the POI output; and will the testing code: https://github.com/UMEP-dev/UMEP/tree/PergolaShadows will be merged into master?
In the interim I will test the pergola method on a Tutorial dataset and will only report back if there is a significant anomaly.
Thanks for the work to fix this! Should we take this as a solution for now?
Yes! I will include it in the next update of the model. Thanks for your detailed analysis of this issue.
QGIS version: 3.16.4-Hannover UMEP plugin v3.17.2 UMEP Processing Plugin v1.3
Having used both SOLWEIG (UMEP) and Shadow Generator (UMEP Processing): shadows are not properly generated for trees whose canopy height is 1 m. This impacts the Tmrt values for trees whose canopy height is only 1 m.
Attached is zip file containing the log file for UMEP Processing / Shadow Generator, the cdsm, tdsm and shadow raster files, outline shapefile and various screenshots. Areas of concern are outlined in red. Within this red outline you can see shadows for pixels whose canopy heights were changed from 3 m to 4 m using the Serval plugin.
If the canopy height is changed to 2 m by increasing the tree height to 4 m, the shadow generation works OK.
The first objective is to change canopy heights and transmissivity to match pergola and tree canopies recorded in urban centres. For example, most pergola canopy heights for shading are usually <= 1 m. Alternatively trees pruned into an umbrella shape with high LAI, low transmissivity, 1 m canopy height and 2 mH trunk space. In these situations the 2 m canopy height does not accurately represent the actual canopy height.
Thanks for any suggestions.
Shadow_Generator_20210716.zip