#!/usr/bin/env perl

#this script expects ra dec state fault

#state 0 - full and no fault
#state 1 - new and pending
#state 2 - faulted somehow




while (<>) {
    if ($_ =~ 'ra') { next;}
 my @split = split /\s+/, $_;
 if ($split[2] =~ 'full') {
     if ($split[3] == 0) {
	 $state = 0;
     } else {
	 $state = 2; 
     }
 } else {
     #assume it is 'new'
     if ($split[3] =~ 'NULL') {
	 $state = 1;
     } else {
	 $state = 2;
     }
     
 }

 $ra = $split[0]*180/3.1415927;
 $dec = $split[1]*180/3.1415927;


    print "$ra $dec $state\n";

 
}
