#!/bin/csh -bf # # GetRegionalData # # This script automatically logs onto UCB's NCEDC computer # to get regional data for all havenot stations in GetLog. # # 1996/04/04 N.E. King Modified from GetRemoteData and getucb # 1999/03/10 jls Added check on length of file. If file is less than # 4200 lines long (~4 hours) do not save it. # Verify existence of SaveObsDate # ------------------------------- if (! -e SaveObsDate) then echo GetRegionalData: SaveObsDate not found. Script stops. echo " Run CreateObsDateFile first." exit 1 endif # Verify existence of GetLog # ------------------------------------ if (! -e GetLog) then echo GetRegionalData: 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 GetRegionalData: 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 datejpl = `grep datejpl SaveObsDate | awk '{print $2}'` # Get list of "regional" data not found on the local archive # Exit if list is zero-length # ---------------------------------------------------------- set stalist = `grep regional GetLog | grep havenot | awk '{print $1}'` if ($#stalist == 0) then exit endif # Set up command file to get rinex data from NCEDC # ------------------------------------------------ echo cd /pub/gps/rinex/$longyr/$longyr.$doy > ucb.fil echo "prompt" >> ucb.fil # echo get brib${doy}1.${yr}n.Z >> ucb.fil @ i=1 while ($i <= $#stalist) echo get $stalist[$i]${doy}0.${yr}o.Z >> ucb.fil @ i=$i + 1 end # Retrieve files from NCEDC # ------------------------- ftp.retrieve ucb.fil quake.geo.berkeley.edu # Uncompress files # ---------------- uncompress -f *.Z # 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 # --------- # Replace null lines in rinex files with lines full of zeros. # replace ^$ " 0.0 00 0.0 00 0.0 00 0.0 00 0.0 00" *.rnx >& /dev/null replace ^$ " 0.0 00 0.0 00 0.0 00 0.0 00 0.0 00" *o >& /dev/null replace " " " 0.0 00 0.0 00 0.0 00 0.0 00 0.0 00" *o >& /dev/null replace " " " 0.0 00 0.0 00 0.0 00 0.0 00 0.0 00" *rnx >& /dev/null # Clean up and copy regional rinex files to /attic # ------------------------------------------------ set current_campaign = `cat CampaignsToInclude` if ($current_campaign != "Track") then mkdir rinex @ i=1 while ($i <= $#stalist) cp $datejpl$stalist[$i]____??.rnx rinex @ i=$i + 1 end compress -f rinex/* echo Y | DataToAttic.pl rm -r rinex endif