Closed scotthavens closed 4 years ago
@Hedrick-ARS the tests don't pass because of the net solar. To make the tests pass we will need to update the gold files.
This looks like a good improvement, and a more accurate estimation of both slope and aspect.
Would it be worth adding tests with some flat or multifaceted surfaces (e.g., planes, pyramids)?
A plane would be a good test to see how it does with flat terrain. I will look into a pyramid as well, it will mainly be for testing the edges where the pyramid meets as the flat surfaces will be the same as the tests.
This looks like a good improvement, and a more accurate estimation of both slope and aspect.
Would it be worth adding tests with some flat or multifaceted surfaces (e.g., planes, pyramids)?
Added a flat slope to the gradient tests. IPW set's it convention for a flat slope to have 0 slope but south aspect.
In
loadTopo
the IPWgradient
method is called to calculate the slope and aspect for use instoporad
. This is a fairly easy calculation that was converted over to Python. The method that IPW uses ingradient
is a finite difference approach in just the x and y direction. Two new methods for calculating the slope and aspect are implemented.Gradient methods
gradient_d4
The
gradient_d4
method mimics the IPWgradient
performing the finite difference in only the x and y direction.gradient_d8
GIS frameworks like ArcGIS and GDAL use a second order finite difference, implemented in
gradient_d8
. The ArcGIS documentation has a good overview.Other changes
[topo]
section forgradient_method
, eithergradient_d4
orgradient_d8
with the default asgradient_d8
.threading
in[topo]
was removedtest_gradient
Gradient differences
The changes in the calculation of the gradient method breaks the tests for RME and RME with HRRR. Due to the way SMRF handles the IPW
gradient
calculation with converting to IPW images and back, it was not expected for the new methods to match the old method.RME dem
Comparing the methods over the dem show differences between the methods. The bottom line is the most pronounced but there is minimal difference between the slop and aspect between IPW
gradient
andgradient_d4
. There are larger differences between IPWgradient
andgradient_d8
. The figures below are intests/test_gradient.py
.The historgrams show that most of the differences is close to 0 with larger spread for the
gradient_d8
method.RME net solar radiation with gradient_d4
The gradient is used in the
stoporad
calculation which will affect the net solar radiation. The test now fail because of the differences above. The difference between the test and the net solar radiation withgradient_d4
shows small differences between the two, most likely because of the bottom row and bit resolution of the original IPW images.RME net solar radiation with gradient_d8
Removing the bottom row from the comparison shows that the
gradient_d8
method has a good normal like distribution centered around 0 with +/- 2 W/m2 difference.RME HRRR net solar radiation with gradient_d8
Removing the bottom row from the comparison shows that the
gradient_d8
method has a good normal like distribution centered around 0 with +/- 5 W/m2 difference, which is a little larger than with the station data.