Last updated 20 August 2009
Note: star catalog code is now hosted on GitHub
Links to other source code on this site
Notes on 5 January 2007 changes
Notes on 22 January 2004 changes
Notes on 24 October 2003 changes
I received my beta UCAC-2 disks on 12 May 2003, and have confirmed that my C/C++ source code to access them (written while waiting for them to arrive) works properly. Since then, I've altered it slightly to allow for changes in the final format. The code for all UCACs (and some other catalogues) is here on GitHub.
ucac2.h and ucac2.cpp show how one can process UCAC-2 binary data from C. The code will work in Linux and DOS/Windows. I've added in byte-reordering code that ought to let it work on "wrong-Endian" platforms, but I don't have one handy with which to test the matter.
As best I can tell, this code has no particular advantages (or disadvantages) relative to the FORTRAN source (except for a new function to extract data for a particular star), so your choice should reflect only your prejudices in programming languages.
Compiled as
cl -W4 -Ox -DTEST_PROGRAM ucac2.cpp (Microsoft C/C++, DOS/Windows) wcl386 -W4 -Ox -DTEST_PROGRAM ucac2.cpp (Watcom C/C++, DOS/Windows) g++ -o ucac2 -DUNIX -DTEST_PROGRAM ucac2.cpp (GNU C/C++, Linux)
you'll get a program that can be run as
ucac2 <ra> <dec> <width> <height>
with all arguments in decimal degrees. UCAC-2 data will be extracted and written to a text file, ucac2.txt. Optionally, one can add a path:
ucac2 <ra> <dec> <width> <height> <path>
to have the data read from another directory or from CD. For example, if your CD-ROM is drive d:, you might put the CD in the drive and run
ucac2 50 -12 1.3 1.8 d:\u2
to extract a 1.3-degree wide, 1.8-degree high field around RA=3h20m00s (a.k.a. 50 degrees), declination -12. As you might expect, if you've not copied the data and are running straight off the CD, you need to be sure to have the correct CD in the drive: disk 1 for declinations -90 to -37, disk 2 for declinations -37 to +1, or disk 3 for areas north of declination +1.
Also (starting with the 5 January 2007 version), one can run the program in the folder containing UCAC-2 data with a UCAC-2 star number. The output will be a text version of the UCAC-2 record for that star. For example,
ucac2 31415926
would cause the program to display the basic data for 2U 31415926.
The DOS executable is provided in the .zip file.
Persons wishing to use UCAC-2 in Guide 8.0 should look here for information on how to accomplish that.
Persons wishing to use UCAC-2 in Charon (astrometry software) should look here for information on how to accomplish that.
Hope this is useful to you, or at least interesting. Please let me know if you've problems or thoughts.
Notes on 5 January 2007 changes: I needed to be able to get info on specific UCAC-2 stars by number. The 'extract_ucac2_info()' function in ucac2.cpp provides that capability. Also, I found that all stars in 'z000' (zone from the south celestial pole to dec -89.5) were given wrong numbers in the output from 'extract_ucac2_stars()' (offset by one), and fixed this.
Notes on 22 January 2004 changes: I had to make some small changes to support the new UCAC-2 Bright Star Supplement. The format of this data is essentially the same as that of "normal" UCAC-2, but the zones are five degrees high instead of .5 degrees, the file names are different, and the epoch is given to .01 year precision instead of .001. The changes made are described in ucac2.cpp.
Notes on 24 October 2003 changes: As is noted in the "comments" for ucac2.cpp, I learned that four parameters (the proper motions in RA and dec, and their "goodness of fit" parameters) could each be one byte more than I had allowed for. So I changed the format specifier for the output, resulting in each field growing by one byte and each line by four bytes.