How to use the pysolar.solar.get_altitude function in pysolar

To help you get started, we’ve selected a few pysolar examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github soravux / skylibs / hdrtools / sunutils.py View on Github external
def sunPosFromCoord(latitude, longitude, time_):
    """
    Find azimuth annd elevation of the sun using the pysolar library.
    Takes latitude(deg), longitude(deg) and a datetime object.
    Return tuple conaining (elevation, azimuth)
    
    TODO verify if timezone influences the results.
    """

    azim = solar.get_azimuth(latitude, longitude, time_)
    alti = solar.get_altitude(latitude, longitude, time_)

    # Convert to radians
    azim = (azim + 360)*np.pi/180
    elev = (90 - alti)*np.pi/180

    return elev, azim
github open-homeautomation / pknx / knxip / timeupdater.py View on Github external
d = datetime.now()
        if self.timeaddr:
            self.tunnel.group_write(self.timeaddr,
                                    time_to_knx(d))

        if self.dateaddr:
            self.tunnel.group_write(self.dateaddr,
                                    date_to_knx(d))

        if self.datetimeaddr:
            self.tunnel.group_write(self.datetimeaddr,
                                    datetime_to_knx(d))

        if self.daynightaddr:
            from pysolar.solar import get_altitude
            alt = get_altitude(self.lat, self.long, d)
            if alt > 0:
                self.tunnel.group_write(self.daynightaddr, 1)
            else:
                self.tunnel.group_write(self.daynightaddr, 0)
github enesbcs / rpieasy / commands.py View on Github external
return res

   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
github enesbcs / rpieasy / commands.py View on Github external
res = "00:00"
     return res

   elif svname==SysVars[25]: #sun altitude
    try:
      from pytz import reference
      from pysolar.solar import get_altitude
      pysolarsupported = 1
    except:
      pysolarsupported = 0
    res = "0"
    if pysolarsupported==1:
     try:
      localtime = reference.LocalTimezone()
      today = datetime.now(localtime)
      res = get_altitude(Settings.AdvSettings["Latitude"],Settings.AdvSettings["Longitude"], today)
     except Exception as e:
      print(e)
      res = "0"
     return res

   elif svname==SysVars[26]: #sun azimuth
    try:
      from pytz import reference
      from pysolar.solar import get_azimuth
      pysolarsupported = 1
    except:
      pysolarsupported = 0
    res = "0"
    if pysolarsupported==1:
     try:
      localtime = reference.LocalTimezone()

pysolar

Collection of Python libraries for simulating the irradiation of any point on earth by the sun

GPL-3.0
Latest version published 1 year ago

Package Health Score

54 / 100
Full package analysis