mirror of
https://github.com/cosinekitty/astronomy.git
synced 2025-12-26 09:10:23 -05:00
This demo calculates the next 10 solar eclipses that are visible from a given location on the Earth, after a given date.
23 lines
669 B
Python
23 lines
669 B
Python
#!/usr/bin/env python3
|
|
#
|
|
# astro_demo_common.py - Don Cross - 2019-07-26
|
|
#
|
|
# Utility functions shared by Python demo programs.
|
|
#
|
|
import sys
|
|
import astronomy
|
|
from typing import List, Tuple
|
|
|
|
def ParseArgs(args: List[str]) -> Tuple[astronomy.Observer, astronomy.Time]:
|
|
if len(args) not in [3, 4]:
|
|
print('USAGE: {} latitude longitude [yyyy-mm-ddThh:mm:ssZ]'.format(args[0]))
|
|
sys.exit(1)
|
|
latitude = float(args[1])
|
|
longitude = float(args[2])
|
|
if len(args) == 4:
|
|
time = astronomy.Time.Parse(args[3])
|
|
else:
|
|
time = astronomy.Time.Now()
|
|
observer = astronomy.Observer(latitude, longitude)
|
|
return (observer, time)
|