#!/usr/bin/perl # # translate the HH MM SS and DD MM SS to decimal degrees of # RA and Dec for stars in the Dearborn spectral catalog file # while () { if (substr($_, 0, 1) eq "#") { printf "%s", $_; next; } chomp($_); $id = substr($_, 0, 5); $asterisk = substr($_, 5, 1); $rah = substr($_, 8, 2); $ram = substr($_, 12, 2); $ras = substr($_, 14, 5); $decd = substr($_, 20, 3); $decm = substr($_, 24, 2); $decs = substr($_, 27, 4); if ($decd =~ /-.*/) { $sign = -1; } else { $sign = 1; } $s = substr($_, 32, 1); if ($s eq " ") { $s = "."; } $gsc = substr($_, 34, 10); if ($gsc eq " ") { $gsc = 0; } $iras = substr($_, 44, 11); if ($gsc eq " ") { $gsc = 0; } $mv = substr($_, 56, 4); $spec = substr($_, 62, 5); chomp($spec); $remarks = substr($_, 68, 20); chomp($remarks); if (substr($remarks, 0, 1) eq "") { $remarks = " "; } # printf "spec is ..%s.. remarks is ..%s..\n", $spec, $remarks; # calculate the RA and Dec in decimal degrees $ra_deg = ($rah + ($ram/60.0) + ($ras/3600.0))*15.0; if ($decd < 0) { $decd = 0.0 - $decd; } $dec_deg = $sign*($decd + ($decm/60.0) + ($decs/3600.0)); # now print out the information printf "%6d %1s %9.5f %9.5f %1s %10s %11s %4.1f %-5s %s\n", $id, $asterisk, $ra_deg, $dec_deg, $s, $gsc, $iras, $mv, $spec, $remarks; } exit 0;