How to...    post-process gipsy results:

look here for gdh2000.html

look here for gdp2001.html

Sten's programs and data sets are described here:

file:///home/sten/Bi4asm/algorithm2.txt
 

How to ...
   create/append gd (geodetic datum) and derive rates in a regional frame:

The basic workhorses are ~/gps/mstcs and ~/gps/moregd
 

cd ~/gps
gpsenv
setenv SD /gps2/SWEPOS_RESULTS/ITRF94_VEL_FIELD_yy
setenv SDIR /gps2/hgs/ts_itrf94_vf
setenv SDIR_T ashtemp
setenv DDIR /users/hgs/gps/Upto_95/vf_94
setenv TAPDIR /users/hgs/tap/Upto_95/vf_94
setenv REFF comb/all_93_94_95_itrf93
setenv ITRF yes
setenv SWAP_ITRF yes
setenv VF _vf
setenv STATISTICS_TYPE gd
( setenv TAPVARIANT .NoClim ) gpsenv > temp; source temp setenv SDIR_T tempyy
cd $SDIR
      if necessary: mkdir $SDIR_T
cd $SDIR_T uncompressdir `SD $SD 95`
uncompressdir `SD $SD 96`
setenv SDIR_T temp95
cd $SDIR/$SDIR_T
mstcs -f 95 nov dec
setenv SDIR_T temp95
cd $SDIR/$SDIR_T
mstcs -f 96 jan feb mar apr may jun
     etc.
     and don't forget to compress the stacov-files again.
     Also see script ~/gps/many_mstcs

cd ~/gps
emacs many-moregd (to set actual dates)

cd $SDIR ; <-- Really, go there !!!
;
; many-moregd -do [-a] `the-sites-of itrf_95dec01` # ??? -do ???
many-moregd `the-sites-of itrf_95dec01`
many-moregd `the-sites-in $DDIR .gd.ep`
many-moregd ...

     If the year and time span is set inside many-moregd using the environment ( dts=$GD_YEAR )
     then the following tcsh source saves you a lot of time:
source ~/gps/all_gd.env

   eventually misses can be added by e.g.
setenv GD_PERIOD "96 oct"
many-moregd.sh -do [-a] `the-sites-of itrf_95dec01`

cd ~/gps
many-gd2ren [-2f] `the-sites-of ...`

many-gd2ren -03f `the-sites-of ...`
 

(a) time series and lin. regression
     edit the file (Upto_95/)offsets.dat

many-gd2ren -2f `the-sites-of itrf_94may10`               \|/
cd ~/tap; many-urtap-ss `the-sites-of itrf_94may10`     -->X<--
cd ~/gps                                                  /|\

           variants:
many-urtap-ss `cat ~/gps/the_clim_sites`
setenv TAPVARIANT .NoClim
many-urtap-ss `cat ~/gps/the_noclim_sites`
 

(aa) (optionally:) sliding straight line sections
 many-slopes -s `the-sites-of ...`

(a) cont'd
nice many-gdplot-ts [`the-sites-of ...`]
nice many-gdplot-ts .NoClim `the-sites-of FINNNET`

(b) GPS rates versus tide gauges and levelling.

For collecting rates information from the *.prl files, use procedure ~/gps/bin/fira -s
It replaces ss_rates_data and it has better formatting. -s option is for short format.
Jim Davis needs a strict format with extensive print, then not with the -s option.

    You need tide gauge results etc. The tide gauge file name is specified
    by means of
setenv TGGRATES filename

    The default /home/hgs/gps/ekman_rates_up is set in script ra4ra
    For GPS data, take
jmj_rates.dat
    (see below how to prepare -> "Instructions to process jmj rates table")
    or
ss_rates_data -1 .ra > ss_rates_2f.dat
    or
ss_rates_data -1 .ra | fgrep -v .NoClim > ss_rates_2f.dat
    and ...
setenv RATESTBL ss_rates_vs_rates.dat
rates_vs_rates_data -sf ss_rates_2f.dat
emacs $RATESTBL
    there'll be bad values + bad label locations
rates_vs_rates_plot -s $RATESTBL
 

(b') HOW.TO collect rates from a number of sources:

setenv TAPDIR First/Choice
ss_rates_data -1 .ra > temp.file
setenv TAPDIR Second/Choice
ss_rates_data -1 .ra >> temp.file
echo SITA SITB SITC > the-sites
echo > ss_rates_2f.dat
foreach site ( `cat the-sites` )
foreach> fgrep $site temp.file | tail -1 >> ss_rates_2f.dat
foreach> end
 

(b'') HOW.TO request geoid-augmented tide-gauge rates:
cd ~/Maxwell
tangvecs prof/ '>GEOID>'
    will create ~/Maxwell/prof/Bifrost-geoid.xyz thru file unit 33.
setenv GEOIDRATES ~/Maxwell/prof/Bifrost-geoid.xyz
    The default is empty, i.e. no geoid rates will be applied. Define a new
    file name to be sure:
setenv RATESTBL ss_rates_vs_drtgg.dat
cd ~/gps
rates_vs_rates_data -sf ss_rates_03f.dat
rates_vs_rates_plot -s $RATESTBL
 

(b''') HOW.TO narrow the search to TAPVARIANTs:

SITA.ra
SITB.ra
SITC.NoClim.ra
SITD.ra
...
     and use it as a filter after reproceesing with rates_vs_rates_data
echo > actual_ratestbl.dat
cat the_sites_4_rates | xargs -i fgrep {} $RATESTBL >> actual_ratestbl.dat
rates_vs_rates_plot -s actual_ratestbl.dat
 

(c) HOW.TO plot vectors on map :
ss_rates_data -2 .ra > ss_rates_2f.hrv
ss_rates_data -2 .ea >> ss_rates_2f.hrv
ss_rates_data -2 .no >> ss_rates_2f.hrv
emacs ss_rates_2f.hrv # because there'll be bad values
sshrrv.out
    or
sshrrv -f ss_rates_2f.hrv stacov=\'$SDIR/comb/\*.stacov\'
cd maps
swemap -s euro -o hrv2f.ps -e igs swe -T taphor tapver
    To get it in Mercator:
setenv REGION -12/35/40/72r
setenv PRJCT m1:35000000
swemap -o hrv2f.ps -e igs swe -T taphor tapver

      HOW TO  scale GPS rate errors after the fact


ARJE 14.47 0.19 1.148 16.20 0.30 0.999 8.92 0.90 1.001
BORA 13.53 0.42 1.060 16.72 0.79 0.806 6.04 3.55 0.676 echo 'FMT (2a4,2(1x,f12.0),f10.0,1x,a4,9f7.0)' > ! jmj-rates-new.gd
cut -c 1-4 jmj-rates.gd | xargs -i site-enh {} |\
paste -d\ - jmj-rates.gd >> jmj-rates-new.gd

How to create Rates table x y z:
awk '{printf "%.4s %s\n", $1,$2}' ss_rates_2f.dat |\
xargs -l1 lola-of-site > vertical_rates.xyz
    or
awk '{printf "%.4s %s\n", $2,$3}' ss_rates_vs_rates.dat |\
xargs -l1 lola-of-site > vertical_rates.xyz
    ... and plot color+isolines
cd maps
clr_vrates ~/gps/vertical_rates.grd
    The grd file does not exist; it will be prepared by clr_vrates.

How to create Haze grid:
/home/hgs/gps/mindist.out -X0,40,1 -Y50,75,1 \
-F/home/hgs/gps/vertical_rates.xyz |\
xyz2grd -R4/36/52/72 -I1/1 -G/home/hgs/gps/distance.grd

     observe that -X -Y do loop increments (1 1 in example) must fit the
     -I increments in xyz2grd;
     and that the -X -Y ranges in mindist must be equal to or larger than
     the -R range in xyz2grd to avoid storage of NaN's.

     ... and plot color+isolines+haze
cd maps
clr_vrates ~/gps/vertical_rates.grd ~/gps/distance.grd

    The files *_rates.dat should look like this

UMEA.ra: 10.45 0.7
----------------------
SITE.co: rate sigma

    You might need awk to create it:
awk '{if (NR>1)printf "%s%s%6.2f %6.2f\n",$1,".ra:",$12,$13}' \
jmj-rates-970828.gd >! jmj_rates.dat

    If you need a new label file (to indicate the locations that went into
    to color contour plot), follow this example:
cd ~/gps
cat jmj_rates.dat | xargs -l1 -i label4site {} 12 0.0 4 1 \
> maps/jmj-labels.dat
    or
awk '{print $2,$3," 12 0.0 4 1 ",$1}' jmj-rates-970828.gd \
>! maps/jmj-labels.dat

cd maps
clr_vrates -o jmj_cvr.ps \
~/gps/jmj_vertical_rates.grd ~/gps/jmj_distance.grd jmj

 _____________________________________
|                                     |
| Environment for mstcs, moregd, etc. |
|_____________________________________|

HOW TO devise the environment.

    The stacov files you want to process are typically named
/gps2/SWEPOS_RESULTS/ITRF_HEFLIN_93/93aug23_itrf_vf.stacov(.Z)
    Then:
setenv SD /gps2/SWEPOS_RESULTS/ITRF_HEFLIN_yy
    File names contain "itrf", therefore
setenv ITRF yes
    The "_itrf" comes late in the file name, therefore
setenv SWAP_ITRF yes
    "_itrf" is suffixed by "_vf", therefore
setenv VF _vf
    ( If ITRF = no the file name would be itrf_vf_93aug23.stacov,
VF = vf_ (!))
    Instead of setting ${ITRF} and ${SWAP_ITRF} you can directly control
    the strings that prepend (${I1}) and append (${I2}${VF}) the date
    part of the file name.
    The temporary directory holding the uncompressed stacov files (or
    the symbolic links) is called ${SDIR}/temp, therefore
setenv SDIR_T temp

    ( ${SDIR_T} is used by ~/gps/moregd (~/gps/moreltu);
    you can collect
moregd data by cycling through stages, e.g.
setenv SDIR_T temp_93
moregd SITE 93 aug sep oct nov dec
setenv SDIR_T temp_94
moregd SITE 94
    etc.)

setenv WTZR_alias WETB
 

 ___________________
|                   |
| badies            |
|___________________|

> all_*.stacov and all_*.gd
comb/all_plus_KUUS.[stacov|gd]:
In the current bad situation the stacov file is a mock-up to include
a couple of stations for which no STA information concurrent with the
majority of sites (i.e. with the sites in all_93_94_95_itrf93.stacov)
is available. As a violation of gipsy rules, no covariance parameters
appear. New sites in comb/all_plus_KUUS.[stacov|gd] are
KUUS POTS BRUS KEVO KIVE ROMU
 

 ___________________
|                   |
| goodies           |
|___________________|

> the-sites-of ...

foreach month ( `all_months` )
the-sites-of-files -q itrf_94$month
end
mv final.collection from.94
nice many-moregd -y 94 `the-sites-of-files -f ~/gps/from.94`

ss_rates_data -2 .ra -v \'RAAH WTZR \' \
.NoClim \'BORA BRUS POTS RIGA `the-sites-of FINNNET` \' >! ss_rates_03f.hrv
 

> make a site coordinate subset file from a stacov file
    (coordinates only, useful for olfg site files etc)
echo " nn PARAMETERS that date" > subset.sta
the-sites-of -l FINNNET |\
xargs -i fgrep {} itrf_97may25.stacov >> subset.sta
 

> days in the solutions:
grep -c '199[3-6].' $DDIR/*.gd.ep

echo " " >! epstats.lst
foreach file $DDIR/*.gd.ep
epstats $file >> epstats.lst
end

> Interpolate GPS-determined rates at PSMSL stations ?
    Use the grd file behind the famous hgs color plot and
    code a temp script called proc:
tail -1 | awk '{print $7,$1,$2}' |\
  xargs -n3 gcdist -i vertical_rates_i.xyz -C | sort -nr | tail -1

foreach site ( `awk '{printf "%s " ,$7}' maps/psmsl_a-labels.dat` )
foreach? fgrep $site maps/psmsl_a-labels.dat | proc >> bifrost_rates_at_psmsl_i.dat
foreach? end

   If alias proc is preferred, the awk script must be placed in a file.

> Nearest GPS-determined rates at PSMSL stations ?
    change the proc script: file name is now vertical_rates.xyz
    i.e. the original Bifrost result.
    Collect in another file: proc >> bifrost_rates_at_psmsl.dat

> Making a new version of Heflin-style ...
     sta_pos file (like ~/IGS/heflin.ssc)
     to stay consistent with Jan's analysis:

cd ~/IGS
sta_pos2ssc > like-jmj.ssc

    (won't have sigmas, however. Until it has, the ssc file can't be used !)
    sta_pos files: look into
       /gps1/gipsy_r2/gipsy-oasis/sta_info
       /gps4/NETWORK/gipsy/gipsy_r5/gipsy-oasis/sta_info

Instructions to process jmj rates table

(a) for color isolies
awk '{if (NR>1)
print $2,$3,$12}' jmj-rates-970828.gd |\
grep -v '^ ' >! jmj_vertical_rates.xyz

(b) gd2ren for arrows
JPL>
21 O jmj-rates-?.gd input
* changed heflin to jpl in the following 5 lines
31 B maps/jplhor-vecs.dat
32 B maps/jplhor-sigs.dat
33 B maps/jplver-vecs.dat
34 B maps/jplver-sigs.dat
35 B maps/jplhor-labels.dat
36 B maps/jplver-labels.dat
41 B jpl-rates.dat output
Q
 &PARAM
 q_rate_results=.true., q_swap_lola=.true.
 q_print=.false.
 q_plate_motion=.true., def_plate='EURA', q_itrf=.false.
 pm_comment=' '
 vel_itrf='jpl',plate='EURA'
 q_all_plates=.false., select_plates='EURA '
 q_all_sites=.false.
 q_all_techniques=.false., select_techniques='GPS'
 iun_plates=70, fn_plates='/home/hgs/IGS/gps_domes_plates.lst '
 iun_itrf=71, fn_itrf='/home/hgs/IGS/heflin.ssc '
 n_select_sites=9, n_rot_trans=3
 select_sites(1)='10402', select_sites(2)='14201'
 select_sites(3)='10302', select_sites(10)='13212'
 select_sites(5)='10403', select_sites(6)='13504'
 select_sites(7)='10317', select_sites(8)='10503'
 select_sites(9)='12734', select_sites(4)='13407'
 xlatl=46.5, xlonl=30., dlatl=.5, dlonl=+.3
 xlatv=48.0, xlonv=30., dlatv=0., dlonv=+.5, verdir=90.
 size=200.,sample=1.d-3
 sizv=75.,samplv=5.d-3
 &END

|----------------------------------|
| gd2ren-03f generated .ins file |
|----------------------------------|
980825>
22 * o /geo/hgs/ts_itrf_heflin/WETB.gd
22 o /geo/hgs/ts_itrf_heflin/WTZR.gd
23 o /geo/hgs/ts_itrf_heflin/comb/all_plus_KUUS_itrf93.gd
24 b /home/hgs/gps/Upto_97/vfh_94_93/WTZR.gd.ep
25 b /home/hgs/gps/Upto_97/vfh_94_93/WTZR.ss.info
26 b /home/hgs/gps/Upto_97/vfh_94_93/../offsets.dat
71 O ~/IGS/itrf94.a.ssc
72 O ~/IGS/itrf94.b.ssc
73 O ~/IGS/itrf94.c.ssc
q
&param
q_time_series=.true., try=-1.d0
site='WTZR', alias='WETB'
scale=1000.
q_print=.false.
q_plate_motion=.true., def_plate='EURA', plate='EURA'
q_itrf=.true.,.true.,true.
pm_comment='Reduced motion = NUVEL1-a'
itrf_comment='Motion w.r.t. JPL-ITRF94-93N/IGS(EURA) '
q_three_frames=.true., q_zero_frame=.true.
frame_switch_date=1996,9,1
frame3_switch_date=1995,6,1
vel_itrf(1)='JPL'
vel_itrf(2)='File : ITRF94.SSC'
vel_itrf(3)='ITRF93N VELOCITY FIELD '
q_all_plates=.false.,.true, select_plates='EURA ',' '
q_all_sites= .false.,.true.
q_all_techniques=.false.,.false.,.false.,.true.
select_techniques='GPS', 'GPS', 'GPS', ' '
iun_plates=60,70,-1
fn_plates(1)='/home/hgs/IGS/gps_domes_plates.lst'
fn_plates(2)='/home/hgs/IGS/iers.site '
fn_plates(3)=' '
iun_itrf=61,71,81
fn_itrf(1)='/home/hgs/IGS/heflin.ssc'
fn_itrf(2)=' '
fn_itrf(3)='/home/hgs/IGS/itrf93.ssc '
n_select_sites=7,0 n_rot_trans=3,6,6,6, q_rot_only=.false.
select_sites(1,0)='10402', select_sites(12,0)='14201'
select_sites(2,0)='10302', select_sites(3,0)='10503'
select_sites(4,0)='13504', select_sites(5,0)='13407'
select_sites(6,0)='10317'
select_sites(7,0)='14001'
select_sites(8,0)='12734'
select_sites(9,0)='10403'
select_sites(10,0)='13101', select_sites(11,0)='13212'
n_delete_sites=1,0
delete_sites(1,0)='10503S999'
&end

***********************
* BASELINE ANALYSIS   *
***********************
HOW TO make the three tables with the baseline data: A stacov reference file is found in every directory with ITRF-projected results that Jan puts up. Example:
/gps1/BIFROST_OFFICIAL/ITRF_HEFLIN_94/all_93_94_95_itrf93.stacov
This file, however might not be complete; some (at the time) unimportant stations might be missing.

Follows a working example
setenv DDIR ~/gps/Upto_97/Bl
setenv TAPDIR ~/tap/Upto_97/Bl
setenv REFF /home/hgs/gps/comb/all_plus_KUUS_itrf93
       or
source latest-bl.env

      It might be necessary to link stacov files:
cd $SDIR
cd temp..
mstcs -i 93 sep oct nov dec
 

cd ~/gps
blanalysis.out      program to compute daily baselines from stacov
                        Time-series are output to the path given in namelist variable
                    TSPATH [$DDIR] in binary mc-form.
blanalysis          shell script
blanalysis.ins
nice many-bll       superscript

/home/hgs/gps/p/ms/blanalysis.f   is a replacement for  /goa/bin/statistics -ltu  computing baseline length.

mblanalysis.out     program Maxwell model
mblanalysis.ins     to prepare ~/Maxwell/all-reb-bl_s18.dat from ~/Maxwell/all-rebound_s18.dat
                    If you need a new set of sites fitting your file catalog, consider

                        ls Upto_97/Bl3/WETB* |\
                           sed 's|.*/....\(....\).*|\1|' |\
                            awk -v q="'" 'BEGIN{printf " sites="};
                                          {printf "%s%s%s,",q,$1,q};
                                          END{printf "\n"}'

blanalysis.out '>BI>'   to prepare bl.info
cp bl.info $DDIR

blanalysis -c 1997,01,01 - temp97 190

cd ~/tap
all-urtap-bl `the-sites-of SWEPOS` SAAR TROM WETB

cd $TAPDIR
fgrep 'Linear 1/[year]' *.prl |\
awk '{print $1,$6,$7,$8}' |\
sed 's/\.le\.prl://' > bl_rates.dat
= ~/tap/collect-bl_rates >! $TAPDIR/bl_rates.dat
 

* Make the big table
cd ~/gps
cut -c 1-8 $DDIR/bl.info |\
fgrep -v '___' | xargs -i ~/gps/collect-bl {} > blanalysis.rsl
    This is compised in the single command
collect-blanalysis >! blanalysis.rsl

* Make summary plot
cd ~/gps
blplot-rsl [#M]
    where #M is a number to allow time-series to have up to #M missing samples
    (default=500)

* Make a plot
cd ~/tap
setenv BLOUTS .false.
urtap-bl SIT1 SIT2
cd ~/gps

* plot time series
blplot-ts SIT1 SIT2

* Make slopes
cd ~/gps
slopes -b mc SIT1 SIT2
blplot-ts SIT1 SIT2 pn

* Plot a lot:
   Example: all baselines to Hassleholm
cd ~/tap
all-urtap-bl +O -s HASS `the-sites-of SWEPOS` SAAR TROM WETB
cd ~/gps
for-all-baselines -c blplot-ts -b -s HASS \
`the-sites-of SWEPOS` SAAR TROM WETB > ! temp.proc
source temp.proc