#!/bin/csh -bf # # gp.data # # Script to process GPS data, # from data retrieval through postfit. # N.E. King # January 1994 # August 1994 modified to use scripts bard.getdata, # bard.qregres, bard.filter, bard.smapper, bard.postfit. # # March 1995 modified to run GIPSY R3 on swave # 1995/10/10 whp: Converted bard.all to gp.all # 1995/10/16 whp: Converted first half of gp.all to gp.data # Moved rerun logic to gp.driver # 1996/01/22 whp: Added call to gp.GetIGSOrbits # 1996/04/15 nek: Added call to GetRegionalData # 1997/12/17 whp: Added call to GetQMFiles # 1998/04/11 jls/whp Adapted to handle point position cases # 1998/04/24 whp Skip addstapos, addstasvec, addstaid # for Track, Bard, LongValley # 1998/08/25 jls Commented out CreatePRN_GPS # 1999/01/20 jls Added call to GetPangaData # 1999/02/24 jls Added call to GetCVOData echo " " # CHECK NUMBER OF ARGUMENTS # ------------------------- if ($#argv != 0) then echo Usage: gp.data echo gp.data: No longer requires date. echo gp.data: It expects a SaveObsDate file. exit 1 endif # Create Checklist file of stations for retrieving data # ---------------------------------------- set CampaignList = `sed -n '/.*/p' CampaignsToInclude` # (Note: sed ignores blank lines in file) CreateGetLog $CampaignList # Create PRN_GPS file # ----------------- # CreatePRN_GPS # if ($status != 0) then # echo gp.data: CreatePRN_GPS returned non-zero status. # echo gp.data: stops. # exit 1 # endif # Then retrieve data: first from local archive, # then from Berkeley archive, # then from remote archives. # GetRemoteData also gets IGS orbit files. # ---------------------------------------- GetLocalData GetRegionalData GetRemoteData GetDixieData GetPangaData GetCVOData GetCorsData GetUNAVCOData set yyyymmdd = `grep datelong SaveObsDate | awk '{print $2}'` set yymm = `grep yymm SaveObsDate | awk '{print $2}'` set longyr = `grep longyr SaveObsDate | awk '{print $2}'` set dateshort = `grep dateshort SaveObsDate | awk '{print $2}'` set ymdobs = `grep ymdobs SaveObsDate | awk '{print $2}'` set point_position = `grep PointPosition ProcessFlags | awk '{print $2}'` if ($point_position != "yes") then gp.GetIGSOrbits echo gp.data: GetData section finished # Create TPNML file # ----------------- CreateTPNML set orbit_type = `grep OrbitType ProcessFlags | awk '{print $2}'` # If orbit type is "F" (final igs orbit) then Convert # sp3 formatted orbit files into gipsy eci format # --------------------------------------------------- if ($orbit_type == "F" || $orbit_type == "P") then echo " " echo gp.data: Orbit conversion started ConvertSP3toECI $ymdobs ## if ($status != 0) then ## echo gp.data: ConvertSP3toECI returned non-zero status. ## echo gp.data: stops. ## exit 4 ## endif echo gp.data: Orbit conversion finished else echo gp.data: Unknown orbit type echo orbit_flag = $orbit_type echo gp.data: stops. exit 4 endif else set Path = `ap in $yyyymmdd` if ((-e $Path/Shadow || -e $Path/Shadow.Z) && \ (-e $Path/peci || -e $Path/peci.Z) && \ (-e $Path/tpeo.nml || -e $Path/tpeo.nml.Z) && \ (-e $Path/TDPfile || -e $Path/TDPfile.Z)) then echo "gp.data: Getting orbit info from attic" cp $Path/peci* . cp $Path/Shadow* . cp $Path/tpeo.nml* . cp $Path/TDPfile* . uncompress -f peci.Z uncompress -f Shadow.Z uncompress -f tpeo.nml.Z uncompress -f TDPfile.Z else echo "gp.data: Getting orbit info from jpl" set yymmmdd = `grep datejpl SaveObsDate | awk '{print $2}'` gp.fetch_orbits $yymmmdd # If we have final orbits put them in archive # ------------------------------------------- set orbit = `grep OrbitType ProcessFlags | awk '{print $2}'` set intpath = "/GPSdata/intermediate/"$longyr"/"$yymm"/"$dateshort echo "intpath = "$intpath if ($orbit == "F") then compress -f Shadow compress -f TDPfile compress -f peci compress -f tpeo.nml cp peci.Z $intpath cp peci $intpath cp Shadow.Z $intpath cp Shadow $intpath cp TDPfile.Z $intpath cp TDPfile $intpath cp tpeo.nml.Z $intpath cp tpeo.nml $intpath uncompress -f *.Z endif endif # Check the number of eci files in current directory # -------------------------------------------------- if (`ls peci | wc -l` < 1 ) then echo " " echo "Could not find rapid or predicted JPL orbits." echo " " echo "gp.data: exit" exit endif # Clean up directory # ------------------ rm $ymdobs* >& /dev/null endif # Check setting of UseExistQMs flag # and recover qm files if requested # --------------------------------- set UseExistQMs = `grep UseExistQMs ProcessFlags | awk '{print $2}'` if ($UseExistQMs == "yes") then echo "gp.data: Using existing qm files where possible" GetQMFiles if ($status != 0) then echo gp.data: GetQMFiles returned non-zero status. echo gp.data: stops. exit 1 endif endif # Check to see if appropriate information exists in # /goa/sta_info/sta_id and /goa/sta_info/sta_pos # and add hi's to /goa/sta_info/sta_svec # -------------------------------------- set UsedCampaigns = `cat CampaignsToInclude` set ContCampaigns = ( \ Track \ Bard \ LongValley \ AlaskaCors \ EastPlains \ GreatLakes \ MiddleSouth \ MidWest \ NorthEast \ SouthEast \ SouthTexas \ WestPlains \ WestTexas \ ) set NeedStaInfoCk = "no" foreach Used ($UsedCampaigns) set FoundThisOne = "no" foreach Cont ($ContCampaigns) if ($Used == $Cont) then set FoundThisOne = "yes" endif end if ($FoundThisOne == "no") then set NeedStaInfoCk = "yes" endif end if ($NeedStaInfoCk == "yes") then gp.addstaid if ($status != 0) then echo gp.data: gp.addstaid returned non-zero status. echo gp.data: stops. exit 5 endif gp.addstapos if ($status != 0) then echo gp.data: gp.addstapos returned non-zero status. echo gp.data: stops. exit 6 endif gp.addstasvec if ($status != 0) then echo gp.data: gp.addstasvec returned non-zero status. echo gp.data: stops. exit 7 endif endif # NeedStaInfoCk # Create directory for phasedit processing # Note: Phasedit only used for codeless # ------------------------------------- if (! -e raw_phasedit) then mkdir raw_phasedit endif # RUN PHASEDIT (IF NECESSARY), CLOCKPREP (IF NECESSARY), # AND NINJA # ------------------------------------------------------ gp.clean if ($status != 0) then echo gp.data: gp.clean returned non-zero status. echo gp.data: stops. exit 8 endif # CLEAN UP # -------- foreach File (`ls raw_phasedit`) mv -f raw_phasedit/$File $File end rmdir raw_phasedit if (`ls *.clk | wc -l` != 0 ) then rm *.clk endif exit