File: radec2azel.py

package info (click to toggle)
pymap3d 2.5.0-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 436 kB
  • sloc: python: 2,729; ruby: 105; sh: 8; makefile: 7
file content (26 lines) | stat: -rwxr-xr-x 888 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#!/usr/bin/env python
"""
Example Kitt Peak

./radec2azel.py 257.96295344 15.437854 31.9583 -111.5967 2014-12-25T22:00:00MST
"""
from pymap3d import radec2azel
from argparse import ArgumentParser


def main():
    p = ArgumentParser(description="RightAscension,Declination =>" "Azimuth,Elevation")
    p.add_argument("ra", help="right ascension [degrees]", type=float)
    p.add_argument("dec", help="declination [degrees]", type=float)
    p.add_argument("lat", help="WGS84 latitude of observer [degrees]", type=float)
    p.add_argument("lon", help="WGS84 latitude of observer [degrees]", type=float)
    p.add_argument("time", help="UTC time of observation YYYY-mm-ddTHH:MM:SSZ")
    P = p.parse_args()

    az_deg, el_deg = radec2azel(P.ra, P.dec, P.lat, P.lon, P.time)
    print("azimuth: [deg]", az_deg)
    print("elevation [deg]:", el_deg)


if __name__ == "__main__":
    main()