# Directories
# -----------
$GMT_bin = "/home/GMT4/bin/";
$GMT_working_dir = "/home/GPSDATA/REUN/STA/";

# GMT programs
# ------------
$gmtset = $GMT_bin."gmtset";
$pscoast = $GMT_bin."pscoast";
$psxy = $GMT_bin."psxy";
$pstext = $GMT_bin."pstext";
$psscale    = $GMT_bin."psscale";

# Input and output files
# ----------------------
$ps = $GMT_working_dir."REU_QIF_20080860.ps";
$qif = $GMT_working_dir."REU_QIF_20080860.gmt";
$ok_stations = $GMT_working_dir."REU_QIF_20080860.st1";
$stations_labels = $GMT_working_dir."REU_QIF_20080860.lab";
$cpt = $GMT_working_dir."GMT_red2green2.cpt";

# Map size
# ----------------------
$region = "-R5/110/-55/25";
$map_proj = "-JM16";

# Plot parameters
# ---------------
$symbol_size = "-SC0.06c";
$symbol_color_all = "-G0/0/0";
$symbol_color_ok = "-G0/0/0";
$symbol_outline = "";
$bsl_width = "-W0.06c";

# Setting .gmtdefaults parameters
# -------------------------------
`$gmtset PLOT_DEGREE_FORMAT ddd:mm`;
`$gmtset PAGE_ORIENTATION  portrait`;
`$gmtset PAPER_MEDIA a4+`;
`$gmtset HEADER_FONT_SIZE    = 18p`;
`$gmtset HEADER_FONT = 0`;
`$gmtset ANNOT_FONT_SIZE_PRIMARY 10`;
`$gmtset ANNOT_OFFSET_PRIMARY 0.05c`;
`$gmtset ANNOT_OFFSET_SECONDARY 0.05c`;
`$gmtset LABEL_FONT_SIZE 8`;
`$gmtset CHAR_ENCODING  Standard+`;
`$gmtset FRAME_WIDTH 0.1c`;

# Creating base map
# -----------------
$title = 'QIF ratio 2008-086-0';
`$pscoast $region $map_proj -B5.0g5.0f5.0:.\"${title}\": -Dh -K -A50/1 -S210 -G255/255/255 -W2/0/0/120 -N1/1/255/0/255 -S220/250/255 > $ps`;

# Plotting baselines
# ------------------
`$psxy $qif $region $map_proj -M $bsl_width -C$cpt -O -K  >> $ps`;

# Plotting calculated stations
# ----------------------------
`$psxy $ok_stations $region $map_proj $symbol_size $symbol_color_ok $symbol_outline -O -K   >> $ps`;

# Plotting station names
# ----------------------
`$pstext $stations_labels $region $map_proj -Dj0.12 -G0/0/0 -W255/255/255,o0/0/0 -C50% -O -K >> $ps`;

# Plotting color scale
# --------------------
`$psscale -C$cpt -D8c/-1c/16c/0.4ch -Ba10g10f10:"":/:%: -O -K >>  $ps`;

# Plotting Unix time stamp
# ------------------------
$TimeStamp = $GMT_working_dir."qif_map_time_stamp.gmt";
open (F , "> $TimeStamp");
print F "-5.0 40.0 16 0 0 TC . \n";
close(F);
`$pstext $TimeStamp $region $map_proj -U/0/0/ -O >> $ps`;
