All examples for RSGLI
#	Refraction statics analysis

#	This example includes:
#
#	1) Checking for geometry pattern errors (coming soon);
#	2) Checking for travel-time reciprocity;
#	3) Correction for shot uphole time misties;
#	4) Extraction of vertical tau-p travel times;
#	5) Inversion for starting model using the Herglotz-Wiechert transform.
#	6) Generation of files for Hampson-Russell GLI3D program;
#	7) Generation of files for viewing in plotmtv program.
#
#	The data are derived from sequencies of traces. Only trace headers are used,
#	unless autopicking is requested.
#	The headers should contain source and receiver coordinates and
#	first-arrival travel times.
#	The easiest way of producing such trace sequencies from, for example, Promax,
#	is to save the travel time picks in remapped SEGY headers, as shown in 
#	list "theader" in "*call load" below
###################################################################################


*call	rsgli	loadinv	teapot

src	ffid	espnum	sou_x	sou_y	selev	0	suphole	6500	20
rec	chan	line	recsloc	rec_x	rec_y	relev	60	# take 60-m average receiver spacing

ttime	fbpick1	20.0		# use Kamal's new picks from GeoTomo

### Model:
###==================================================================================

## constant datum and replacement velocities for statics:

datum	3.0	3.0	

## layer grids

fsurf	fsurf		100	100	1.0	# set near-surface velocity = 1 m/ms
layer	layer1		dxdy	dxdy		
layer	layer2			
layer	layer3		

	# control points and layer velocities:

control	0.8	0.2	cpsize	2.	200	3.05	2000	3.45	2591	3.67

control	0.6	0.4	cpsize	2.	200	3.05	2000	3.45	2800	3.67
control	0.85	0.4	cpsize	2.	488	3.05	1432	3.45	2591	3.67

control	0.45	0.6	cpsize	2.	200	2.95	1500	3.45	2600	3.67
control	0.7	0.6	cpsize	2.	220	3.05	2000	3.45	2788	3.67

control	0.2	0.8	cpsize	2.	300	3.05	1600	3.45	2788	3.67
control	0.5	0.8	cpsize	2.	250	2.9	1600	3.45	2800	3.67

### Travel-time adjustments:
###===================================================================================

rtimes	noinc	corr		# pick reversed times in shots, do not include them in tt surfaces
				# but use to correct the uphole times

#reloc	apply	src	500	10	0.1		# relocate shots
reloc	apply	rec	500	10	0.1		# relocate receivers

delays	10		# adjust the residual receiver delays so that the median error
			# at each receiver becomes zero

fitcp	5	novel	top		# adjust control-point velocities and intercepts 
					# by using common-midpoint travel times

#pick				# auto-pick unpicked shots and traces

### Inversion:
###===================================================================================

stmodel	hwt	10	1	# make starting model using the Helglotz-Wiechert transform

#tomo2d		# invert by 2-D tomography (not implemented)

### Plots: 
###=====================================================================================

#plt-tt	shot	0	plotmtv	raw	abs	MTV/%s.mtv	# raw picks for viewing using 'plotmtv' 

plt-map	area		DAT/area.dat		# contour of survey area for psxy
plt-map	receiv		DAT/receivers.dat	# receiver layout for psxy
plt-map	shots		DAT/shots.dat		# source point layout for psxy
plt-map	control		DAT/control.dat		# control points
plt-map	invgrid		DAT/grid.dat		# inversion grid box
GMT/plot_layout.sh  				# makes source and receiver layout map in PostScript

plt-off

plt-map	surface		DAT/$version/inversion/surface.dat		# maps of surface attributes
GMT/plot_surface.sh elevation
GMT/plot_surface.sh velocity
GMT/plot_surface.sh fold
GMT/plot_surface.sh static
GMT/plot_surface.sh resstatic
GMT/plot_surface.sh totstatic
GMT/plot_surface.sh error
GMT/plot_surface.sh delays

#plt-on

plt-map	layer	1	DAT/$version/inversion/layer1.dat		# maps of parameters of layer 1
GMT/plot_layer.sh delay
GMT/plot_layer.sh velocity
GMT/plot_layer.sh thickness
GMT/plot_layer.sh elevation
GMT/plot_layer.sh depth		

plt-map	layer	2	DAT/$version/inversion/layer2.dat		# maps of parameters of layer 2
GMT/plot_layer.sh delay
GMT/plot_layer.sh velocity
GMT/plot_layer.sh thickness
GMT/plot_layer.sh elevation
GMT/plot_layer.sh depth

plt-map	layer	3	DAT/$version/inversion/layer3.dat		# maps of parameters of layer 3
GMT/plot_layer.sh delay
GMT/plot_layer.sh velocity
GMT/plot_layer.sh thickness
GMT/plot_layer.sh elevation
GMT/plot_layer.sh depth

plt-off				# disable the following plt- lists

plt-tt	shot	0	points	raw	DAT/shots/%s.tt.dat	# receiver stations and travel times 
GMT/plot_shot_tt.sh 						# travel-time picks, with reduction 
								# using layer velocities V2, V3, and V4

plt-tt	shot	0	grid	raw	DAT/shots/%s.ttsurf.dat	# shot tt surfaces for GMT plotting
GMT/plot_shot_surf.sh time					# total interpolated times
GMT/plot_shot_surf.sh ttc					# total travel-time "curves" (cones)
GMT/plot_shot_surf.sh rectime					# receiver-only terms in times

#plt-on				# enable plt- lists

plt-ttc	control				DAT/$version/control/%s.ttc.dat		# travel-time curves at control points
plt-tt	control	0	points	raw	DAT/$version/control/%s.tt.dat		# travel times at control points 
GMT/plot_control_tt.sh  							# travel-time picks

#plt-off

plt-tt	control	0	grid	raw	DAT/$version/control/%s.ttsurf.dat	# travel-time surfaces at control points 
GMT/plot_control_surf.sh  time							# travel-time picks

#plt-on

plt-ttc	cmp				DAT/$version/cmp/%s.ttc.dat		# travel-time curves at grid CMPs 
plt-tt	cmp	0	points	raw	DAT/$version/cmp/%s.tt.dat		# travel times at at grid CMPs
GMT/plot_cmp_tt.sh  						# midpoint travel-time picks with ttc curves

## plotting options:

plt-opt	coords	abs		# plot coordinates are as given in trace headers

### Quality control
###==========================================================================================
#qcsrc	promax	{dset}.srctab	# Promax source table to verify that the source numbers belong
				# to it and to identify patterns

#qcpatt	promax	{dset}.pattab	# Promax pattern table to verify that the FFID numbers belong
				# to it and to identify patterns

## send selected error logs into separate files

log	pattern	{dset}.pattern.log

### Print summaries of the model and data
###==========================================================================================

summary	model		full	DB/$version/{dset}.model.txt
summary	shots		detail	DB/$version/{dset}.shots.txt
summary	receiv		detail	DB/$version/{dset}.receivers.txt
summary	control		detail	DB/$version/{dset}.control.txt
summary	pattern		full	DB/$version/{dset}.pattern.txt
summary	shtpatt		full	DB/$version/{dset}.pattern-sht.txt
summary	traces		detail	DB/$version/{dset}.traces.txt
summary	rtimes		short	DB/$version/{dset}.rtt-summary.txt
summary	rtimes		full	DB/$version/{dset}.rtt.txt
summary	taup		full	DB/$version/{dset}.taup.txt
summary	hwt		full	DB/$version/{dset}.hwt.txt
summary	reloc-src	full	DB/$version/{dset}.reloc-src.txt
summary	reloc-rec	full	DB/$version/{dset}.reloc-rec.txt
summary	recstat		full	DB/$version/{dset}.statics-rec.txt
summary	shtstat		full	DB/$version/{dset}.statics-sht.txt
summary	static		full	DB/$version/{dset}.statics.txt

*nocall	pritab	*
teapot_*

### more GMT plots of the results

*call	unix	eof
cd GMT
source fold.gmt {dset}
source psurf.gmt {dset}
source tau1.gmt {dset}
source tau2.gmt {dset}
source tau3.gmt {dset}
source tterror.gmt {dset}
source dt-rec.gmt {dset}
source z1.gmt {dset}
source z2.gmt {dset}
source z3.gmt {dset}
	
#### print processing time

*call	info	eof	time