#! /usr/bin/env python3
# This file is part of the Astrometry.net suite.
# Licensed under a 3-clause BSD style license - see LICENSE
from __future__ import print_function

import sys

# Assume this script is in $(INSTALL_DIR)/bin/ and the
# python base directory is in $(INSTALL_DIR)/lib/python/ .
try:
    # If the PYTHONPATH is already set up, don't mess with it.
    import astrometry.util.starutil_numpy
except:
    import os
    sys.path.insert(1, os.path.normpath(os.path.join(os.path.dirname(__file__), '..', 'lib', 'python')))

from astrometry.util.starutil_numpy import ra2hmsstring, dec2dmsstring

args = sys.argv[1:]
if len(args) != 2:
    print('Usage: %s <ra> <dec>' % sys.argv[0])
    sys.exit(-1)

ra  = float(args[0])
dec = float(args[1])

rastr  = ra2hmsstring(ra).replace(' ','h',1).replace(' ','m',1).replace(' ','s',1)
decstr = dec2dmsstring(dec).replace(' ','d',1).replace(' ','m',1).replace(' ','',1)

print('            %-20s   %-20s' % ('RA', 'Dec'))
print('in:         %-20f   %-20f' % (ra, dec))
print('out:        %-20s   %-20s' % (ra2hmsstring(ra), dec2dmsstring(dec)))
print('out:        %-20s   %-20s' % (ra2hmsstring(ra,':'), dec2dmsstring(dec, ':')))
print('out:        %-20s   %-20s' % (rastr, decstr))

    
