Processing GPS Upto_05

   cd ~hgs/gps
   source gdh2005.env

many of the programs needed below are in ~hgs/gps/bin ~hgs/bin (executables)
and some files to be run with tcsh source are in ~hgs/gps.
The current directory . should also be on the path list.

The "h" in gdh2005 stands for postprocessing of gipsy PPP results in the Heflin (JPL) frame 2004 (ITRF2000).
 
gdh2005.env sets data paths and environment parameters (tcsh).
Some directories must be in place
$SD
$SDIR
$DDIR
$RDIR

have a look at gdh2005.env , mkdir as necessary. Save already existing directories in which you don't want to write using mv
mv ~/gps/Upto_05 ~/gps/Upto_05_10deg

Change definition of $SD to point to your new data source.

1. Getting the data

     statistics -R $REFF.stacov -I many-input-stacov -gds
produces
SITE.rad SITE.lon SITE.lat
where many-input-stacov is a long list of stacov files. It can be impractically many, so the work should be split up into e.g. annual segments. The

Assume these are in directory $SD (could be more than one, then a whitespace-delimited list)

     collect_many_NEV $SD

collects the three components (eventually from the different $SD's ) and outputs one file $SDIR/SITE.nev for each site

In gdh2005.env here is a list of
setenv ASIT_ash SITE
used by collect_many_NEV

and a list of
setenv SITX_alias SITE
used by gd2ren

Purpose of _ash: ASIT.rad etc -> SITE.nev
Purpose of _alias: combine two SITA.nev SITB.nev into one SITA-gd.ep series using a known / approximative offset.

2. Reference file

I made an ITRF ssc-style file out of Heflin's table.txt with
cd ~/IGS
posvel2ssc.pl heflin_04_00.posvel > heflin_04_00.ssc
where heflin_04_00.posvel is the local copy of table.txt

     http://sideshow.jpl.nasa.gov/mbh/all/table.txt
     ln -s table.txt heflin_04_00.posvel
     http://sideshow.jpl.nasa.gov/mbh/all/table2.txt # gd-type


3. Reduced time series and Least-squares

cd ~/gps
rm -f $DDIR/*.gd.ep

# choose:
set showplot=
# or
unset showplot

foreach site ( `the-sites-of SWEPOS FINNNET IGSU` )
source analyze-site.env
end

where analyze-site.env is
if ( ! -r $DDIR/${site}.gd.ep ) then
   cd ~/gps
   gd2ren-0mp $site
endif
cd ~/tap
urtap-ss $site R E N
cd ~/gps
gdplot-ts $site
if ( ${?showplot} == 1 ) then
   ogv $DDIR/PS/${site}-gd-ts.ps
endif
Antenna reference jump
All SWEPOS sites (not: ONSA, SAAR) had their antenna reference point changed to
the bottom of the preamp, which is 71 mm below the old definition. The file
Upto_01/offsets.dat contains the approriate jump data.

No inter-frame rotations/translations
To reduce velocities only with respect to the itrf2000 (no inter-frame relative rot-trans),
update bin/gd2ren-0mp and set the first frame_switch_date to something early, but later
than the second etc. switch date..

However the "knee" (a V-signature in the time-series) in 1997.5-1998.0 may indicate
a stance for such a correction. It's mostly seen in the vertical; thus it's going to be mostly
a translation.

4. Collecting the rates and adjusting the error bars

cd $TAPDIR
# get a file sasm03.csh, e.g. from /Bifrost/hgs/tap/Upto_00/vfh00_93/
set components = ( ra ea no )
source ~/gps/errsca.env

cd $RDIR
ss_rates_data .ra -v \'HOFN REYK MATE\' > ra_rates.rsl
ss_rates_data .ea -v \'HOFN REYK MATE\' > ea_rates.rsl
ss_rates_data .no -v \'HOFN REYK MATE\' > no_rates.rsl

cat ra_rates.rsl ea_rates.rsl no_rates.rsl >! rates.rsl

rates_unc_sca -H -r ra_rates.rsl >! all_rates.tbl
rates_unc_sca    -e ea_rates.rsl >> all_rates.tbl
rates_unc_sca    -n no_rates.rsl >> all_rates.tbl

cd $RDIR
averotm.out \!averotm.ins
sshrrv.out \!sshrrv.ins

This set of commands is comprised in tcsh-source script ~/gps/collect_results.env

You may need

awk '{printf "%s,", "'"'"'"substr($1,1,4)"'"'"'"}; END{print}' ra_rates.rsl
to get a list of sites for  sshrrv.ins( q_all_sites=.false.,sites='SITA´','SITB', ...)
awk '{printf "%.4s %s\n", $1,$2}' ra_rates.rsl | xargs -l1 lola-of-site > vertical_rates.xyz

cd maps
mindist.out -X0,40,1 -Y50,75,1 -F../vertical_rates.xyz | xyz2grd -R4/36/52/72 -I1/1 -G../distance.grd

setenv CLR_REG -4/36/52/72
setenv CLR_PRJ m1:22000000
~/gps/maps/clr_vrates ../vertical_rates.grd ../distance.grd bifrost

source bstdghes-vels-1.env
 

5. Rates-versus-rates plots

cd $RDIR
setenv GEOIDRATES ~/Maxwell/prof/Bifrost-geoid.xyz
setenv RATESTBL ss_rates_vs_drtgg.dat
setenv TITLE "Std solution, PPP 2001"

awk '{print $1 ".ra:",$4,$5}' tap_rates.dat >! scld_ra_rates.rsl
rates_vs_rates_data -sf scld_ra_rates.rsl
rates_vs_rates_plot -s $RATESTBL

~/gps/bin/gps_vs_model_plot -o gps_vs_model.ps -r ew_adj_glenn.rsl
~/gps/bin/gps_vs_model_plot -o gps_vs_model.ps -e ew_adj_glenn.rsl
~/gps/bin/gps_vs_model_plot -o gps_vs_model.ps -n ew_adj_glenn.rsl

Don't be surprised! The script adds the component to the ps-file name to produce e.g.
gps_vs_model_r.ps
 

6. Prepare for the EOF stage

We process vertical component with air pressure loading
source ~/gps/define-apl.env
setenv TAPDIRR /w
setenv TDIR $TAPDIR/w_apl
setenv PSDIR $DDIR/w_apl/PS
setenv GDPLOT_DO R
foreach site ( `the-sites-of SWEPOS IGSU` )
foreach> urtap-ss $site -poi R
foreach> end
For the Finnish sites we need
setenv TAPNML "idate=1996,8,2,Q_Cut_At_Epoch=.true."
foreach site ( `the-sites-of FINNNET` )
foreach> urtap-ss $site -poi R
foreach> end

cd ~/gps
foreach site ( `the-sites-of SWEPOS FINNNET IGSU` )
foreach> gdplot-ts $site
foreach> end

7. Do EOF analysis for vertical component

set components = ( ra )
setenv TADD .apl
unseat TAPNML
cd $RDIR/../EOF # cd /home/hgs/gps/Upto_01/EOF
source setup.env
Adjust imported residuals and number of eigenvalues to delete. Experiment!
cd ~/tap
setenv MARGIN 0.4
foreach site ( `the-sites-of SWEPOS-N` )
foreach> urtap-eof-north $site -pu
foreach> end

foreach site ( `the-sites-of SWEPOS-S` )
foreach> urtap-eof-south $site -pu
foreach> end

foreach site ( `the-sites-of FINNNET` )
foreach> urtap-eof-fin $site -pu
foreach> end

cd ~/gps
foreach site ( `the-sites-in $TDIR .apl.ra.prl` )
foreach> gdplot-ts $site
foreach> end

Gather results and plot

     cd $TDIR
     # get a file sasm03.csh, e.g. from /Bifrost/hgs/tap/Upto_00/vfh00_93/
     set components = ( ra )
     source ./errsca.env

     cd $RDIR
     ss_rates_data -d $TDIR .ra >! ra_rates.rsl

     cat ra_rates.rsl ../std/ea_rates.rsl ../std/no_rates.rsl >! rates.rsl

     rates_unc_sca -H -r ra_rates.rsl >! ra_rates_unc_sca.tbl
 

     cd $RDIR
     sshrrv.out \!sshrrv.ins

     awk '{printf "%.4s %s\n", $1,$2}' ra_rates.rsl |\
          xargs -l1 lola-of-site >! vertical_rates.xyz
 
 

     cd maps
     rm -f ../vertical_rates.grd ../distance.grd
     mindist.out -X0,40,1 -Y50,75,1 -F../vertical_rates.xyz |\
         xyz2grd -R4/36/52/72 -I1/1 -G../distance.grd

     setenv CLR_REG -4/36/52/72
     setenv CLR_PRJ m1:22000000
     ~/gps/maps/clr_vrates ../vertical_rates.grd ../distance.grd bifrost
 

     cd $RDIR
     setenv GEOIDRATES ~/Maxwell/prof/Bifrost-geoid.xyz
     setenv RATESTBL ss_rates_vs_drtgg.dat
     setenv TITLE "EOF solution, PPP 2001"

     awk '{print $1 ".ra:",$4,$5}' tap_rates.dat >! scld_ra_rates.rsl
     rates_vs_rates_data -sf scld_ra_rates.rsl
     rates_vs_rates_plot -s $RATESTBL

     ~/gps/bin/gps_vs_model_plot -o gps_vs_model.ps -r ew_adj_glenn.rsl
 


(1) I made an ITRF-style file out of Heflin's all.txt with
cd ~/IGS
posvel2ssc.pl heflin_00_00.posvel > heflin_00_00.ssc
where heflin_00_00.posvel is the local copy of table.txt

     http://sideshow.jpl.nasa.gov/mbh/all/table.txt
     ln -s table.txt heflin_00_00.posvel
     http://sideshow.jpl.nasa.gov/mbh/all/table2.txt # gd-type

.bye



Beyond is the old advice. Stop reading here!
cd ~/gps
source gdh2000.env
Jan's GPS data was on asmund:/gps0/gipsy/BIFROST/RESULTS/HEFL97_yyyy

For yy = 93, 94, ..., 00
copy  SITE.rad SITE.lon SITE.lat to `SD yyby ftp

cd `SD yy`/..
collect_many_NEV `ls -d HEFLIN_9?` HEFLIN_00
Some fixes that were necessary:
(1) I made an ITRF-style file out of Heflin's all.txt with
cd ~/IGS
posvel2ssc.pl heflin_00_00.posvel > heflin_00_00.ssc
where heflin_00_00.posvel is the local copy of all.txt

(2) Some gipsy nev files contained overrange values (***)

(3) New procedure ~/gps/bin/gd2ren-0mh

(4)   cat $SDIR/WETB.nev $SDIR/WTZR.nev > $SDIR/WETT.nev

      Some more stations that can be concatenated:

cd $DDIR
mv TROM.gd.ep TROO.gd.ep
cat TROO.gd.ep TRO1.gd.ep > TROM.gd.ep
      and the same for NYAL NYA1
 
cd ~/gps
many-gd2ren -0mh `the-sites-of SWEPOS FINNNET IGS` WETT

cd ~/tap
many-urtap-ss `the-sites-of SWEPOS FINNNET IGS` WETT
 

In order to create tap variants there are the following init scripts:
~/gps/define-apl.env
~/gps/define-tgg.env


Model versus Bifrost plots for the three components:

~/gps/bin/gps_vs_model_plot -o gps_vs_model.ps -r bstd_adj_glenn.rsl
~/gps/bin/gps_vs_model_plot -o gps_vs_model.ps -e bstd_adj_glenn.rsl
~/gps/bin/gps_vs_model_plot -o gps_vs_model.ps -n bstd_adj_glenn.rsl
(note: output ps-file name will be adjusted to contain _${comp})

EOF
  prepare (jobs without clim, but with air press load)
      source ~/gps/define-apl.env
      setenv TAPVARIANT /NoClim
      setenv KINDEVENTS all
      urtap-ss LEKS -poi R
      setenv BEGIN_DATE 1993,10,10
      collect-resid `cat the_EOF_sites_north `
      unseat BEGIN_DATE
      collect-resid `cat the_EOF_sites_south `
      cd $TAPDIR$TAPVARIANT
      source errsca.env
      setenv RDIR ~/gps/Upto_00/NoClim/with_apl
      cd $RDIR
      ss_rates_data -d $TAPDIR$TAPVARIANT .ra > ! rates.rsl
      rates_unc_sca -H -r rates.rsl > ! ra.rates_unc_sca.tbl
      setenv TDIR $TAPDIR/NCA
      setenv PSDIR /Bifrost/hgs/gps/Upto_00/vfh00-93/NoClim/with_apl
      setenv GDPLOT_DO R
      cd ~/gps
      gdplot-ts LEKS

 EOF proper
      setenv TAPVARIANT /NCA
      setenv TAPPPDIR /EOF
      setenv RDIR ~/gps/Upto_00/EOF
      setenv PSDIR $RDIR/PS
      setenv MARGIN 0.4
      setenv APLDIR /home/hgs/Oload/smhi/aplj
      setenv TAPAPL
      urtap_eof_north LEKS -pu
      cd $TAPDIR$TAPPPDIR
      rm -f acv.*.dat sca.*.dat chi.*.dat
      source errsca.env
      cd $RDIR
      setenv TDIR $TAPDIR$TAPPPDIR
      ss_rates_data -d $TDIR .apl.ra >! ra.rates.dat
      rates_unc_sca -H -r ra.rates.dat > ! ra.rates_unc_sca.tbl
      setenv TADDR .apl
      gdplot-ts LEKS
 

 prep horizontal (jobs without clim, no air press load)
      unseat TAPAPL APLDIR
      setenv TAPVARIANT /NoClim
      urtap_ss LEKS -pu E N
 

      setenv TAPPPJUMP
      setenv TAPPPNET N
      urtap-eof-horiz -pu N LEKS
      urtap-eof-horiz -pu N LEKS

      setenv TADD
      setenv TADDR .apl
      setenv TDIR $TAPDIR$TAPPPDIR
      cd gps
      gdplot-ts LEKS
 
 

BOBW (Best of both worlds (Lulu))
      cd /Bifrost/hgs/gps/Upto_00/bobw/
      source HOW.TO
 
 

PLOT RATES vs RATES
      setenv GEOIDRATES ~/Maxwell/prof/Bifrost-geoid.xyz
      setenv RATESTBL ra.rates_vs_drtgg.dat
      rates_unc_sca -r rates.rsl > ra.rates_unc_sca.tbl
      awk -f ~/gps/bin/scarates.awk ra.rates_unc_sca.tbl > sca_ra_rates.dat
      rates_vs_rates_data -sf sca_ra_rates.dat
      rates_vs_rates_plot -s $RATESTBL

      averotm.out
      sshrrv.out
      awk -v l=0.375 -v s=5 -f glennver.awk ~/Maxwell/GAM/rates_120120.dat > maps/glennver.vecs.dat
 

.bye

.bye