Convert topocentric coordinates (azimuth, altitude) to equatorial coordinates (RA, Dec) using PyEphem

This seems like a pretty simple task, but I can't figure it out.

PyEphem Documentation:

http://rhodesmill.org/pyephem/radec.html

describes how to perform the conversion in a different way, from Body and Observer objects to the visible topocentric position with altitude and azimuth in the .alt and .az attributes.

However, how should I start with Elevation and Azimuth instead and get RA and Dec?

For example, here is one set of coordinates for which I would like to get RA and Dec in the equatorial reference frame:

 az = 3.30084818 #rad el = 0.94610742 #rad lat = 34.64 #deg lon = -103.7 #deg alt = 35800.26 #m ut = 2455822.20000367 #julian date 

Thanks!

+4
source share
1 answer

There are two subtleties. First, you used “altitude” and “altitude” to mean the opposite of what the two terms in the PyEphem library mean — so you call a spot in the sky with your position “altitude / azimuth” instead of your “altitude / azimuth”. Secondly, it seems that PyEphem forgot to provide an easy way to convert dates from Julian to its own julian_date() there is a julian_date() function that will move in a different direction, we will have to work a bit to go in another direction, finding out what it costs ephem .

Given these points, I think this script can answer your question:

 import ephem az = 3.30084818 #rad el = 0.94610742 #rad lat = 34.64 #deg lon = -103.7 #deg alt = 35800.26 #m ut = 2455822.20000367 #julian date # Which Julian Date does Ephem start its own count at? J0 = ephem.julian_date(0) observer = ephem.Observer() observer.lon = str(lon) # str() forces deg -> rad conversion observer.lat = str(lat) # deg -> rad observer.elevation = alt observer.date = ut - J0 print observer.date print observer.radec_of(az, el) 

Does the answer he gives looks right for this particular observation? Here is what the script prints for me:

 2011/9/17 16:48:00 (9:16:24.95, -0:45:56.8) 

Let me know if this makes physical sense for this particular observation, or if one of the numbers here is incorrect and still needs to be tuned!

+2
source

Source: https://habr.com/ru/post/1392340/


All Articles