Generate a skymatrix using python

I am trying to generate a series of sky matrixes from a WEA file using only python (not Grasshopper) but I am stuck.

So far I have successfully generated my wea files and objects from an epw file.

from ladybug.epw import EPW
from ladybug.wea import Wea
from honeybee_radiance.lightsource.sky.skymatrix import SkyMatrix

wea = Wea.from_epw_file(epw_path, 1)
wea_path = wea.write(str(wea)) 

After this, I am able to make a SkyMatrix object and then hopefully generate the actual skymatrix itself.

skymatrix = SkyMatrix(wea, north, density)
skymatrix.to_radiance()

This is where I get lost. Based on what the documentation says, I thought that last line was supposed to generate the actual radiance data/ run radiance to generate the skymatrix data. However that is not what is happening. Where am I going wrong? Can someone point me to an example for doing this?

For reference, I ultimately plan to generate 3DMesh objects using other code and run full incident radiation analysis on them. Since we need to run hundreds of models with hundreds of slightly different wea files, we are trying to run the process outside of grasshopper, ideally saving the skymatrixes out as files before running the actual analysis. I anticipate additional problems with running the radiation analysis, but I can’t even get to that until I figure out the skymatrix. Any resources or examples showing a complete process would be helpful.

Hi @cbehn ,

As you can see here in the docs of the SkyMatrix.to_radiance method, the to_radiance() method returns the string of the radiance command that needs to be run in order to generate the actual matrix data.

To run commands, you can either copy/paste that text into a command prompt or you can use the native Python subprocess module to run the command. A google search will reveal plenty of info about the subprocess module. If you want an example, here’s a place where we use it in Ladybug Tools: