Skip to main content

RA/DE to ALT/AZ conversion code

3 posts / 0 new
Last post
RA/DE to ALT/AZ conversion code

Hi, can anyone point me to open source code (preferably C#) that will convert from RA/DE to ALT/AZ coordinates, given an observing location Long/Lat and date/time?

I’ve seen the math to do this but am having difficulty coding it myself in C# so was hoping there’s something already out there. 

Just to also say I’m not needing high accuracy. +/- 1deg is fine as I’m just wanting to check if a given RA/DE location is observable, I won’t be using the ALT/AZ coordinates for pointing. 



CTX's picture
Sidereal Time & Knowing Whats Observable



Assuming you simply wish to know what might be observable in terms of RA & DEC from your location,

The really neat thing about using Sidereal time is that at any given Sidereal time objects with that corresponding R.A. are passing the local Meridian (transiting).

If an object has a R.A. (right ascension) of, for example, 08h 24m 16s then we know that an object with that R.A. will transit (pass the local Meridian - imaginary line running North to South in the sky) at a Sidereal time of 08:24:16.

Depending upon the time of year, a typical location will have objects visible about three hours either side of the transit time.  Using the example Sidereal  time  of 08:24:16 then objects from approximately a RA of 05h 24m 00s  to 11h 24m 00s should be visible (unless possibly of negative declinations from mid north locations) if dark enough.

Please keep in mind that how many R.A. hours either side of an object currently passing the Meridian might be available for viewing is going to depend upon your location, the time of year, the objects declination and, most importantly, Darkness.

A few of the options available for us to know the Sidereal time include the following:

Local Sidereal time is readily available with a freeware program for PeeCee’s, titled “Astronomer’s Digital Clock:”

This software “tool” also shows the UT time and the Julian date along with other useful information.

You can also get the “current” LST (Locall Sidereal Time) at:

Also, a useful tool is the table on page 37 (Chapter 6) of the AAVSO's Visual Observing Manual, which shows the available RA range for a given month from 2 hours after sunset to midnight:

Your latitude & horizions are going to determine your DEC range as well as the type of scope you have... each of us generally have had to work this out for ourselves from trial and error.  As an example, my location is ~49 degrees lattitude.  With a SCT scope (& CCD) my typical range of DEC ran from ~ -15 degrees at lowest horizion to a maximum of ~ 74 degrees.  Most of the time I probably worked from about + 20 degrees DEC to 70 degrees DEC.  With a Newtonian, I presume I probably could have worked a much higher DEC.

Hope this helps you out.

Tim Crawford

Eric Dose
Eric Dose's picture

Python has open-source package astroplan , which has what you're looking for and a lot more. Should be easy enough to port a function or two to C# or other numerically-competent language.

Log in to post comments
AAVSO 49 Bay State Rd. Cambridge, MA 02138 617-354-0484