precess_list

Precess a list of coordinates.

 
% precess_list 
Usage: precess_list list.ra_dec_eq_name 2018.3 New.file 
arg1 = input list (RAsex, DECsex, Equinox, Name) 
arg2 = year to be precessed to
arg3 = Name of new (precessed) file

% cat Steve.3  
02:16:43.0      +03:13:08       1950    PG0216+032
03:10:49.9      +14:55:14       1950    PG0310+149
05:05:30.6      +52:49:54       2000    G191B2B
08:10:49.3      +74:57:57       2000    BD+75o325
08:23:01.0      +54:37:58       1950    PG0823+546

% precess_list Steve.3 2000.0 Steve.4  

% cat Steve.4  
02:19:18.9289 +03:26:53.947 2000.0 PG0216+032
03:13:36.9537 +15:06:23.914 2000.0 PG0310+149
05:05:30.6009 +52:49:53.994 2000.0 G191B2B
08:10:49.2989 +74:57:57.008 2000.0 BD+75o325
08:26:50.4240 +54:28:05.605 2000.0 PG0823+546

Actually this script is a collection of other rather useful scripts and methods. I used code to check and clean the input sexigecimal values in addition to performing the precession. Hence, I show the script below.

 
#!/bin/bash

verb_chek precess_list

# Check that an argument is present
if [ -z "$1" ]
then
  printf "Usage: precess_list list.ra_dec_eq_name 2018.3 New.file \n"
  printf "arg1 = input list (RAsex, DECsex, Equinox, Name) \n"
  printf "arg2 = year to be precessed to\n"
  printf "arg3 = Name of new (precessed) file\n"
  exit 1
fi
if [ -z "$2" ]
then
  printf "arg2 = year to be precessed to \n"
  exit 1
fi
if [ -z "$3" ]
then
  printf "arg3 = Name of new (precessed) file\n"
  exit 1
fi

infile="$1"
equOUT="$2"
outfile="$3"

# delete any previou output file if it exists 
\rm -f $outfile 

# Read each line in the input file (= $fin) using file descriptor 4
i="0"
exec 4<$infile
while read -u4 rsex dsex equIN name
do

# check (and clean up, if need be) the RA 
sex2float.sh $rsex > ra.float_hours  
read raFPhours < ra.float_hours
float2sex.sh $raFPhours h > ra.sexC
read rsexC < ra.sexC

# check (and clean up, if need be) the DEC 
sex2float.sh $dsex > dec.float_deg
read decFPdeg < dec.float_deg
float2sex.sh $decFPdeg d > dec.sexC
read dsexC < dec.sexC

# Now process the cleaned up sexigecimal values 
psex.py -- $rsexC $dsexC > out.psex
read rs1 ds1 rdeg rhours ddeg < out.psex

# precess
precess.sh $rdeg $ddeg $equIN $equOUT  > Pvals
read rsexP dsexP eq < Pvals  

 if [ -s "Verbose.On" ]
 then 
  i=$[$i+1]
  printf "\n\n line = $i \n"
  printf " RA: $rsex $raFPhours $rsexC \n"
  printf "DEC: $dsex $decFPdeg $dsexC \n"
  printf "RA,DEC(hours,degrees) = $rhours $ddeg\n"
  printf "Equinox IN,OUT = $equIN $equOUT\n"
  printf "PRECESSED: $rsexP $dsexP \n"
 fi 

# Print the final precessed values 
 printf "$rsexP $dsexP $equOUT $name\n" >> $outfile 

done 

if [ -s "Verbose.On" ]
then 
 exit
fi 

#-------------------------------------------------------------
# clean up working files 
\rm -f dec.float_deg dec.float_hours dec.sexC junc out.psex
\rm -f Pvals ra.float_hours ra.sexC runner
#-------------------------------------------------------------





Back to SCO CODES page