python 2.7 - Local time using UTC, coordinates (PyEphem not working) -
i have list of coordinates , utc time frustratingly pyephem's localtime function doesn't work--it displays computer's local time. want filter out stations in night time (not in between hours of 8 , 4 pm). there easy way this?
sit,lat,lon in zip(nsites,lats,longs): user=[] user = ephem.observer() user.lat = lat user.lon = lon user.date=bstart if ephem.localtime(user.date).time()>=datetime.time(8) , ephem.localtime(user.date).time()<=datetime.time(16): user.date=cend if ephem.localtime(user.date).time()>=datetime.time(8) , ephem.localtime(user.date).time()<=datetime.time(16): mask.append(true) else: mask.append(false) else: mask.append(false)
adding rickhg12hs answer, consider setting user.horizon "–6" (civil twilight), "-12" (nautical twilight), or "-18" (astronomical twilight) depending on how dark need use case.
Comments
Post a Comment