# Directories
# -----------
$GMT_bin = "/home/GMT4/bin/";

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

# Input and output files
# ----------------------
$ps = "/home/GPSDATA/DCAL/STA/SGN_IGS05_2008_082_0.ps";

# 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 = '2008-082-0 - r\345sidus du Helmert sur les coordonn\345es IGS05';
`$pscoast -R-16/20/38/59 -JM16c -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
# ------------------
$BSL_file00 = "/home/GPSDATA/DCAL/OUT/ESTCRD_080820_1.BSL";
$BSL_file01 = "/home/GPSDATA/DCAL/OUT/ESTCRD_080820_2.BSL";
$BSL_file02 = "/home/GPSDATA/DCAL/OUT/ESTCRD_080820_3.BSL";
$BSL_file03 = "/home/GPSDATA/DCAL/OUT/ESTCRD_080820_4.BSL";
$BSL_file04 = "/home/GPSDATA/DCAL/OUT/ESTCRD_080820_5.BSL";
$BSL_file05 = "/home/GPSDATA/DCAL/OUT/ESTCRD_080820_6.BSL";
`$psxy -R -JM -M -W1.5/255/0/0 -K -O $BSL_file00 >> $ps`;
`$psxy -R -JM -M -W1.5/210/70/210 -K -O $BSL_file01 >> $ps`;
`$psxy -R -JM -M -W1.5/50/20/180 -K -O $BSL_file02 >> $ps`;
`$psxy -R -JM -M -W1.5/150/70/20 -K -O $BSL_file03 >> $ps`;
`$psxy -R -JM -M -W1.5/23/100/40 -K -O $BSL_file04 >> $ps`;
`$psxy -R -JM -M -W1.5/130/20/80 -K -O $BSL_file05 >> $ps`;

# Plotting residuals
# ------------------
$HOR_file = "/home/GPSDATA/DCAL/OUT/IG05_.HOR";
$ALT_file = "/home/GPSDATA/DCAL/OUT/IG05_.ALT";
$LEG_file = "/home/GPSDATA/DCAL/OUT/IG05_.LEG";
$sta_file = "/home/GPSDATA/DCAL/STA/stations_all.lis";
$sta_file_ok = "/home/GPSDATA/DCAL/STA/stations_ok.lis";
`$psvelo -R  -Se0.1c/0/0 -G0/0/200 -K -O -JM $HOR_file >> $ps`;
`$psvelo -R -Se0.1c/0/0 -G0/150/0 -K -O -JM $ALT_file >> $ps`;

# Plotting all stations
# ---------------------
`$psxy $sta_file -R -JM -SC0.12 -G250/0/0  -W1.5 -O -K   >> $ps`;

# Plotting calculated stations
# ----------------------------
`$psxy $sta_file_ok -R -JM -SC0.12 -G0/250/0 -W1.5 -O -K   >> $ps`;

# Plotting station names
# ----------------------
`$pstext $sta_file -R -JM -Y0 -Dj0.12 -G0/0/0 -O -K  >> $ps`;

# Plotting legend
# ---------------
`$pstext -R -J -K -O  -Gblack $LEG_file >> $ps`;

# Plotting Unix time stamp
# ------------------------
$tmp3 = "/home/GPSDATA/DCAL/STA/tmp_res3";
`$pstext $tmp3 -R -JM -U/0/0/ -O >> $ps`;
