def display( latitude, longitude, tz, start, end, increment ): """Display sunup table. :param latitude: Latitude of observer :param longitude: longitude of observer :param tz: timezone of observer :param start: starting date for table :param end: ending date for table :param increment: day increment for table """ heading= """\ Hours Sunrise (EST) Sunset (EST) Elev.& Azimuth of and Azimuth and Azimuth of Noon Sun Date Daylight (degrees) (degrees) (degrees) """ print( heading ) for offset in range( 0, (end-start).days+increment, increment ): date= start+datetime.timedelta(days=offset) rise, transit, set = solar.rise_transit_set( latitude, longitude, date ) az_r, el_r= solar.azimuth_elevation( latitude, longitude, rise ) az_s, el_s= solar.azimuth_elevation( latitude, longitude, set ) az_t, el_t= solar.azimuth_elevation( latitude, longitude, transit ) daylight_hours= (set-rise).total_seconds()/3600 print( "{0:10s} {1:5.2f} {2:8s} {3:5.2f} {4:8s} {5:5.2f} {6:8s} {7:5.2f} {8:5.2f}".format( date.strftime("%Y-%m-%d"), daylight_hours, rise.astimezone(tz).strftime("%H:%H:%S"), az_r, set.astimezone(tz).strftime("%H:%M:%S"), az_s, transit.astimezone(tz).strftime("%H:%M:%S"), el_t, az_t, ) )
def report( latitude, longitude, date_time, tz ): details = solar.Position_Sun( latitude, longitude, date_time ) rise, transit, set = solar.rise_transit_set( latitude, longitude, date_time ) az_r, el_r= solar.azimuth_elevation( latitude, longitude, rise ) az_s, el_s= solar.azimuth_elevation( latitude, longitude, set ) print( "{0:10s} {1:5.2f} {2:8s} {3:6.2f} {4:8s} {5:4.2f} {6:6.2f} {7:6.2f}".format( date_time.strftime("%Y-%m-%d"), details.AA/60, rise.astimezone(tz).strftime("%H:%H:%S"), az_r, set.astimezone(tz).strftime("%H:%M:%S"), az_s, details.AE+180, details.AH , ) )