Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
elif svname==SysVars[27]: #sun radiation
try:
from pytz import reference
from pysolar.solar import get_altitude
from pysolar.radiation import get_radiation_direct
pysolarsupported = 1
except:
pysolarsupported = 0
res = "-1"
if pysolarsupported==1:
try:
localtime = reference.LocalTimezone()
today = datetime.now(localtime)
altitude_deg = get_altitude(Settings.AdvSettings["Latitude"],Settings.AdvSettings["Longitude"], today)
res = get_radiation_direct(today, altitude_deg)
except Exception as e:
print(e)
return res
return res