#!/bin/csh -bf # # gp.teqcstapos # # Script to update station positions in sta_info/sta_pos. # J.L. Svarc # January 6 2000 # # Purpose: This script is designed to search a directory # for rinex files. Orbit files are then pulled from # the archive and merged into a single file. TEQC is # then run to generate a reasonable station position. # The sta_pos file is then updated replacing the old # value if it was present with a new position. # Define station info directory # ----------------------------- set Prefix = "sta_info" # cp -f $Prefix/sta_pos $Prefix/sta_pos_old/sta_pos.old.$$ # SEARCH FOR RINEX FILES IN JPL FORMAT # ------------------------------------ set numfiles = `ls *.rnx | wc -l ` if ($numfiles == 0) then echo " " echo "gp.teqcstapos: No RINEX observation files found in this directory." echo "gp.teqcstapos: Check file names for proper format" echo " " exit 1 else set filesearch="" set filesearch=($filesearch *.rnx) shift filesearch endif # Get orbit data # -------------- set longdate = `grep datelong SaveObsDate | awk '{print $2}'` set dayofyear = `grep doy SaveObsDate | awk '{print $2}'` set appendix = `grep yrobs SaveObsDate | awk '{print $2}'` rm -f *n.Z >& /dev/null cp -f `ap ri $longdate`/*n.Z . uncompress -f *n.Z # Check for existence of orbit file # --------------------------------- set numephemeris = `ls *n | wc -l ` if ($numfiles == 0) then echo " " echo "gp.teqcstapos: No RINEX orbit files found in archive." echo "gp.teqcstapos: Check archive or ftp orbit file" echo " " exit 1 endif fuseph `ls *n` > combined_orbit # SEARCH FOR STA_ID AND ADD IF NECESSARY # -------------------------------------- foreach file ($filesearch) set base=`basename $file` set sta1 = `echo $base | awk '{print substr($1,8,4) }'` set sta = `echo $sta1 | tr '[a-z]' '[A-Z]'` set standardname = $sta1$dayofyear"1."$appendix"o" cp -f $file $standardname cp -f combined_orbit $sta1$dayofyear"1."$appendix"n" # Run teqc # -------- teqc +qc +pos $standardname | grep "antenna WGS 84 (xyz)" > station_pos set xpos = `cat station_pos | awk '{print $6}'` set ypos = `cat station_pos | awk '{print $7}'` set zpos = `cat station_pos | awk '{print $8}'` set string1 = "00:00: 0.00 9999999.00" set string2 = "0.00000000e+00 0.00000000e+00 0.00000000e+00" set string3 = `date '+%Y %m %d %H:%M:%S'` set string4 = " gp.teqcstapos" echo " "$sta" 1985 01 01 "$string1" "$xpos" "$ypos" "$zpos" "$string2 $string3 $string4 > sta_pos.$$ # Create new sta_pos file # ----------------------- grep -v "^ $sta" $Prefix/sta_pos | sort > sta_pos_original.$$ cat sta_pos.$$ sta_pos_original.$$ | sort > test_sta_pos cp -f test_sta_pos $Prefix/sta_pos end # End foreach loop on rinex files # Clean up # -------- rm -f sta_pos.* sta_pos_original.* test_sta_pos *.$appendix"n" *.$appendix"o" rm -f combined_orbit *n exit