I wonder how this relates to the Perez All-Weather and Preetham sky models. Not an expert about that but I managed to implement those in the past and it was quite a fun project!
https://github.com/jscanvic/SkySim