#! /usr/local/bin/perl

$datafile = "yolo.database.info";

open(INFO, "$datafile");

while(<INFO>){
	if($_ =~ /ri-cocar/){
		$site = uc(substr($_, 0, 4));
		$coords = substr($_, 21);
		chomp($coords);
		if(!grep(/$site/ , @sites_in)){
			$coords{$site} = $coords;
			push(@sites_in, $site);
		}
	}
}	

print<<EOF;
*
* YOLO APRIORI COORDINATES FROM RINEX HEADERS
* 13-JUL-1999 mvandomselaar\@ucsd.edu
*
<< YOLO coordinates derived from the rinex headers >>
EOF

foreach $site (sort keys %coords){
	print(" ${site}_GPS  $coords{$site} 0 0 0 1998.500\n");
}

exit;
print<<CALCORS;
<< CALIFORNIA CORS coordinates derived from a 10 week globk centered around the middle of the experiment >>
CALCORS

$calcors = "/net/jon/ftp/pub/matthijs/csrc/coords.itrf96";
open(CALCORS, "$calcors");

while(<CALCORS>){
	$site = substr($_, 0, 4);
	$coords = substr($_, 5);
	chomp($coords);
	print(" ${site}_GPS $coords 0 0 0 1998.620\n");
}
		
