Browse Source

Fixed sun template

pull/131/head
Pascal 3 years ago
parent
commit
b6d7e799cc
3 changed files with 18 additions and 1 deletions
  1. +1
    -1
      common.sh
  2. +1
    -0
      install.sh
  3. +16
    -0
      templates/sun.py

+ 1
- 1
common.sh View File

@@ -1,4 +1,4 @@
##!/bin/bash
#!/bin/bash

## debug
# set -x


+ 1
- 0
install.sh View File

@@ -286,6 +286,7 @@ else
log_done "pd120_decoder installed"
fi

cp templates/sun.py .

success "Install (almost) done!"



+ 16
- 0
templates/sun.py View File

@@ -0,0 +1,16 @@
#!/usr/bin/env python3
import ephem
import time
import sys
timezone = change_tz + time.localtime().tm_isdst
date = time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(int(sys.argv[1])-(timezone*60*60)))

obs=ephem.Observer()
obs.lat='change_latitude'
obs.long='change_longitude'
obs.date = date

sun = ephem.Sun(obs)
sun.compute(obs)
sun_angle = float(sun.alt) * 57.2957795 # Rad to deg
print(int(sun_angle))

Loading…
Cancel
Save