Take the 2-minute tour ×
Physics Stack Exchange is a question and answer site for active researchers, academics and students of physics. It's 100% free, no registration required.

I would like to convert daily global radiation into hourly solar radiation. While I do not know the terms, I tried using below equations I found in the papers but I have negative radiation values range between -75 to 100 j/m2/s. Any suggestions are welcome.

# radi(h) = r * radi(daily)

r <- (pi/24) * ( a + b * cos_d (w))* ((cos_d(w) - cos_d(ws)) / (sin_d(ws)-((pi/180) * ws * cos_d(ws))) )

a <- 0.409 + 0.5016 * sin_d(ws - 60)

b <- 0.6609 - 0.4767 * sin_d(ws - 60)

 # W = hour angle of the sun

w <- (360/24) * (h-12.0) # h = time of the day (hour)

ws <- acos_d(-tan_d(phi)*tan_d(sigma))) # ws = sunset hour angle (degree)

phi= 36.20 # phi = location latitude angle

# sigma= declination angle of the sun [degree]

sigma = 23.45 * sin_d (360* ((284+day)/365)) # day=DOY

share|improve this question

migrated from stackoverflow.com Sep 14 '12 at 15:21

This question came from our site for professional and enthusiast programmers.

After testing your equations, it seems to me that all negatives values fall after sunset and before sunrise: wouldn't it be that the equation for r is only meant for daytime hours? In this paper for instance they seem to limit the study from 8am to 4pm. –  plannapus Sep 14 '12 at 7:44
w <- (360/24) * (h-12.0) should probably be w <- (360/24) * (12.0-h) since w is zero for solar noon and the morning is positive. But that doesn't really change the negative results. –  plannapus Sep 14 '12 at 7:47
Why would like to convert daily global radiation into hourly solar radiation? The answer would help determine the right way to do it. For example, if you want insolation levels on Earth, you need an insolation database, rather than doing it from first principles - weather / climate effects are important. –  EnergyNumbers Sep 14 '12 at 19:22

1 Answer 1

From ?Trig: "Angles are in radians, not degrees (i.e., a right angle is π/2)." You need to convert your angles from degrees to radians, when using the trigonometric functions.

Also cos-1 should probably be acos.

share|improve this answer
Using "aspace" package, the values were converted from radians to degrees –  Mitra Rahmati Sep 14 '12 at 7:33
No language that I know of uses degrees in trig functions. The point is that your code needs to have them in radians. I don't know what "aspace" is or what you're doing with it. –  duffymo Sep 14 '12 at 9:37
In sin(ws-60) I'm pretty sure 60 is in degree, whereas the result of ws <- acos ... is in radians. –  Roland Sep 14 '12 at 9:43
@duffymo "aspace" is a package in R. –  Mitra Rahmati Sep 14 '12 at 9:56
Look at that: R trig functions use radians, too: stat.ethz.ch/R-manual/R-patched/library/base/html/Trig.html –  duffymo Sep 14 '12 at 10:02

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.