# Co-ordinates

### AltAz(J2000,DEC,RA,Long,Lat,Index)

The most common coordinates in astronomy are ‘Right Ascension & Declination’ (RA/DEC) and ‘Altitude & Azimuth’ (ALT/AZ) both are useful and converting RA/DEC to Alt/Az is important if you want to answer questions like ‘What altitude is the moon at the moment?’.

Right Ascension is normally represented in the units Hours and Minutes but in AstroExcel I have chosen to use degrees, it is easy to convert from RA hours to degrees – just multiply by 15 and for degrees to RA just divide by 15. All the functions in AstroExcel that ask for RA will ask for it in degrees and all functions returning RA will return them in degrees. I have included in AstroExcel the Messier catalogue with a column showing the RA degrees so you can get used to this.

To calculate Alt/Az you need to know your location on Earth (longitude and Latitude) – North and East are positive, South and West negative, this is a standard convention – plus the date and time (UT) represented in days after 12:00 on the 1st Januaray 2000 (see here for help)

#### Let’s take a closer look at AltAz conversion.

I want to know the Altitude and Azimuth of Messier object M1 for my location at 22:00 on the 1st January 2015.

### AltAz arguments

• date and time in J2000 format – this is the date standard for functions in AstroExcel, we use the days2000() function for this.
• Declination of object of interest
• Right Ascension of object of interest
• Longitude of observer (Sounth -ve)
• Latitude of observer (West -ve)
• an index to say if the result should be an altitude (index= 1) or an azimuth (index=2)

### Rectangular(r,theta,phi,index)

The rectangular() function will convert spherical co=ordinates into rectangular (Cartesian) co-ordinates

• Index = 1 = Return x co-ordinate
• Index = 2 = Return y co-ordinate
• Index = 3 = Return z co-ordinate

### Spherical(x,y,z,index)

The spherical() function will convert rectangular (Cartesian) co-ordinates into spherical co-ordinates.

• Index = 1 = Return r co-ordinate
• Index = 2 = Return theta co-ordinate
• Index = 3 = Return phi co-ordinate

### rLength(x,y,z)

The rLength() function is used if you have the Cartesian co-ordinates and want to find the distance to the origin (0,0,0)

### AngularSeperation(RA1,Dec1,RA2,Dec2)

From equatorial or ecliptic coordinates of two objects find their angular separation, all in degrees, i.e. RA is in degrees not hours, This function is useful for finding the distance between two objects such as the planets after you have calculated their positions.

User RADEC() for converting from altitude and azimuth to RA and Dec coordinates.

 RADec(J2000, Altitude, Azimuth, latitude, Longitude, index) J2000 is the date in J2000 format Altitude in degrees Azimuth in degrees Latitude in degrees East is negative Longitude in degrees South is Negative index is 1 for RA and 2 for Dec. in degrees

## 8 thoughts on “Co-ordinates”

1. Guillaume Weysters says:

Very nice excel form for RA-Dec versus Alt-Az, but where can I find the actual formulae which are used?

Like

1. To keep the spreadsheet simple all the calculations are built into excel functions, you can view the ‘hidden’ code by clicking on the developer tab in excel, and then clicking the visual basic icon. If you don’t have the developer tab you can turn it on in the options section in excel.

Like

2. Hi, I tried using the input from the M1 example above, using Sky Safari Pro, and it gave a different answer. Alt = +59º24′ Az = 156º 33′

While using the AstroExcel functions and the value above, it agreed with your output.

Can you verify? Thanks

Like

1. The ALtAZ() function converts the RA and Dec specified for the time and location specified but beware that the RA and Dec are needed in degrees, RA is usually published in hours so you have to multiply 15 to get degrees.

Some things to consider when comparing results with other software…
1) Sky Safari uses the current epoch to calculate the RA/DEC of the object you are interested in, whereas positions of objects are usually published with an epoch (usually 2000, but sometimes 1950 in older publications) so to compare altaz() and sky safari you need to make sure you start with the same RA and Dec inputs (info screen in sky safari will give you the RA and Dec for the current epoch and this it what it uses to calculate the AltAz) if you input the RA and DEC for the current time epoch from sky safari and use the same date and time as sky safari and same location as sky safari then Astro Excel and Sky safari are very close – but not quite the same – read on…

2) AltAz() doesn’t compensate for atmosphere – it assumes no atmosphere, planetarium programmes usually consider atmospheric refraction by making assumptions about air pressure, temperature and wavelength being observed. You can add this calculation using Refraction() to get a closer result.

3) Sky Safari (I assume) corrects for daylight saving, AltAZ() uses UT so you have to compensate for time zone and daylight saving to compare the two.

I hope this helps, I have checked the function and it appears to be correct, the function is very simple so if you want to check the code it is quite easy to do so even with no code experience, the function is based on ‘Practical Astronomy with your calculator’, second edition, by Peter Duffett-Smith (equation 25)

Like

3. Ton says:

This is a very nice collection of handy functions for (radio) astronomy.
I think I found a mistake in the parameter sequence for AltAz
If I change it to AltAz(J2000, Dec, RA, Lat, Long) then it correlates with RADec()
and then both also have the same sequence of Lat and Long.
I still have some problem to correlate the results with Stellarium, no matter what time I use for my location (GMT or local summer or winter time). I hope that you can fix that.
The RADec description is pretty clear in that East is negative, AltAz seems to specify that West is negative which is incorrect.
It would be nice to see an example for RADec included and that the examples specify a negative longitude with the approximate location.

Like

1. If I change it to AltAz(J2000, Dec, RA, Lat, Long) then it correlates with RADec()

Yes this is correct you need to input AltAz(J2000, Dec, RA, Lat, Long) and RA needs to be in degrees not hours, I agree this is odd and can’t really explain why I did it like this – sorry if this caused some confusion.

Like

4. Hi! Fantastic work, and thanks for sharing this valuable resource.

I am creating a worksheet which uses your RADec function to “map” RA and Dec coordinates across the visible sky at my location for any given time and date (i.e. for Azimuth = 0 to 360 degrees, and Altitude = 0 to 90 degrees). I will use this to plan observing sessions, to make lists of targets that will be well-positioned for easy observation / imaging at my location, taking into account my line-of-sight blockages, light pollution from the nearby city centre to my East, and so on.

I have found that RADec returns an error (“#VALUE!”) at a few discrete Alt / Az coordinate pairs; specifically, for Azimuth = 180 degrees (i.e. due South), I get errors for both RA and Dec at an Altitude of 10, 25, 35 and 60 degrees. (This is not necessarily an exhaustive list, just what came up when I created my first table.)

I suspect there is some sort of divide-by-zero error, probably related to one of the terms at precisely 180 degrees due South, but why at these particular Altitude values, I don’t know. It isn’t a big deal – changing either the Altitude or Azimuth by a very small amount (e.g. use Azimuth = 179.999 or 180.001 degrees) causes the error to clear itself.

Thanks again!

Like