Extracting the sun azimuth angle

@juancarreras,

the question is where is north in your case ? below just gets the polar coordinates from the light direction vector xy components. It starts rotation at the x axis and rotates counter-clockwise, so y-axis would be 90 degree:

import scriptcontext
import rhinoscriptsyntax as rs
from math import atan2, degrees

def DoSomething():
    
    ids = rs.ObjectsByName("MySun", select=False, include_lights=True)
    if not ids: return
    if not rs.IsDirectionalLight(ids[0]): return

    direction = rs.VectorReverse(rs.LightDirection(ids[0]))
    deg_angle = degrees(atan2(direction[1], direction[0]))
    if deg_angle < 0: deg_angle += 360
    print deg_angle

DoSomething()

does that help ?

c.