Irradiance calculation using rtrace


Could you please help me by checking if the code below makes sense? The results are higher than what is expected. I have been struggling with it for the last few days.

I created clear sky using gensky CIE clear sky option, code is below:
gensky 6 21 12:00CST +s -a 32.77 -o 96.80 > skies/sky_clear.mat

Then created an octree using the sky definition and material only:
oconv skies/sky_clear.mat skies/sky.rad > sky.oct

I am interested in calculating the Irradiance (W/m^2) for the solar full spectrum on a horizontal surface i.e., Global Horizontal Irradiance (GHI). I am using the script below for it.
echo ’0 0 0 0 0 1’ | rtrace -I -ab 2 -h sky.oct | rcalc -e ‘$1=($1+$2+$3)’

My results are higher than what I expected, wondering if I should replace rcalc -e ‘$1=($1+$2+$3)’ with rcalc -e “$1=(.265*$1+.670*$2+.065*$3)”? I am using max GHI from TMY data as reference for comparison.

I thought 0.265R + 0.670G + 0.065B and 179 lm/W are Luminous efficacy factor which are used only for calculating luminance and illuminance. But not sure.

Thank you so much for your help.

Yes, you can use the formula or just divide the three values for an average if you are computing horizontal irradiance, i.e., -e ‘$1=($1+$2+$3)/3’

However, you won’t necessarily get the expected value from gensky if you don’t specify the solar and horizontal irradiance as inputs. These are calculated from default mean radiance and turbidity values, which of course vary quite a lot from place to place and day to day. I recommend you look at the -B and -R options in the gensky man page.


Thank you Greg,

My main object is to calculate external solar radiation (irradiance) w/m^2.

I am a bit confused why do we need to average by 3. I thought by using the option -I in RTRACE provides irradiance W/m^2 per color spectrum. So to get total irradiance for the full spectrum, we need to sum without average?

The -R is a great feature, thank you for pointing it. However, wondering if we don’t use the -R option, and just use the default CIE clear sky, is it appropriate to multiply all the rtrace results by a factor to obtain results close to a clear sky irradiance. For my project location, to get reasonable horizontal irradiance with GENSKY, the following factor works very well for RTRACE $1=0.7079461*(1*$1+1*$2+1*$3)"

Thank you so much.

Well, adjusting the values post-hoc is more or less the same as inputting the correct horizontal irradiance values to gensky, so do as you like.

Regarding summing the three channels to get total irradiance, that would normally make sense, but because Radiance uses RGB calculations, it doesn’t report absolute watts/sr/m^2 for each band. It’s more like watts/sr/m^2/nm but without the scaling involved. I admit it is a bit of a hack, but it’s not one I invented – this is in keeping with most other rendering methods.