# Path: pykepler/constants.py
# class SolarSystemPlanets:
# class ReturnValues:
# class Constants:
# class Conversion:
# class DegMinSec:
#     MERCURY, \
#         VENUS,   \
#         EARTH,   \
#         MARS,    \
#         JUPITER, \
#         SATURN,  \
#         URANUS,  \
#         NEPTUNE = range(8)
#     SUCCESS = 0
#     ERR_INVALID_PLANET = -1
#     ERR_INVALID_DATE = -2
#     ERR_INVALID_ECCENTRICITY = -3
#     ERR_CONVERGENCE = -4
#     ERR_INVALID_DATA = -5
#     PI = 3.141592653589793238462643
#     TWO_PI = 2.0*PI
#     J2000_EPOCH = 2451545.0
#     MJD_EPOCH = 2400000.5
#     GAUSS_GRAV_CONSTANT	= 0.01720209895
#     AU = 149597870.691
#     DEG_TO_RAD = Constants.PI/180.0
#     ACS_TO_RAD = DEG_TO_RAD/3600.0
#     MAS_TO_RAD = ACS_TO_RAD/1000.0
#     UAS_TO_RAD = MAS_TO_RAD/1000.0
#     RAD_TO_DEG = 180.0/Constants.PI
#     RAD_TO_ACS = 1.0/ACS_TO_RAD
#     HRS_TO_DEG = 15.0
#     DEG_TO_HRS = 1.0/HRS_TO_DEG
#     RAD_TO_HRS = RAD_TO_DEG*DEG_TO_HRS
#     HRS_TO_RAD = 1.0/RAD_TO_HRS
#     def __init__(self, d = 0.0):
#     def __repr__(self):
# def degrees(d, m, s):
# 
# Path: pykepler/earth_figure.py
# def earth_figure_values(geog_latitude, height_msl):
# def earth_gcdist(lon1, lat1, lon2, lat2):
# def earth_gcend(lon1, lat1, inb, dist):


import sys
from os import path
from pykepler import constants as C
from pykepler import earth_figure as E
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.


d = path.dirname(path.abspath(__file__))
sys.path.append(path.dirname(d))


f = path.join(d, "airports.dat")
if (not path.isfile(f)):
    print("Please download airports.dat from "
          "http://openflights.org/data.html into examples folder")
    sys.exit(1)

with open(f, "r") as f:
    A = [l.replace("\"", "").split(",") for l in f]

I = [i for s in sys.argv[1:] for i,e in enumerate(A)
     if e[4].lower() == s.lower()]
if (len(I) < 2):
    print("Please specify 2 or more 3-letter IATA airport codes "
          "on the command-line")
    sys.exit(2)

for i in range(0, len(I)-1):
    dis,inb,fib = E.earth_gcdist(

# Path: pykepler/constants.py
# class SolarSystemPlanets:
# class ReturnValues:
# class Constants:
# class Conversion:
# class DegMinSec:
#     MERCURY, \
#         VENUS,   \
#         EARTH,   \
#         MARS,    \
#         JUPITER, \
#         SATURN,  \
#         URANUS,  \
#         NEPTUNE = range(8)
#     SUCCESS = 0
#     ERR_INVALID_PLANET = -1
#     ERR_INVALID_DATE = -2
#     ERR_INVALID_ECCENTRICITY = -3
#     ERR_CONVERGENCE = -4
#     ERR_INVALID_DATA = -5
#     PI = 3.141592653589793238462643
#     TWO_PI = 2.0*PI
#     J2000_EPOCH = 2451545.0
#     MJD_EPOCH = 2400000.5
#     GAUSS_GRAV_CONSTANT	= 0.01720209895
#     AU = 149597870.691
#     DEG_TO_RAD = Constants.PI/180.0
#     ACS_TO_RAD = DEG_TO_RAD/3600.0
#     MAS_TO_RAD = ACS_TO_RAD/1000.0
#     UAS_TO_RAD = MAS_TO_RAD/1000.0
#     RAD_TO_DEG = 180.0/Constants.PI
#     RAD_TO_ACS = 1.0/ACS_TO_RAD
#     HRS_TO_DEG = 15.0
#     DEG_TO_HRS = 1.0/HRS_TO_DEG
#     RAD_TO_HRS = RAD_TO_DEG*DEG_TO_HRS
#     HRS_TO_RAD = 1.0/RAD_TO_HRS
#     def __init__(self, d = 0.0):
#     def __repr__(self):
# def degrees(d, m, s):
# 
# Path: pykepler/earth_figure.py
# def earth_figure_values(geog_latitude, height_msl):
# def earth_gcdist(lon1, lat1, lon2, lat2):
# def earth_gcend(lon1, lat1, inb, dist):


# Path: examples/flightseg.py
import sys
from os import path
from pykepler import constants as C
from pykepler import earth_figure as E

# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.


d = path.dirname(path.abspath(__file__))
sys.path.append(path.dirname(d))


f = path.join(d, "airports.dat")
if (not path.isfile(f)):
    print("Please download airports.dat from "
          "http://openflights.org/data.html into examples folder")
    sys.exit(1)

with open(f, "r") as f:
    A = [l.replace("\"", "").split(",") for l in f]

I = [i for s in sys.argv[1:] for i,e in enumerate(A)
     if e[4].lower() == s.lower()]
if (len(I) < 2):
    print("Please specify 2 or more 3-letter IATA airport codes "
          "on the command-line")
    sys.exit(2)

for i in range(0, len(I)-1):
    dis,inb,fib = E.earth_gcdist(

        float(A[I[i]][7])*C.Conversion.DEG_TO_RAD,