* README for the GAMIT/GLOBK standard example 
* Southern California 2000 034-036, 2002 041-042, 2004 -52-052  
*   Last updated by rwk 170308 17:41  UTC
                    
The example is set up to 1) conduct phase processing (sh_gamit) 
for three days in 2000, two days in 2002, and two days in 2004, 
using up to six continuous stations (BLYT, BRAN, CIT1, JPLM, TRAK, 
WLSN) and one survey-mode station (7001); 2) compute and plot daily 
repeatabilities (sh_glred) for 2000; and 3) compute repeatabilities 
and velocities for the three years together (globk/glorg).  Input 
files provided in advance are RINEX, sittbl., sites.defaults, apriori 
coordinates, and the GLOBK command files; all the others are to be 
created by the user as part of the example (provided that you have 
a good ftp connection--see Note 4 below). The structure established 
by the example has three GAMIT processing directories, named by year 
(/2000, /2002, /2004), each of which has below it a /rinex, /tables, 
and /gsoln directory specific to that year.  At the top level there 
is a processing directory for GLOBK (/vsoln) and an additional /tables 
directory used for the multiyear combination.  The steps described
assume that you have downloaded and linked OTL grid and have internet 
access while processing; if you do not have these, see Notes 3 and 4 
below.  In directory /check_files are saved copies of the q-files
and .org files for each day, and the .org files and postscript files
for the multiyear repeatablities and velocities. 

Before you start, make sure that you have constructed the paths and
aliases described in the installation README.  The example may be run 
from any directory on your system, preferably the place you intend to 
process your own data, not under gg.  

STEP 1:  Run GAMIT for the three days from 2000.

In the example/2000 directory type

    sh_setup -yr 2000
                                 
The 2000/tables directory will now contain links to most standard 
files in gg/tables and copies of these files for process.defaults, 
sestbl., station.info (complete SOPAC version), and autcln.cmd.  The 
sites.defaults and sittbl. files were already in directory and therefore 
not overwritten by sh_setup. Examine sites.defaults to note that it has 
been set up to ftp from a remote archive (SOPAC by default) RINEX files 
for BLYT, BRAN, CIT1, JPLM, and WLSN, and 'xstnfo' is set to avoid any 
automatic update of station.info during processsing. Note also that the 
sittbl. is set up to impose moderate constraints on BLYT, BRAN, CIT1, 
JPLM, and WLSN to support ambiguity resolution in GAMIT (a constraint
on just one of these would be sufficient).    

Edit process.defaults to change the 'mailto' to your own email address 
to receive the sh_gamit summary file.  (If left null, it reverts to
'whoami', so this change may not be needed.)  

If you have not downloaded or copied from an earlier distribution the 
(large) grid file for ocean tidal loading and do not wish to use it, 
change 'Tides applied' in the sestb. from '31' to '23'.

Construct a small, experiment-specific station.info file by using the 
following  procedure in the 2000/tables directory:
                                            
    sh_upd_stnfo -l sd 

will create 'station.info.new', using from the MIT station.info only 
the sites listed in sites.defaults. (This step will take a while since
the MIT global station.info file is so long.)  After checking, rename it 
to 'station.info' (overwriting the no-longer-useful MIT station.info).
Next add entries from RINEX headers for sites not in the MIT station.info:   

    sh_upd_stnfo -files ../rinex/*.00o
                                                             
In this case there is only one entry to be added, for site '7001'. 
Note that any RINEX files to be read by sh_upd_stnfo needs to be 
uncompressed first. In general, unless you know that the RINEX headers 
are correct, you need to check station.info after this step and make 
corrections as needed. As it happens, the RINEX files for 7001 have a
ntenna names that are not IGS standard, a common occurrence since the 
receiver cannot detect the antenna type, leaving it up to the person 
creating the RINEX file to get it right.  If you have a current version 
of guess_rcvant.dat in your gg/tables directory, this update will work 
correctly since this file includes the entry  ' ant TYPE^T    TRBROG', 
which will  allow sh_upd_stnfo to recognize 'DORNE-MARGOL. TYPE T' as 
GAMIT code TRBROG and create from it (using rcvant.dat) the IGS-standard 
name 'AOAD/M_T'.  

Type at the /2000 level
                 
 sh_gamit -expt scal -d 2000 034 035 036 -pres ELEV -orbit IGSF -copt x k p -dopts c ao  >&! sh_gamit_2000.log  

(With bash use '> sh_gamit.log &' for the redirect.)
       
A summary file should be emailed to you as each day completes
execution.  Check the summary for number of stations (6), Postfit
RMS (3-6 mm, none 0), Postfit nrms (~0.2), ambiguity resolution
(~90%), and coordinate adjustments < 30 cm (only site 7001).  Look
at the sky plots and phase vs elevation angle plots in the /figs
directory.  If necessary, compare the q-files and sky plots with 
those in the check_files directory (Note that the sky plots in 
check_files are still in postscript, whereas those in /gifs have
been converted to gif images.)  
    
Get template command files into /gsoln by typing at the /2000 level

  sh_glred -cmd 
                 
In /gsoln, edit globk_comb.cmd and glorg_comb.cmd to use translation-
only stabilization, and to use for stablization the apr file and 
stab_site list pre-generated for the example.

In globk_comb.cmd, comment out (add a character to column 1)

 apr_wob  10 10 0 0     
 apr_ut1  10 0   

and uncomment (remove the 'x') 
                     
x apr_wob .25 .25 .1 .1 
x apr ut1 .25 .1                                  
             
In glorg_comb.cmd, comment out 

 pos_org  xtran ytran ztran xrot yrot zrot 
 source ~/gg/tables/igb08_heirarchy_stab_site

and uncomment (remove the 'x')

x pos_org xtran ytran ztran     
x source ../../tables/regional_stab_site

                              
Then type at the /2000 level

  sh_glred -s 2000 034 2000 036 -expt scal -opt H G T >&! sh_glred.log
                                        
The script as commanded will translate the GAMIT ascii h-files 
in each day directory to GLOBK binary h-files and put them into 
the /glbf directory ( H ); create a gdl file for each day listing 
the h-file; run GLOBK for each day ( G ) using globk_comb.cmd and 
glorg_comb.cmd ( G ); and generate time series plots ( T, from 
program tssum, invoked by sh_plotpos).  The plots will be Postscript
files in the gsoln/plots_2000-034_2000-036 directory, viewable with 
Ghostscript ('gs'), e.g. gs *.ps.  They should show wrms repeatabilities 
at the should show (for these three days) wrms repeatabilities at the 
level of 1 mm horizontal and 2 mm vertical, and nrms values < 1.0.
If these are good, there is usually no need to inspect any other
files.  However, a useful check on the stabilization is to type 

 grep 'POS STAT' *.org 

in the /gsoln directory to see the number of sites retained in the 
stabilization (4 in this case) and the wrms and nrms adjustments 
relative to the apr_file.  With the itrf08_comb.apr coordinates for 
these southern California sites, the stabilization wrms will be of 
order 2-5 mm horizontal and 5-8 mm vertical. As you have seen, the 
repeatability in the times series is better than that, so if you 
were to repeat the times series using an apr_file from a velocity 
solution using these data (as described below), the wrms would improve 
to the same level as the repeatabilities since the a priori coordinates 
would now be consistent with the data you are using.  Optionally, for 
learning purposes, check the org files (e.g. globk_scal_000034.org) 
to see the stabilization iteration, the EXPERIMENT LIST, and the 
SUMMARY POSITION ESTIMATES.  
                                              
Optionally, remove additional files from the day directories to 
save space:  sh_cleanup -d 2000 034 035 036 -dopts p x k  

Notes: 
                                           
1. For large or complex data sets, the utility sh_get_times can be
helpful in determining the days and session spans to be processed.

2. In creating station.info for your own experiments, it is important 
to check it after updating from the RINEX headers unless you are sure 
these headers are correct. In processing, the station.info entries 
always override whatever is in the RINEX header or the x-files.  An 
alternative way of creating entries for survey-mode sites is to use 
interactive program 'make_stnfo', then merge this file with the one 
created from the MIT station.info file for continuous sites.  The 
survey-mode file will have a shorter form of the station.info format, 
but this will be converted when it is merged with the continuous file, 
which should be listed as the reference (-ref) in the call to 
sh_upd_stnfo. 

3. The example is set up to use ocean tidal loading ('Use otl.grid = Y' 
in the sestbl.), which requires you to have previously downloaded into 
gg/tables an OTL file from the anonymous ftp directory on everest.mit.edu 
and to have linked this file to otl.grid also within gg/tables.  The 
IERS/IGS standard model is otl_FES2004.grid (730 Mb).  You may, however, 
substitute the smaller (45 Mb) otl_CSR4.grid, or you may turn off ocean 
tidal loading by setting 'Tides applied = 23' and 'Use otl.grid = N' in 
the sestbl.  (Note that the links to the other grid and list files 
(met.grid, met.list, map.grid, etc.) can remain empty for running the 
example and for most processing.
          
4. If you want or need to run the example without having internet access
while running, you can pre-load the RINEX, navigation, and orbit files.
Untar the file example_ftpfiles.tar.gz and then copy the files in the
example_ftp directory into the expected target directories:  The *.00o,
*.02.o, and *04.o RINEX files goes into 2000/rinex, 2002/rinex, and
2004/rinex, respectively; the *.00n, *.02n, *.04n navigation files into
2000/brdc, 2002/brdc, and 2004/brdc, respectively; the igs1047?.sp3, 
igs1153?.sp3, igs1258?.sp3 into 2000/igs, 2002/igs, and 2004/igs,  Then
two steps in the executions will need to be performed a little differently.
Since the YYYY/rinex directories will now have the continuous sites' 
data available when you create station.info, you should tell sh_upd_stnfo
not to use the RINEX header information to overwrite the entries from
the SOPAC station.info file; i.e., for the second sh_upd_stnfo execution
add the command '-replace_option none' before '-files'.  Finally, when
running sh_gamit, add the option '-noftp' to the command line.  

STEP 2: Repeat Step 1 for 2002 and 2004:

  At /2002: sh_setup -yr 2002
  At /2002/tables, edit process.defaults for mailto 
  At /2002/tables:  sh_upd_stnfo -l sd  ; mv station.info.new station.info
     (no need for adding the 7001 entries from RINEX since it's not available on this day)
  At /2002: sh_gamit -expt scal -d 2002 041 042 -pres ELEV -orbit IGSF -copt x k p -dopts c ao  >&! sh_gamit_2002.log   
  At /2002:  sh_glred -cmd 
  At /2002/gsoln, edit globk_comb.cmd and glorg_comb.cmd
  At /2002:  sh_glred -s 2002 041 2002 042 -expt scal -opt H G T >&! sh_glred_2002.log 
  
  At /2004: sh_setup -yr 2004
  Edit process.defaults for mailto 
  At /2004/tables:  sh_upd_stnfo -l sd  ; mv station.info.new station.info
  At /2004  sh_gamit -expt scal -d 2004 051 052 -orbit IGSF -pres ELEV -copt x k p -dopts c ao  >&! sh_gamit_2004.log   
  At /2004:  sh_glred -cmd 
  At /2004/gsoln, edit globk_comb.cmd and glorg_comb.cmd 
  At /2004:  sh_glred -s 2004 051 2004 052 -expt scal -opt H G T >&! sh_glred_2004.log
                              
Note that site 7001 is not available in 2002 or 2004. Since there are
no station.info entries needed for 2002 and 2004 other than those from 
the SOPAC file, you can skip the second sh_upd_stnfo step.  Don't forget 
to edit 'mailto', if needed, in process.defaults after running sh_setup.


STEP 3: Run GLOBK to get 3-epoch (4-yr) repeatabilities and velocities
        
The key user-specific controls for this step (also incorporated in
the sh_glred runs within each year) are the list of sites to be used
in defining the reference frame, and the a priori coordinates for
these sites,  Here we use the same sites and coordinate file 
(itrf08_comb.apr) as in the single-year solutions, but this may not 
always be the case.
  
Create a list of h-files to be input to GLOBK for repeatabilies
and velocities. In /vsoln, type 

 ls ../????/glbf/h*glx >! scal.gdl

For large or complex data sets, it's helpful at this point to
run glist, which will check for blunders and give you a list of
all the sites used and their spans.  Program glist2cmd can then
be helpful in establishing a use_site list.  It may also be
desirable to aggregate the data within each year, both to save
time in the multi-year combination and to provide more representative
long-term statistics.  The procedure for doing this is given in
the file sGPS_recipe.txt in the documentation directory in the
ftp area or web site.  
                              
There is no shell-script for multi-year solutions, so we execute 
glred or globk from within the solution directory. To get 
repeatabilities for the 7 binary h-files in the [year]/glbf 
directorie, type in /vsoln
                            
 \rm globk_rep.log globk_rep.org
 glred 6 globk_reo.prt globk_rep.log scal.gdl globk_long.cmd 
              
the \rm command is a precaution in case you have run this step
earlier and need to remove the old files to avoid concatenation.
This run will produce in a single file (globk_rep.org) solutions
for each h-file in the list (each day over the three years).  As
with the short-term repeatabilities, check the the stabilization 
for all h-files using 

 grep 'POS STAT' globk_rep.org
                 
All should again be be at the 2-5 mm level in horizonal and 3-9 mm 
level in vertical (you're using the same apr file and stablization
that you used in the daily runs).  Plot the results using 
 
 sh_plot_pos -f globk_rep.org -r -t RATE -t1 2000-001 -t2 2005-001 -u

or 

 sh_plotcrd -f globk_rep.org -s long -res -o 1 -vert -col 1 -x 2000.0 2005.0
   
and inspect the plots with 'gs psbase*' (for sh_plotcrd) or 'gs *ps'
(for sh_plot_pos), comparing them with the plots in /check_files.

Finally, perform a velocity solution
      
 \rm globk_vel.log globk_vel.org 
 globk 6 globk_vel.prt globk_vel.log scal.gdl globk_long.cmd VEL 
                               
where the 'VEL' token at the end tells globk to uncomment the
lines in globk_long.cmd that begin with 'VEL'.

Check the globk_vel.org file under EXPERIMENT LIST for the chi2 increments 
in stacking the 7 h-files.  

Check the  adjustments and uncertainties in the SUMMARY VELOCITY.  The 
adustment for site 7001 will be large since we had no accurate a prior
velocity for this site.  

Check the stabilization ('POS STAT'). It should be < 1 mm/yr horizontal 
and < 2 mm/yr vertical for the velocities, and 2-5 mm for the positions.

Plot the velocities using

 sh_plotvel -ps scal -f globk_vel.org -R240/246/32/35 -factor 0.5 -arrow_value 10  -page L                                                         

The scal.ps plot should look like the one in check_files.

------------

To start over from scratch, run sh_clean_example, once for each year 
and once for the velocity solution. (Type the name of the script without 
arguments to see the documentation.)






