Sky description as a .mat file not a .sky file from lightsource.CIE

hello everyone, I am facing a problem: I want a .mat file description of the sky, same as if I run a radiance command like: gensky -ang 45 0 -c -b 1 > sky.mat

To have a file with this content:
void brightfunc skyfunc
2 skybr skybright.cal
0
3 2 1.00e+00 1.56e-01

I am using those versions for python 3.7:
honeybee-radiance==1.66.159
honeybee-radiance-command==1.22.4
honeybee-radiance-folder==2.11.16

I am creating a sky from lighsource.CIE, CIE.from_location() but if i use the .to_file() function he will give me a .sky file with the ground and hemisphere description like that:
skyfunc glow sky_glow
0
0
4 1.000 1.000 1.000 0
sky_glow source sky
0
0
4 0 0 1 180

skyfunc glow ground_glow
0
0
4 1.000 1.000 1.000 0
ground_glow source ground
0
0
4 0 0 -1 180

Any suggestions for me to have a .mat file just like i said before using honeybee-radiance?

radiance
daylight

Hi @joao.pires.i,

Is the first line in the file the gensky command with an exclamation mark? Example: “!gensky -ang 45 0 -c -b 1”.

The exclamation mark means that the gensky command will be executed whenever you use the file – so !gensky -ang 45 0 -c -b 1 replaces the brightfunc material description.

If you want only the output of gensky as a file then you can use honeybee-radiance-command. If you set the output it will write the file.

thank you for your answer! Yes, actually it has the exclamation mark in the file, so now i understand the sequence, thanks. I just dont know why the code is subtracting 180 from the azimuth:

def to_radiance(self):
“”“Return radiance definition as a string.”“”
command = ‘!gensky -ang %.6f %.6f %s -g %.3f’ % (
self.altitude, self.azimuth - 180.0, self.sky_type_radiance,
self.ground_reflectance
)

and with to_file() function he put the name of the file of the “original” azimuth like:
def to_file(self, folder, name, mkdir):
content = self.to_radiance()
name = typing.valid_string(name) if name
else ‘%.3f_%.3f_%s.sky’ % (
self.altitude, self.azimuth,
self.sky_type_human_readable.replace(’ ', ‘_’).lower()
)

This is because the azimuth is different between the honeybee-radiance CIE class and gensky. Here is the description of the azimuth in the CIE class…

The azimuth is measured in degrees east of North. East is 90, South is 180 and West is 270. Note that this input is different from Radiance convention. In Radiance the azimuth degrees are measured in west of South.

… so the subtraction of 180 is because the starting point is north in honeybee-radiance and south in gensky.

understood. So, with the correct location for CIE.from_location() i dont need to worry about those convention details? The sky should be correct in any city?

Correct. The from_location method will use the latitude and longitude of the location as well as the month, day, and hour to calculate the altitude and azimuth of the sun.