#!/bin/csh -f

#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# $Id: P1P.gmt,v 1.1 2006/11/03 19:09:01 swift Exp $
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# RCS Log:
#
#
# $Log: P1P.gmt,v $
# Revision 1.1  2006/11/03 19:09:01  swift
# Added user manual to CVS control.
#
  set title   = "*"
  set xlabel  = "*"
  set ylabel  = "*"
#
# initialize GMT plot-tracking parameters
  set comment = "\'$title, $xlabel, $ylabel\'"
  set id      = "6153140"
  set exec    = "$0"
  set psfile  = `echo $0 | perl -ne 's/(.*)\.gmt$/$1/; print;'`.ps
  set rcs     = '$Revision: 1.1 $'
  set x       = "0.4"
  set y       = "0.4"
#
#  initialize gmt parameters
  gmtset HEADER_FONT_SIZE 16 LABEL_FONT_SIZE 14 ANOT_FONT_SIZE 14 \
         PSIMAGE_FORMAT bin BASEMAP_FRAME_RGB 0/0/0 PAPER_MEDIA letter+ \
         PAGE_ORIENTATION portrait PAGE_COLOR 255/255/255 \
         BASEMAP_TYPE plain
#
# exectute GMT plot-tracking software
  gtu -c"$comment" -e"$exec" -i"$id" -p"$psfile" \
      -v"$rcs" -x"$x" -y"$y" > $psfile
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

psbasemap -R0/42.5/0/9 -B50/4nw -JX6/-2.5 -K -X1 -Y1 >> $psfile

psxy -R -B -JX -K -O -W4/50/50/255 <<EOF >> $psfile
  0 0.02
0.5 1.5
  1 0.02
4.5 0.02 
5.5 4
  6 4
  7 8
  9 0.02
 11 0.02
 12 4
 15 4
 16 8
 18 0.02
 20 0.02
 21 4
 24 4
 25 8
 27 0.02
 29 0.02
 30 4
 33 4
 34 8
 36 0.02
 38 0.02
 39 4
 42 4
 43 8
EOF

pstext -N -R -B -JX -K -O <<EOF >> $psfile
 9 1 12 0 4 5 1
18 1 12 0 4 5 2
27 1 12 0 4 5 3
36 1 12 0 4 5 4
EOF

psbasemap -R -B -JX -O >> $psfile

# ferret out the bounding box of the whole plot
bbfig $psfile | gs -q -dNODISPLAY - | tail -1 | \
perl -ne '($doc,$xlo,$ylo,$xhi,$yhi) = split(" "); \
          printf("%%%%BoundingBox: %d %d %d %d\n", \
          $xlo-15,$ylo-15,$xhi+15,$yhi+15)' >> $psfile

gs -q $psfile
