#!/bin/csh -bf # # gp.clean # # RUN PHASEDIT (IF NECESSARY), CLOCKPREP (IF NECESSARY), # AND NINJA # ------------------------------------------------------ # # Modifications: # 1995/10/10 whp: Created by extracting all data cleaning from bard.all # 1996/01/25 jls: Fixed Ashtech routines to determine codeless receivers # 1996/06/24 nek: Added option to use mean options file for phasedit. # 1998/02/09 jls: Because the phase-center for Block IIR satelliets is not # modelled correctly, if the date is greater than 19970722 # (launch date of GPS43) delete these observations from qm # files. # 1998/02/09 jls: Took the nice out of ninja call. # 1998/02/11 whp: Added call to FixQMs to check for and fix erroneous # Block I entries in qm files. # 1998/04/24 whp Saved qm file immediately after cleaning. # 1998/08/25 jls Took out del_qm for block IIR satellites. GIPSY_R5 now # correctly models these satellites. # 2000/02/23 jls Changed Trimble cleaning routine to handle 4000SSE(full-wavlength) # and 4000SST(half-wavelength) differently. SSE files are cleaned # using Ninja, SST files are cleaned using phasedit. # 2001/06/05 whp Call gp.SaveQMs.pl instead of gp.SaveQMs echo "gp.clean: Processing started" > clean.log echo `date` >> clean.log # Define userful variables # ------------------------ set Interval = `grep Interval ProcessFlags | awk '{print $2}'` set datejpl = `grep datejpl SaveObsDate | awk '{print $2}'` foreach file (`ls ${datejpl}*.rnx`) set base=`basename $file` # Entire RINEX file name set baseleft=`echo $base | awk '{print substr($1,1,17)}'` # Name without .rnx # Check for existence of qm file and setting of UseExistQMs flag # -------------------------------------------------------------- set UseExistQMs = `grep UseExistQMs ProcessFlags | awk '{print $2}'` if ($UseExistQMs == "yes" && -e $baseleft.qm) then echo "gp.clean: Using existing $baseleft.qm file" >> clean.log else set tag = `echo $base | awk '{print substr($1,16,1)}'` # Receiver type a, r, b, etc. echo " " >> clean.log echo "----------------" Processing $base "----------------" echo "----------------" Processing $base "----------------" >> clean.log switch ($tag) case r: # Rogue data - run NINJA # ---------------------- echo " " >> clean.log echo gp.clean: Rogue data - run NINJA >> clean.log echo " Input `pwd`/$base" >> clean.log echo " Output `pwd`/$baseleft.qm" >> clean.log ninja -t $Interval -i $base -q $baseleft.qm > temp1.$$ set epochsin = `grep "Total number of input epochs" temp1.$$ | awk '{print $7}'` set epochsout = `grep "Total number of output epochs" temp1.$$ | awk '{print $7}'` echo " Total number of input epochs = " $epochsin >> clean.log echo " Total number of input epochs = " $epochsin echo " Total number of output epochs = " $epochsout >> clean.log echo " Total number of output epochs = " $epochsout grep WARNING temp1.$$ if (`grep WARNING temp1.$$ | wc -l` != 0 ) then echo " " echo " " >> clean.log echo Last 10 lines of NINJA log file: echo Last 10 lines of NINJA log file: >> clean.log tail temp1.$$ tail temp1.$$ >> clean.log endif cat clean.log temp1.$$ > temp2.$$ mv temp2.$$ clean.log breaksw case l: # Rogue data - run NINJA # ---------------------- echo " " >> clean.log echo "gp.clean: Running ClockPrep" >> clean.log echo " Input `pwd`/$base" >> clean.log echo " Output `pwd`/$baseleft.clk" >> clean.log clockprep -fixtags -i $base -o $baseleft.clk >>$ clean.log set records = `tail -1 clean.log | awk '{print $1}'` echo " " $records records processed >> clean.log echo " " >> clean.log echo gp.clean: Leica data - run NINJA >> clean.log echo " Input `pwd`/$base" >> clean.log echo " Output `pwd`/$baseleft.qm" >> clean.log ninja -t $Interval -i $base -q $baseleft.qm > temp1.$$ set epochsin = `grep "Total number of input epochs" temp1.$$ | awk '{print $7}'` set epochsout = `grep "Total number of output epochs" temp1.$$ | awk '{print $7}'` echo " Total number of input epochs = " $epochsin >> clean.log echo " Total number of input epochs = " $epochsin echo " Total number of output epochs = " $epochsout >> clean.log echo " Total number of output epochs = " $epochsout grep WARNING temp1.$$ if (`grep WARNING temp1.$$ | wc -l` != 0 ) then echo " " echo " " >> clean.log echo Last 10 lines of NINJA log file: echo Last 10 lines of NINJA log file: >> clean.log tail temp1.$$ tail temp1.$$ >> clean.log endif cat clean.log temp1.$$ > temp2.$$ mv temp2.$$ clean.log breaksw case a: # Ashtech data - could be half or full wavelength (Z data) # -------------------------------------------------------- set PFlag = `grep "REC # / TYPE / VERS" $base | grep "Z" | wc -l | awk '{print $1}'` # Run PHASEDIT for codeless data, CLOCKPREP for either if ($PFlag == 0 ) then # Ashtech codeless - run PHASEDIT, CLOCKPREP, NINJA -NOEDIT # If station is in /attic/UseMeanPhasEdit, use mean edit_options # -------------------------------------------------------------- mv $base raw_phasedit echo " " >> clean.log echo gp.clean: Ashtech codeless data - run PHASEDIT, CLOCKPREP, NINJA -NOEDIT >> clean.log echo gp.clean: Running PhasEdit >> clean.log echo " Input `pwd`/raw_phasedit/$base" >> clean.log echo " Output output `pwd`/$base" >> clean.log cp /goa/local/templates/edit_options.phasedit edit_options phasedit2 $base >> ninja.log echo " " >> clean.log echo "gp.clean: Running ClockPrep" >> clean.log echo " Input `pwd`/$base" >> clean.log echo " Output `pwd`/$baseleft.clk" >> clean.log clockprep -fixtags -i $base -o $baseleft.clk >> clean.log set records = `tail -1 clean.log | awk '{print $1}'` echo " " $records records processed >> clean.log echo " " >> clean.log echo "gp.clean: Running ninja" >> clean.log echo " Input `pwd`/$baseleft.clk" >> clean.log echo " Output `pwd`/$baseleft.qm" >> clean.log ninja -noedit -t $Interval -i $baseleft.clk -q $baseleft.qm > temp1.$$ set epochsin = `grep "Total number of input epochs" temp1.$$ | awk '{print $7}'` set epochsout = `grep "Total number of output epochs" temp1.$$ | awk '{print $7}'` echo " Total number of input epochs = " $epochsin >> clean.log echo " Total number of input epochs = " $epochsin echo " Total number of output epochs = " $epochsout >> clean.log echo " Total number of output epochs = " $epochsout grep WARNING temp1.$$ if (`grep WARNING temp1.$$ | wc -l` != 0 ) then echo " " >> clean.log echo " " echo Last 10 lines of NINJA log file: >> clean.log echo Last 10 lines of NINJA log file: tail temp1.$$ >> clean.log tail temp1.$$ endif cat clean.log temp1.$$ > temp2.$$ mv temp2.$$ clean.log else # Ashtech Z-model - run CLOCKPREP, NINJA # --------------- echo " " >> clean.log echo gp.clean: Ashtech Z data - run CLOCKPREP, NINJA >> clean.log echo "gp.clean: Running ClockPrep" >> clean.log echo " Input `pwd`/$base" >> clean.log echo " Output `pwd`/$baseleft.clk" >> clean.log clockprep -fixtags -i $base -o $baseleft.clk >> clean.log set records = `tail -1 clean.log | awk '{print $1}'` echo " " $records records processed >> clean.log echo " " >> clean.log echo "gp.clean: Running ninja" >> clean.log echo " Input `pwd`/$baseleft.clk" >> clean.log echo " Output `pwd`/$baseleft.qm" >> clean.log ninja -t $Interval -i $baseleft.clk -q $baseleft.qm > temp1.$$ set epochsin = `grep "Total number of input epochs" temp1.$$ | awk '{print $7}'` set epochsout = `grep "Total number of output epochs" temp1.$$ | awk '{print $7}'` echo " Total number of input epochs = " $epochsin >> clean.log echo " Total number of input epochs = " $epochsin echo " Total number of output epochs = " $epochsout >> clean.log echo " Total number of output epochs = " $epochsout grep WARNING temp1.$$ if (`grep WARNING temp1.$$ | wc -l` != 0 ) then echo " " >> clean.log echo " " echo Last 10 lines of NINJA log file: >> clean.log echo Last 10 lines of NINJA log file: tail temp1.$$ >> clean.log tail temp1.$$ endif cat clean.log temp1.$$ > temp2.$$ mv temp2.$$ clean.log endif breaksw case b: # Trimble half wavelength data - run CLOCKPREP and NINJA # ------------------------------------------------------ set EFlag = `grep "REC # / TYPE / VERS" $base | grep "SSE" | wc -l | awk '{print $1}'` set IFlag = `grep "REC # / TYPE / VERS" $base | grep "SSI" | wc -l | awk '{print $1}'` set TFlag = `grep "REC # / TYPE / VERS" $base | grep "4700" | wc -l | awk '{print $1}'` # Run PHASEDIT for codeless data, CLOCKPREP for either if ($TFlag == 0 && $IFlag == 0 && $EFlag == 0) then mv $base raw_phasedit echo " " >> clean.log echo gp.clean: Trimble codeless data - run PHASEDIT, CLOCKPREP, NINJA -NOEDIT >> clean.log echo gp.clean: Running PhasEdit >> clean.log echo " Input `pwd`/raw_phasedit/$base" >> clean.log echo " Output output `pwd`/$base" >> clean.log cp /goa/local/templates/edit_options.phasedit edit_options phasedit2 $base >> ninja.log echo " " >> clean.log echo "gp.clean: Running ClockPrep" >> clean.log echo " Input `pwd`/$base" >> clean.log echo " Output `pwd`/$baseleft.clk" >> clean.log clockprep -fixtags -i $base -o $baseleft.clk >> clean.log set records = `tail -1 clean.log | awk '{print $1}'` echo " " $records records processed >> clean.log echo " " >> clean.log echo "gp.clean: Running ninja" >> clean.log echo " Input `pwd`/$baseleft.clk" >> clean.log echo " Output `pwd`/$baseleft.qm" >> clean.log ninja -noedit -t $Interval -i $baseleft.clk -q $baseleft.qm > temp1.$$ set epochsin = `grep "Total number of input epochs" temp1.$$ | awk '{print $7}'` set epochsout = `grep "Total number of output epochs" temp1.$$ | awk '{print $7}'` echo " Total number of input epochs = " $epochsin >> clean.log echo " Total number of input epochs = " $epochsin echo " Total number of output epochs = " $epochsout >> clean.log echo " Total number of output epochs = " $epochsout grep WARNING temp1.$$ if (`grep WARNING temp1.$$ | wc -l` != 0 ) then echo " " >> clean.log echo " " echo Last 10 lines of NINJA log file: >> clean.log echo Last 10 lines of NINJA log file: tail temp1.$$ tail temp1.$$ >> clean.log endif cat clean.log temp1.$$ > temp2.$$ mv temp2.$$ clean.log else # Trimble full wavelength - run CLOCKPREP, NINJA # ---------------------------------------------- echo " " >> clean.log echo gp.clean: Trimble full wavelength data - run CLOCKPREP, NINJA >> clean.log echo "gp.clean: Running ClockPrep" >> clean.log echo " Input `pwd`/$base" >> clean.log echo " Output `pwd`/$baseleft.clk" >> clean.log clockprep -fixtags -i $base -o $baseleft.clk >> clean.log set records = `tail -1 clean.log | awk '{print $1}'` echo " " $records records processed >> clean.log echo " " >> clean.log echo "gp.clean: Running ninja" >> clean.log echo " Input `pwd`/$baseleft.clk" >> clean.log echo " Output `pwd`/$baseleft.qm" >> clean.log ninja -t $Interval -i $baseleft.clk -q $baseleft.qm > temp1.$$ set epochsin = `grep "Total number of input epochs" temp1.$$ | awk '{print $7}'` set epochsout = `grep "Total number of output epochs" temp1.$$ | awk '{print $7}'` echo " Total number of input epochs = " $epochsin >> clean.log echo " Total number of input epochs = " $epochsin echo " Total number of output epochs = " $epochsout >> clean.log echo " Total number of output epochs = " $epochsout grep WARNING temp1.$$ if (`grep WARNING temp1.$$ | wc -l` != 0 ) then echo " " >> clean.log echo " " echo Last 10 lines of NINJA log file: >> clean.log echo Last 10 lines of NINJA log file: tail temp1.$$ tail temp1.$$ >> clean.log endif cat clean.log temp1.$$ > temp2.$$ mv temp2.$$ clean.log endif endsw # Save qm file # ------------ gp.SaveQMs.pl $baseleft.qm endif # End if on UseExistQMs echo $baseleft.qm >> ../`grep datelong SaveObsDate | awk '{print $2}'`.log qm_sum -date $baseleft.qm | grep -v bias >> ../`grep datelong SaveObsDate | awk '{print $2}'`.log echo Total number of biases `qm_sum -date $baseleft.qm | grep bias | wc -l` >> ../`grep datelong SaveObsDate | awk '{print $2}'`.log echo " " >> ../`grep datelong SaveObsDate | awk '{print $2}'`.log end # Clean up directory # ------------------ mkdir turboedit_files mv *.tboplt turboedit_files exit