Quicksat awk script

From: Sventek <sventekp_at_cuug.ab.ca>
Date: Thu, 27 Apr 1995 21:21:01 -0400
Several folks have recently mentioned using Mike McCants' Quicksat program
for computing an evening's worth of predictions; it's my drug of choice as
well. Perhaps some of you might find an awk script I've written helpful in
preparing for an evening's observing.

The script reads through the output file Quicksat generates and computes
the distance between a satellite's position and the position you set within
the script. If the distance between the satellite and your target position
is 20 degrees or less (0.35 rad), time, RA, Dec, separation, etc. are
passed through. This script is great if you're trying to show satellite
observing to someone new to the activity... you can set the target position
to something easy (a bright star, Big Dipper bowl, etc.) and watch
satellites pass by the target at the appointed times.

I have Quicksat set for normal visual mode, and I usually set the time step
to 0.3 or 0.2 to get lots of positions per satellite pass.

Since the script uses functions, it will work with nawk or gawk (not awk)
with the following command:

                     nawk -f dist.awk output.txt

where dist.awk is the script, and output.txt is the Quicksat output
file. Generally I'd redirect the output to a file to examine later. Awk,
nawk, and gawk are UNIX commands, but some versions are available for the
PC (it's not hard to do an archie search and find numerous places to
download a PC version of awk... the PC awk version I use does allow
functions).

Here's the script... have fun:

-------------------- cut here ---------------
     function haver(ang) {
              return ((1-cos(ang))/2) }
     function separ(D1,D2,R1,R2) {
              b = haver(D1-D2) + cos(D1)*cos(D2)*haver(R1-R2)
              return (asine(sqrt(b))*2) }
     function asine(z) {
              return (z*(1+z*z*(1/6+z*z*(3/40+(15*z*z/336))))) }

BEGIN {
      # Enter 2000.0 RA of target position here
      rah = 14
      ram = 15
      # Enter 2000.0 Dec of target position here
      dd  = 19
      dm  = 13
      R1 = (rah + ram/60.0) * 15.0 / 57.29577952
      D1 = (dd + dm/60.0) / 57.29577952 }
{
if ($8=="Times")
   printf("\n%s\n\n", $0)

if( $7=="C" && NF==19 && $2=="M")
printf(" %s  %s  %s   %s %s    %s %s   %s  %s   %s  separ\n", $1, $2, $3,  $5,  $6, $9, $13, $17, $18, $19)

if( $7=="C" && NF==19 && $2!="M")
{
D2 = $19 / 57.29577952
R2 = ($17 + ($18/60.0)) * 15 / 57.29577952
c =  separ(D1,D2,R1,R2)
if(c<=.35)
printf("%2d %2d %2d   %2d %3d  %5.1f %3d  %2d %2d %5.1f  %3.1f\n", $1, $2, $3,  $5, $6, $9, $13, $17, $18, $19, c*57.29577952)
}

if( $7!="C" && NF==18)
{
D2 = $18 / 57.29577952
R2 = ($16 + ($17/60.0)) * 15 / 57.29577952
c =  separ(D1,D2,R1,R2)
if(c<=.35)
printf("%2d %2d %2d   %2d %3d  %5.1f %3d  %2d %2d %5.1f  %3.1f\n", $1, $2, $3,  $5, $6, $8, $12, $16, $17, $18, c*57.29577952)
}

if( $7=="C" && NF==18)
{
D2 = $18 / 57.29577952
R2 = ((int($17/100)) + (($17%100)/60.0)) * 15 / 57.29577952
c =  separ(D1,D2,R1,R2)
if(c<=.35)
printf("%2d %2d %2d   %2d %3d  %5.1f %3d  %2d %2d %5.1f  %3.1f\n", $1, $2, $3,  $5, $6, $9, $13, int($17/100), $17%100, $18, c*57.29577952)
}

if( $7!="C" && NF==17)
{
D2 = $17 / 57.29577952
R2 = ((int($16/100)) + (($16%100)/60.0)) * 15 / 57.29577952
c =  separ(D1,D2,R1,R2)
if(c<=.35)
printf("%2d %2d %2d   %2d %3d  %5.1f %3d  %2d %2d %5.1f  %3.1f\n", $1, $2, $3,  $5, $6, $8, $12, int($16/100), $16%100, $17, c*57.29577952)
}

if($1>= 100 && $1!="H")
    printf("\n%s\n", $0)
}

--------------------- cut here -------------------

Paul
sventekp@cuug.ab.ca
paul@kelman.ab.ca (daytime)
Received on Thu Apr 27 1995 - 22:14:22 UTC

This archive was generated by hypermail 2.2.0 : Fri Mar 07 2014 - 00:14:10 UTC