I am doing a project using the real elevation and azumith of the sun. Many of the elevations are negative, this seems to be a problem with hillshade. Is there a way to convert negative values to positive?

I got my data from the NOAA solar position calculator at:http://www.srrb.noaa.gov/highlights/sunrise/azel.html .

2. ## Re: Trouble with Hillshading

Unfortunately there's not, Robert, because a negative elevation means the sun is below the horizon and a positive one means it's above: those are different positions.

There may be a workaround: tilt the DEM! (After all, this is what is really happening, isn't it: the earth it tilting relative to the sun; the sun is not moving through the sky...) Because DEMs assume all heights are perfectly vertical, this is an approximation, but it could be effective provided you don't have to tilt more than a few degrees.

Here's one way to do it. Let the sun's bearing be 'a' degrees east of north (e.g., the sun at the southwest will have a bearing around 225 degrees). Let the desired amount of tlt be t degrees. Find the coordinates of a point near the middle of the DEM; you don't have to be precise. Let these coordinates be (x,y). With a calculator or the equivalent, compute the three numbers
T = tan(t)
S = sin(a)
C = cos(a)
(to seven significant figures) and then compute
b = x*S + y*C.
The tilted DEM is obtained by adding the grid
T * ( S * \$\$XMap + C * \$\$YMap - b )
from the DEM. (The expression in parentheses computes the distance from a line passing through your point of origin. The line runs perpendicular to the sun's bearing.)

Using the tilted DEM, compute the hillshade, but in so doing, increase the sun's elevation by t degrees. This effectively tilts the sun along with the DEM.

For example, let the sun's elevation be -1 degree and its bearing be 225 degrees east of north. Suppose you choose (1000, -500) as the center of the DEM and you decide to tilt it by t = 3 degrees. Then
T = tan(3 degrees) = 0.05240778
S = sin(225 degrees) = -0.7071068
C = cos(225 degrees) = -0.7071068
b = -0.7071068 * 1000 + (-0.7071068 * (-500)) = -353.5534.
Using the raster calculator (let's hope you have a version of Spatial Analyst preceding 10.0, for otherwise you will have to work much harder to carry this out), compute
tilt = 0.05240778 * ( (-0.7071068) * \$\$XMap + (-0.7071068) * \$\$YMap - (-353.5534) )
Finally, compute the hillshade of [DEM] + [tilt] for a bearing of 225 degrees and azimuth of -1 + 3 = 2 degrees.