How to use the ephemeris.solar_transit function in ephemeris

To help you get started, we’ve selected a few ephemeris 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 kotekan / kotekan / python / scripts / rfi_toggle_cron.py View on Github external
import datetime
import requests
import json
import time
import ephemeris

# from datetime import datetime

t_now = datetime.utcnow()
t_transit = ephemeris.solar_transit(t_now)[0]
t_diff = datetime.utcfromtimestamp(t_transit) - t_now

# Wait until the correct UTC time (deals with daylight savings time)
print("Time until transit: {}".format(t_diff))
print("Sleeping for {} seconds".format(abs(t_diff.total_seconds())))
time.sleep(abs(t_diff.total_seconds()))

print("Waking up to zero RFI during solar transit")

downtime = 60  # minutes

# Endpoint parameters
url = "http://csBfs:54323/toggle-rfi-zeroing"
headers = {"content-type": "application/json", "Accept-Charset": "UTF-8"}

# Payload