#!/bin/tcsh
#
# Prepared by Ronni Grapenthin for Beyond the Mouse, 2011

rm .gmtdefaults4 .gmt_bb_info .gmtcommands4

set scale = 1

#Bounding box
set w_lon = 180
set e_lon = 225
set s_lat = 50
set n_lat = 72

#map region box
set map_box = -R$w_lon/$e_lon/$s_lat/$n_lat

#center of projection
set pro_lon = `echo $w_lon $e_lon | awk '{printf"%.2f",($1+$2)/2.0}'`
set pro_lat = `echo $n_lat $s_lat | awk '{printf"%.2f",($1+$2)/2.0}'`

#output file
set filename = alaska.ps

##PROJECTIONS (USE ONE COMMENT OUT REST)
########################################

#Cassini
set map_pro = -Jc$pro_lon/$pro_lat/$scale

#Mercator Projection
#set map_pro = -JM7i

#Lambert Projection
#set map_pro = -Ja$pro_lon/$pro_lat/1:50000000

##SETUP 
########################################

#create colormap for grid
makecpt -Cglobe -T-10000/10000/100 -Z > etopo5_topo.cpt

#simply creates a frame and starts the file
psbasemap  $map_pro $map_box -B0 -P -K  > $filename

##MAP MAKING -- PLAY AWAY!
########################################

##start with topography
#grdimage etopo5.grd -Cetopo5_topo.cpt $map_pro $map_box -P -O -K >> $filename

##add lakes, rivers etc ... (use one of them)
#pscoast $map_pro $map_box -Df -Ia -N1 -C0/0/255 -O -K >> $filename
#pscoast $map_pro $map_box -Df -Ia -N1 -C0/0/255 -S0/0/225 -O -K >> $filename

##add a basegrid - keep this uncommented at the end, to make sure PS-trailer is added.
#psbasemap  $map_pro $map_box -Bg5a10 -P -O -K >> $filename

##add earthquakes for 2011
#awk '{print $7,$6}' neic_2011_earthquakes.txt | psxy $map_pro $map_box -Sc0.2c -G0 -O -K >> $filename

##how about faultlines on top of this? The '-M' is important as it then understands the file as 'multi-segment' since it contains many faults
#psxy alaska_faults.gmt $map_pro $map_box -M -W10/255/0/0 -O -K >> $filename

##or some velocities
#awk '{print $3,$4,$5,$6,$7,$8,$9,$10,$1}' freymueller_velo.txt  | psvelo $map_pro $map_box -N -W1/0/0/0 -L -G0/255/255 -A0.1/0.18/0.18 -Se0.1/0.95/0 -O -K >> $filename


## PS TRAILER DO NOT COMMENT OUT!
########################################

#simply adds a frame around the map and finishes the file
psbasemap  $map_pro $map_box -B0 -P -O  >> $filename

#convert to pdf
ps2pdf $filename
