#!/bin/csh -bf # # GetRemoteData # # This script automatically logs onto remote computers # using ftp and gets data for IGS orbits. # Also gets data for all havenot stations in GetLog # # Modified from S.D.P. Williams, Jerry Svarc # 95/07/11 jls & whp Fixed bug in month calculation. # 95/07/12 jls & whp Changed name of script and collecting # all data from one source. # Currently all data is collected from CDDIS; # ftp to other sources is skipped. # 95/08/04 whp More fine tuning of ftp procedures. # 95/08/04 whp Move date manipulation to CreateObsDateFile. # 95/08/24 nek Modified to use GetLog, and match GetLocalData. # 95/09/06 nek Modified to match 09/05-06 changes in GetLocalData. # 95/10/11 whp Moved test for all remote stations to after orbit is # retrieved. We need IGS orbit even if all station # data is present. # 96/01/21 whp Save remote rinex data to local archive immediately # after retrieval. # Add option to exit at that point. # 96/01/22 whp Remove option to exit at that point. # 1996/01/22 whp Remove IGS orbit retrieval # (Done in gp.GetIGSOrbits now) # 1996/04/05 whp Changed call to DataToAttic for compatibility # 1999/03/10 jls Added check on length of file. If file is less than # 200 lines long do not save it. # 2000/10/28 jls Added code to grab and convert Hatanaka compressed # files found at SOPAC. # Verify existence of SaveObsDate # ------------------------------- if (! -e SaveObsDate) then echo GetRemoteData: SaveObsDate not found. Script stops. echo " Run CreateObsDateFile first." exit 1 endif # Verify existence of GetLog # ------------------------------------ if (! -e GetLog) then echo GetRemoteData: File GetLog not found. Script stops. echo " Run CreateGetLog first." exit 1 endif # Verify existence of NameTrans # -------------------------------- if (! -e /goa/sta_info/NameTrans) then echo GetRemoteData: File /goa/sta_info/NameTrans not found. Script stops. exit 1 endif # Set date strings # ---------------- set yr = `grep yrobs SaveObsDate | awk '{print $2}'` set longyr = `grep longyr SaveObsDate | awk '{print $2}'` set doy = `grep doy SaveObsDate | awk '{print $2}'` set yymmdd = `grep dateshort SaveObsDate | awk '{print $2}'` set datejpl = `grep datejpl SaveObsDate | awk '{print $2}'` set gpsweek = `grep gpsweekobs SaveObsDate | awk '{print $2}'` set dayofweek = `grep dayofweekobs SaveObsDate | awk '{print $2}'` set gpsweekdm1 = `grep gpsweekdm1 SaveObsDate | awk '{print $2}'` set dayofweekm1 = `grep dayofweekm1 SaveObsDate | awk '{print $2}'` set gpsweekdp1 = `grep gpsweekdp1 SaveObsDate | awk '{print $2}'` set dayofweekp1 = `grep dayofweekp1 SaveObsDate | awk '{print $2}'` # Start CDDIS # ----------------------------------------- # Get station list from GetLog # ---------------------------- ## set stalist = `grep remote GetLog | grep havenot | awk '{print $1}'` ## set stalistall = `echo $stalist` ## ## if ($#stalist == 0) then ## goto CleanUp ## endif ## ### Commands to retrieve remote rinex data files from CDDIS ### (We don't know whether files are on ### GPS1 or GPS2, so try both) ### --------------------------------------------- ## rm stalist.$$ ## if ($#stalist != 0) then ## @ i=1 ## while ($i <= $#stalist) ## echo get $stalist[$i]${doy}0.${yr}o.Z >> stalist.$$ ## @ i=$i + 1 ## end ## echo "prompt" > cddis.fil ## echo "binary" >> cddis.fil ## echo "cd gps/gpsdata/$yr$doy/${yr}o" >> cddis.fil ## cat stalist.$$ >> cddis.fil ## endif ## ## ### Retrieve files from CDDIS ### ------------------------- ## ftp.retrieve cddis.fil cddisa.gsfc.nasa.gov ## ### Decimate large files for 30 second interval ## ## uncompress -f *.Z ## ## while ($i <= $#stalist) ## set int = `grep INTERVAL $stalist[$i]${doy}0.${yr}o | awk '{print $1}'` ## if ($int != 30) then ## deci2_cors $stalist[$i] $yr $doy ## end ## ### Uncompress files. ### ----------------- ## chg_z2dotZ ## uncompress -f *.Z >& /dev/null ## ### Change file names to JPL form. ### ------------------------------ ## GetData.stnd2jpl ## ### Change to canonical station names, if necessary. ### In GetLog, change havenot to have for canonical names and all alternates. ### ------------------------------------------------------------------------- ## GetData.ChangeNames ## ### End CDDIS # --------- # Get station list from modified GetLog # ------------------------------------- set stalist = `grep remote GetLog | grep havenot | awk '{print $1}'` if ($#stalist == 0) then goto CleanUp endif # Start LOX # ---------- # Set up command file to get # rinex data from LOX # -------------------- rm stalist.$$ @ i=1 while ($i <= $#stalist) echo get $stalist[$i]${doy}0.${yr}d.Z >> stalist.$$ echo get $stalist[$i]${doy}0.${yr}o.Z >> stalist.$$ @ i=$i + 1 end echo cd /pub/rinex/${longyr}/$doy > lox.fil echo "binary" >> lox.fil cat lox.fil stalist.$$ > temp.$$ mv temp.$$ lox.fil # Retrieve files from LOX # ------------------------- ftp.retrieve lox.fil lox.ucsd.edu # Convert files that use Hatanaka compression into # standard rinex files. # ------------------------------------------------ uncompress -f *.Z CRZ2RNX *.${yr}d rm -f *.${yr}d # Decimate large files for 30 second interval while ($i <= $#stalist) set int = `grep INTERVAL $stalist[$i]${doy}0.${yr}o | awk '{print $1}'` if ($int != 30) then deci2_cors $stalist[$i] $yr $doy end # Check length of files. # ---------------------- @ j=1 while ($j <= $#stalist) if (-e $stalist[$j]${doy}0.${yr}o) then set file_length = `cat $stalist[$j]${doy}0.${yr}o | wc -l` if ($file_length < 4200) then echo WARNING: File $stalist[$j]${doy}0.${yr}o appears to be quite short. rnx_time $stalist[$j]${doy}0.${yr}o echo " It will not be saved." rm -f $stalist[$j]${doy}0.${yr}o endif endif @ j=$j + 1 end # Change file names to JPL form. # ------------------------------ GetData.stnd2jpl # Change to canonical station names, if necessary. # In GetLog, change havenot to have for canonical names and all alternates. # ------------------------------------------------------------------------- GetData.ChangeNames # End LOX # -------- # Get station list from modified GetLog # ------------------------------------- set stalist = `grep remote GetLog | grep havenot | awk '{print $1}'` if ($#stalist == 0) then goto CleanUp endif # Start BODHI # ----------- # Set up command file to get # rinex data from BODHI # -------------------------- rm stalist.$$ >& /dev/null @ i=1 while ($i <= $#stalist) echo get $stalist[$i]${doy}0.${yr}o.gz >> stalist.$$ echo get $stalist[$i]${doy}0.${yr}o.Z >> stalist.$$ @ i=$i + 1 end echo cd pub/pro/y${longyr}/d${doy} > bodhi.fil echo "binary" >> bodhi.fil cat bodhi.fil stalist.$$ > temp.$$ mv temp.$$ bodhi.fil # Retrieve files from BODHI # ------------------------- ftp.retrieve bodhi.fil bodhi.jpl.nasa.gov # Decimate large files for 30 second interval uncompress -f *.Z while ($i <= $#stalist) set int = `grep INTERVAL $stalist[$i]${doy}0.${yr}o | awk '{print $1}'` if ($int != 30) then deci2_cors $stalist[$i] $yr $doy end # Uncompress files. # ----------------- gunzip -f *.gz uncompress -f *.Z # Change file names to JPL form. # ------------------------------ GetData.stnd2jpl # Change to canonical station names, if necessary. # In GetLog, change havenot to have for canonical names and all alternates. # ------------------------------------------------------------------------- GetData.ChangeNames # End BODHI # --------- # Replace null lines in rinex files with lines full of zeros. # if rinex file is format 2 # ## replace ^$ " 0.0 00 0.0 00 0.0 00 0.0 00 0.0 00" *.rnx ## replace " " " 0.0 00 0.0 00 0.0 00 0.0 00 0.0 00" *o # Clean up and copy remote rinex files to /attic # ---------------------------------------------- CleanUp: set current_campaign = `cat CampaignsToInclude` if ($current_campaign != "Track") then rm stalist.$$ mkdir rinex @ i=1 while ($i <= $#stalistall) cp $datejpl$stalistall[$i]____??.rnx rinex @ i=$i + 1 end compress -f rinex/* echo Y | DataToAttic.pl rm -r rinex endif exit