Skip to content
Discussion options

You must be logged in to vote

Hi! Here's how I edited the script to make it work:

import datetime as dt
from pytz import timezone
from skyfield import almanac
from skyfield.api import N, E, wgs84, load
import numpy as np

# Figure out local midnight.
zone = timezone('US/Eastern')
now = zone.localize(dt.datetime.now())
midnight = now.replace(hour=0, minute=0, second=0, microsecond=0)
next_midnight = midnight + dt.timedelta(days=1)

ts = load.timescale()
t0 = ts.from_datetime(midnight)
t1 = ts.from_datetime(next_midnight)
eph = load('de421.bsp')
uccle = wgs84.latlon(50.7986 * N, 4.3581 * E)
f = almanac.dark_twilight_day(eph, uccle)
times, events = almanac.find_discrete(t0, t1, f)

previous_e = f(t0).item()
for t, e in z…

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@calders
Comment options

@brandon-rhodes
Comment options

@HeySmarty
Comment options

Answer selected by calders
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants