--- a/.hgignore Sun Jul 26 20:04:48 2015 +0000
+++ b/.hgignore Thu Jul 30 09:11:43 2015 +0000
@@ -1,11 +1,12 @@
#======================================================================
# . H G I G N O R E
# doc: Thu Oct 27 10:27:55 2011
-# dlm: Thu Oct 27 10:27:55 2011
+# dlm: Tue Jul 28 19:22:21 2015
# (c) 2011 A.M. Thurnherr
-# uE-Info: 3 5 NIL 0 0 72 0 2 4 NIL ofnI
+# uE-Info: 12 14 NIL 0 0 72 0 2 4 NIL ofnI
#======================================================================
syntax: glob
.gmt*
+LWplot_scripts
--- a/LADCP_VKE Sun Jul 26 20:04:48 2015 +0000
+++ b/LADCP_VKE Thu Jul 30 09:11:43 2015 +0000
@@ -2,9 +2,9 @@
#======================================================================
# L A D C P _ V K E
# doc: Tue Oct 14 11:05:16 2014
-# dlm: Wed Jun 17 11:40:44 2015
+# dlm: Mon Jul 27 18:06:57 2015
# (c) 2012 A.M. Thurnherr
-# uE-Info: 399 18 NIL 0 0 72 2 2 4 NIL ofnI
+# uE-Info: 392 80 NIL 0 0 72 2 2 4 NIL ofnI
#======================================================================
$antsSummary = 'calculate VKE from LADCP-derived vertical-velocity profiles';
@@ -389,7 +389,7 @@
GMT_setR(sprintf('-R%f/%f/%f/%f',2*$PI/$xmax,2*$PI/$xmin,$ymin,$ymax));
GMT_psbasemap('-B3:"Vertical Wavelength [m]:N"');
- GMT_unitcoords(); # print profile number
+ GMT_unitcoords_logscale(); # print profile number
GMT_pstext();
if (defined($outfile)) { printf(GMT "0.98 0.98 14 0 0 TR $outfile %s\n",antsParam('input_data')); }
else { printf(GMT "0.98 0.98 14 0 0 TR %03d %s\n",antsParam('profile_id'),antsParam('input_data')); }
--- a/LADCP_w Sun Jul 26 20:04:48 2015 +0000
+++ b/LADCP_w Thu Jul 30 09:11:43 2015 +0000
@@ -2,9 +2,9 @@
#======================================================================
# L A D C P _ W
# doc: Fri Dec 17 18:11:13 2010
-# dlm: Sun Jul 26 17:11:01 2015
+# dlm: Wed Jul 29 06:58:27 2015
# (c) 2010 A.M. Thurnherr
-# uE-Info: 1465 90 NIL 0 0 72 2 2 4 NIL ofnI
+# uE-Info: 1356 92 NIL 0 0 72 2 2 4 NIL ofnI
#======================================================================
# TODO:
@@ -180,6 +180,10 @@
# Jul 26, 2015: - added %output_grid_dz %output_grid_minsamp for use by [LADCP_w_regrid]
# - began work on support for [libGMT.pl]
# - -v usage message had wrong default
+# - added $outGrid_firstBin & $outGrid_lastBin
+# Jul 28, 2015: - added GMT plot support for all @out_ lists
+# Jul 29, 2015: - continue adaptation of code for new plotting system
+# HISTORY END
# CTD REQUIREMENTS
# - elapsed elapsed seconds; see note below
@@ -622,6 +626,12 @@
foreach my $of (@out_LADCP) {
progress("<$of> ");
+ my($plot,$out) = ($of =~ /^([^\(]+)\(([^\)]+)\)$/); # plot_sub(out_file)
+ if (defined($out)) {
+ require "$WCALC/${plot}.pl";
+ &{$plot}($out);
+ next;
+ }
$of = ">$of" unless ($of =~ /^$|^\s*\|/);
open(STDOUT,$of) || error("$of: $!\n");
undef($antsActiveHeader) unless ($ANTS_TOOLS_AVAILABLE);
@@ -1087,11 +1097,13 @@
#---------------------------------------------------------------------------
progress("Creating binned profiles at ${opt_o}m resolution...\n");
-&antsAddParams('output_grid_dz',$opt_o,'output_grid_minsamp',$opt_k); # will be used by LADCP_w_regrid
+
+&antsAddParams('outgrid_dz',$opt_o,'outgrid_minsamp',$opt_k); # used by LADCP_w_regrid
+&antsAddParams('outgrid_firstbin',$outGrid_firstBin,'outgrid_lastbin',$outGrid_lastBin);
my($min_depth) = 9e99;
my($max_depth) = 0;
-my($realLastGoodEns);
+local($realLastGoodEns);
progress("\tdowncast...\n");
for ($ens=$firstGoodEns; $ens<$LADCP_atbottom; $ens++) { # downcast
@@ -1103,6 +1115,7 @@
my(@bindepth) = calc_binDepths($ens);
for ($bin=$LADCP_firstBin-1; $bin<=$LADCP_lastBin-1; $bin++) {
next unless numberp($LADCP{ENSEMBLE}[$ens]->{W}[$bin]);
+ next if ($bin<$outGrid_firstBin-1 || $bin>$outGrid_lastBin-1);
$min_depth = $bindepth[$bin] if ($bindepth[$bin] < $min_depth);
$max_depth = $bindepth[$bin] if ($bindepth[$bin] > $max_depth);
$LADCP{ENSEMBLE}[$ens]->{SSCORRECTED_OCEAN_W}[$bin] =
@@ -1155,6 +1168,7 @@
my(@bindepth) = calc_binDepths($ens);
for ($bin=$LADCP_firstBin-1; $bin<=$LADCP_lastBin-1; $bin++) {
next unless numberp($LADCP{ENSEMBLE}[$ens]->{W}[$bin]);
+ next if ($bin<$outGrid_firstBin-1 || $bin>$outGrid_lastBin-1);
$min_depth = $bindepth[$bin] if ($bindepth[$bin] < $min_depth);
$max_depth = $bindepth[$bin] if ($bindepth[$bin] > $max_depth);
$LADCP{ENSEMBLE}[$ens]->{SSCORRECTED_OCEAN_W}[$bin] =
@@ -1229,6 +1243,7 @@
my(@bindepth) = calc_binDepths($ens);
for ($bin=$LADCP_firstBin-1; $bin<=$LADCP_lastBin-1; $bin++) {
next unless numberp($LADCP{ENSEMBLE}[$ens]->{W}[$bin]);
+ next if ($bin<$outGrid_firstBin-1 || $bin>$outGrid_lastBin-1);
my($bi) = $bindepth[$bin]/$opt_o;
push(@residuals,
$LADCP{ENSEMBLE}[$ens]->{SSCORRECTED_OCEAN_W}[$bin] -
@@ -1288,10 +1303,9 @@
#-------------------------
if (@out_BR) {
- my(@dc_nres,@uc_nres,@dc_bres,@uc_bres);
+ progress("Binning residuals ");
- progress("Writing per-bin residual data to ");
-
+ local(@dc_bres,@uc_bres);
for ($ens=$firstGoodEns; $ens<$LADCP_atbottom; $ens++) { # downcast
next unless numberp($LADCP{ENSEMBLE}[$ens]->{CTD_DEPTH});
my(@bindepth) = calc_binDepths($ens);
@@ -1312,6 +1326,15 @@
- $UPCAST{MEDIAN_W}[$bindepth[$bin]/$opt_o]);
}
}
+ local(@dc_avg_bres,@uc_avg_bres);
+ for (my($bin)=0; $bin<max(scalar(@dc_bres),scalar(@uc_bres)); $bin++) { # calc means/stddevs
+ $dc_avg_bres[$bin] = avg(@{$dc_bres[$bin]});
+ $uc_avg_bres[$bin] = avg(@{$uc_bres[$bin]});
+ $dc_sig_bres[$bin] = stddev2($dc_avg_bres[$bin],@{$dc_bres[$bin]}),scalar(@{$dc_bres[$bin]});
+ $uc_sig_bres[$bin] = stddev2($uc_avg_bres[$bin],@{$uc_bres[$bin]}),scalar(@{$uc_bres[$bin]});
+ }
+
+ progress("\nWriting binned residuals to ");
my($saveParams) = $antsCurParams;
@antsNewLayout = ('bin','dc_residual','dc_residual.sig','dc_residual.nsamp',
@@ -1320,14 +1343,18 @@
foreach my $of (@out_BR) {
progress("<$of> ");
+ my($plot,$out) = ($of =~ /^([^\(]+)\(([^\)]+)\)$/); # plot_sub(out_file)
+ if (defined($out)) {
+ require "$WCALC/${plot}.pl";
+ &{$plot}($out);
+ next;
+ }
$of = ">$of" unless ($of =~ /^$|^\s*\|/);
open(STDOUT,$of) || error("$of: $!\n");
undef($antsActiveHeader) unless ($ANTS_TOOLS_AVAILABLE);
for (my($bin)=0; $bin<max(scalar(@dc_bres),scalar(@uc_bres)); $bin++) {
- my($dc_avg) = avg(@{$dc_bres[$bin]});
- my($uc_avg) = avg(@{$uc_bres[$bin]});
- &antsOut($bin+1,$dc_avg,stddev2($dc_avg,@{$dc_bres[$bin]}),scalar(@{$dc_bres[$bin]}),
- $uc_avg,stddev2($uc_avg,@{$uc_bres[$bin]}),scalar(@{$uc_bres[$bin]}));
+ &antsOut($bin+1,$dc_avg_bres[$bin],$dc_sig_bres[$bin],scalar(@{$dc_bres[$bin]}),
+ $uc_avg_bres[$bin],$uc_sig_bres[$bin],scalar(@{$uc_bres[$bin]}));
}
&antsOut('EOF'); open(STDOUT,">&2");
}
@@ -1372,6 +1399,14 @@
foreach my $of (@out_w) {
progress("<$of> ");
+
+ my($plot,$out) = ($of =~ /^([^\(]+)\(([^\)]+)\)$/); # plot_sub(out_file)
+ if (defined($out)) {
+ require "$WCALC/${plot}.pl";
+ &{$plot}($out);
+ next;
+ }
+
$of = ">$of" unless ($of =~ /^$|^\s*\|/);
open(STDOUT,$of) || error("$of: $!\n");
undef($antsActiveHeader) unless ($ANTS_TOOLS_AVAILABLE);
@@ -1505,6 +1540,12 @@
foreach my $of (@out_timeseries) {
progress("<$of> ");
+ my($plot,$out) = ($of =~ /^([^\(]+)\(([^\)]+)\)$/); # plot_sub(out_file)
+ if (defined($out)) {
+ require "$WCALC/${plot}.pl";
+ &{$plot}($out);
+ next;
+ }
$of = ">$of" unless ($of =~ /^$|^\s*\|/);
open(STDOUT,$of) || error("$of: $!\n");
undef($antsActiveHeader) unless ($ANTS_TOOLS_AVAILABLE);
--- a/LADCP_w_regrid Sun Jul 26 20:04:48 2015 +0000
+++ b/LADCP_w_regrid Thu Jul 30 09:11:43 2015 +0000
@@ -2,9 +2,9 @@
#======================================================================
# L A D C P _ W _ R E G R I D
# doc: Fri Apr 24 17:15:59 2015
-# dlm: Sun Jul 26 10:26:54 2015
+# dlm: Mon Jul 27 17:20:23 2015
# (c) 2015 A.M. Thurnherr
-# uE-Info: 234 43 NIL 0 0 72 2 2 4 NIL ofnI
+# uE-Info: 182 21 NIL 0 0 72 2 2 4 NIL ofnI
#======================================================================
$antsSummary = 'edit and re-grid LADCP vertical-velocity samples';
@@ -27,7 +27,8 @@
# - implemented default output on -t stdout
# - changed to libGMT.pl
# - removed dead -d option
-# Jul 26, 2015: - adapted for %output_grid_dz
+# Jul 26, 2015: - adapted for %outgrid_*
+# Jul 27, 2015: - B-t)rack <wprof>
($ANTS) = (`which ANTSlib` =~ m{^(.*)/[^/]*$});
@@ -38,16 +39,17 @@
require "$ANTS/libstats.pl";
require "$ANTS/libGMT.pl";
-&antsUsage('i:k:o:p:',1,
+&antsUsage('b:i:k:o:p:t:',1,
'[profile -i)d <id>]',
'[-o)utput bin <resolution[10m]>] [-k) require <min> samples]',
- '[-p)lot <[%03d_wprof.eps]>]',
+# '[valid LADCP -b)ins <bin[2],bin[*][,bin[2],bin[*]]>',
+ '[-p)lot <[%03d_wprof.eps]> [B-t)rack <wprof>]]',
'<.samp file> [.samp file]');
$dual_head = (@ARGV==1);
$opt_o_override = defined($opt_o);
-$opt_o = $P{output_grid_dz};
+$opt_o = $P{outgrid_dz};
&antsCardOpt(\$opt_o,10);
$opt_k_override = defined($opt_k);
@@ -55,6 +57,13 @@
if defined($P{ouput_grid_minsamp});
&antsCardOpt(\$opt_k,$dual_head?40:20);
+if (defined($opt_b)) {
+ croak("$0: -b not implemented yet\n");
+ ($LADCP_firstBin,$LADCP_lastBin) = split(',',$opt_b);
+ croak("$0: cannot decode -b $opt_b\n")
+ unless (numberp($LADCP_firstBin) &&
+ ($LADCP_lastBin eq '*' || numberp($LADCP_lastBin)));
+}
#----------------------------------------------------------------------
# Redirect STDOUT to %.wprof & create %_wprof.ps if STDOUT is a tty
@@ -70,6 +79,9 @@
open(STDOUT,">$outfile") || die("$outfile: $!\n");
}
+croak("$0: -t only makes sense when a plot is produced\n")
+ if $opt_t && !defined($opt_p);
+
#----------------------------------------------------------------------
# Library
#----------------------------------------------------------------------
@@ -121,6 +133,7 @@
$wF = &fnr('w');
$eF = &fnr('elapsed');
$dF = &fnr('depth');
+$bF = &fnr('bin');
$dcF = &fnr('downcast');
$first_label = &antsRequireParam('run_label');
@@ -152,6 +165,26 @@
print(GMT ">\n100 $ymin\n100 $ymax\n");
print(GMT ">\n150 $ymin\n150 $ymax\n");
GMT_setR($R);
+
+ if (defined($opt_t)) {
+ open(BT,$opt_t) || croak("$opt_t: $!\n");
+ @BTL = &antsFileLayout(BT);
+ my($BTwf,$BTdf,$BTmf,$BTnf);
+ for (my($f)=0; $f<=$#BTL; $f++) {
+ $BTdf = $f if ($BTL[$f] eq 'depth');
+ $BTwf = $f if ($BTL[$f] eq 'BT_w');
+ $BTmf = $f if ($BTL[$f] eq 'BT_w.mad');
+ $BTnf = $f if ($BTL[$f] eq 'BT_w.nsamp');
+ }
+ croak("$opt_t: file-layout error\n")
+ unless defined($BTdf) && defined($BTwf) &&
+ defined($BTmf) && defined($BTnf);
+ GMT_psxy('-W6');
+ while (@BT = &antsFileIn(BT)) {
+ next unless numberp($BT[$BTwf]);
+ printf(GMT "%f %f\n",$BT[$BTwf],$BT[$BTdf]);
+ }
+ }
}
$min_depth = 9e99; # sentinels
@@ -163,10 +196,10 @@
if ($P{PATHNAME} ne $curF) { # new file
$curF = $P{PATHNAME};
- &antsInfo("WARNING: inconsistent %output_grid_dz in input files")
- if (defined($P{output_grid_dz}) && $P{output_grid_dz}!=$opt_o &&!$opt_o_override);
- &antsInfo("WARNING: inconsistent %output_grid_minsamp in input files")
- if (defined($P{output_grid_minsamp}) && $P{output_grid_minsamp}*2!=$opt_k &&!$opt_k_override);
+ &antsInfo("WARNING: inconsistent %outgrid_dz in input files")
+ if (defined($P{outgrid_dz}) && $P{outgrid_dz}!=$opt_o &&!$opt_o_override);
+ &antsInfo("WARNING: inconsistent %outgrid_minsamp in input files")
+ if (defined($P{outgrid_minsamp}) && $P{outgrid_minsamp}*2!=$opt_k &&!$opt_k_override);
$bin_length = sprintf('%d & %d',round($bin_length),($P{ADCP_bin_length}))
unless (round($bin_length) == round($P{ADCP_bin_length}));
@@ -191,6 +224,7 @@
undef(@dcw1); undef(@ucw1);
}
}
+ next if ($ants_[0][$bF]<$P{outgrid_firstbin}-1 || $ants_[0][$bF]>$P{outgrid_lastbin}-1);
$filt++,next if &isBad();
$min_depth = $ants_[0][$dF] if ($ants_[0][$dF] < $min_depth);
$max_depth = $ants_[0][$dF] if ($ants_[0][$dF] > $max_depth);
@@ -231,7 +265,8 @@
if ($dual_head) { # selected %PARAMs only
&antsAddParams('profile_id',$id,'lat',$P{lat},'lon',$P{lon});
&antsAddParams($dayNoP,$dn,'run_label',"$first_label & $P{run_label}");
- &antsAddParams('output_grid_dz',$opt_o,'output_grid_minsamp',$opt_k);
+ &antsAddParams('outgrid_dz',$opt_o,'outgrid_minsamp',$opt_k);
+ &antsAddParams('outgrid_firstbin',$P{outgrid_firstbin},'outgrid_lastbin',$P{outgrid_lastbin});
&antsAddParams('ADCP_bin_length',round($bin_length),'ADCP_pulse_length',round($pulse_length))
&antsAddParams('ADCP_blanking_distance',round($blanking_dist));
&antsAddParams('min_depth',round($min_depth),'max_depth',round($max_depth));
--- a/LWplot_BR Sun Jul 26 20:04:48 2015 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,90 +0,0 @@
-#!/bin/sh
-#======================================================================
-# L W P L O T _ B R
-# doc: Mon Oct 17 10:57:12 2011
-# dlm: Wed May 20 20:43:04 2015
-# (c) 2011 A.M. Thurnherr
-# uE-Info: 20 0 NIL 0 0 72 2 2 4 NIL ofnI
-#======================================================================
-
-# HISTORY:
-# Oct 17, 2011: - created
-# Nov 14, 2011: - added file layout check
-# Mar 12, 2012: - sh -> ksh as this does not work with /bin/sh on MacOSX 10.6.4
-# Apr 12, 2012: - made re-entrant
-# Oct 30, 2103: - got rid of non-portable echo -e
-# Apr 5, 2015: - made fixbb optional
-# Apr 16, 2015: - removed copy of input on stdout
-# - changed shell from /bin/ksh to /bin/sh
-# May 20, 2015: - made it quit on EOF
-
-#--------------------------------------------------
-# Usage
-#--------------------------------------------------
-
-USAGE="Usage: $0 <eps-file> [in-file]"
- [ $# -eq 2 ] && exec <"$2" "$0" "$1"
- [ $# -ne 1 ] && { echo $USAGE >&2; exit 1; }
-eps_file="$1"
-
-#--------------------------------------------------
-# Read Header Data
-#--------------------------------------------------
-
-read line
-while [ -z "$fields" -a -n "$line" ]
-do
- [ -z "$out_basename" ] && out_basename=`expr -- "$line" : '#ANTS#PARAMS#.*out_basename{\([^}]*\)}`
- [ -z "$run_label" ] && run_label=`expr -- "$line" : '#ANTS#PARAMS#.*run_label{\([^}]*\)}`
- [ -z "$max_bin" ] && max_bin=`expr -- "$line" : '#ANTS#PARAMS#.*max_bin{\([^}]*\)}`
- [ -z "$fields" ] && fields=`expr -- "$line" : '#ANTS#FIELDS# \(.*\)' | sed -e s/{//g -e s/}//g`
- read line
-done
-
-set -- $fields
-[ "$1" = bin -a \
- "$2" = dc_residual -a "$3" = dc_residual.sig -a "$4" = dc_residual.nsamp -a \
- "$5" = uc_residual -a "$6" = uc_residual.sig -a "$7" = uc_residual.nsamp ] || {
- echo "$0: file layout error" >&2
- exit 1
-}
-
-#--------------------------------------------------
-# Plot Data
-#--------------------------------------------------
-
-eps_file="$PWD/$eps_file" # make outfile name absolute (hopefully, it is not already...)
-mkdir /tmp/$$ # GMT makes tmpfiles and is not reentrant
-cd /tmp/$$
-
-TMPFILE=/tmp/$$.LWplot_BR
-cat > $TMPFILE
-
-[ -f .gmtdefaults4 ] ||
- gmtset PAPER_MEDIA letter+ \
- LABEL_FONT_SIZE 14 ANNOT_FONT_SIZE_PRIMARY 14 \
- WANT_EURO_FONT true \
- PLOT_DEGREE_FORMAT ddd:mm:ssF
-
-R=-R-0.07/0.07/0.5/`echo $max_bin+0.5|bc`
-U=-R0/1/0/1
-X=-JX10/-10
-
-{ echo 0 0.5; echo 0 `echo $max_bin+0.5|bc`; } | psxy -P -K $R $X > "$eps_file"
-
-awk '{print $2, $1}' $TMPFILE | psxy -O -K -Mn $R $X -W4/coral >> "$eps_file"
-awk '{print $5, $1}' $TMPFILE | psxy -O -K -Mn $R $X -W4/SeaGreen >> "$eps_file"
-awk '{print $2, $1, ($4>1)?($3/sqrt($4-1)):0}' $TMPFILE | psxy -O -K -Mn $R $X -Ex0.2c/4/coral >> "$eps_file"
-awk '{print $5, $1, ($7>1)?($6/sqrt($7-1)):0}' $TMPFILE | psxy -O -K -Mn $R $X -Ex0.2c/4/SeaGreen >> "$eps_file"
-
-echo 0.02 0.02 12 0 0 TL $out_basename $run_label| pstext -O -K $U $X >> "$eps_file"
-
-psbasemap -O -K $R $X -Bf0.005a0.05:"Residual Vertical Velocity [m/s]":/f1a5:"Bin [#]":WeSn >> "$eps_file"
-psbasemap -O $R $X -B/a100-99W >> "$eps_file"
-
-rm $TMPFILE
-[ -n "`which fixbb`" ] && fixbb "$eps_file"
-
-cd "$PWD"
-rm -rf /tmp/$$
-
--- a/LWplot_CAE Sun Jul 26 20:04:48 2015 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,103 +0,0 @@
-#!/bin/sh
-#======================================================================
-# L W P L O T _ C A E
-# doc: Wed May 15 19:35:58 2013
-# dlm: Wed May 20 20:43:33 2015
-# (c) 2013 A.M. Thurnherr
-# uE-Info: 40 0 NIL 0 0 72 2 2 4 NIL ofnI
-#======================================================================
-
-# HISTORY:
-# May 15, 2013: - created from [LWplot_BR]
-# May 16, 2013: - fiddled
-# Oct 30, 2013: - BUG: debug statement had been left in code
-# Oct 30, 2013: - got rid of non-portable echo -e
-# Apr 5, 2015: - made fixbb optional
-# Apr 16, 2015: - removed copy of input on stdout
-# - changed shell from /bin/ksh to /bin/sh
-# May 20, 2015: - made it quit on EOF
-
-#--------------------------------------------------
-# Usage
-#--------------------------------------------------
-
-USAGE="Usage: $0 <eps-file> [in-file]"
- [ $# -eq 2 ] && exec <"$2" "$0" "$1"
- [ $# -ne 1 ] && { echo $USAGE >&2; exit 1; }
-eps_file="$1"
-
-#--------------------------------------------------
-# Read Header Data
-#--------------------------------------------------
-
-read line
-while [ -z "$fields" -a -n "$line" ]
-do
- [ -z "$out_basename" ] && out_basename=`expr -- "$line" : '#ANTS#PARAMS#.*out_basename{\([^}]*\)}`
- [ -z "$run_label" ] && run_label=`expr -- "$line" : '#ANTS#PARAMS#.*run_label{\([^}]*\)}`
- [ -z "$fields" ] && fields=`expr -- "$line" : '#ANTS#FIELDS# \(.*\)' | sed -e s/{//g -e s/}//g`
- read line
-done
-
-set -- $fields
-[ "$3" = downcast -a "${12}" = CTD_w_tt -a "${15}" = reflr_ocean_w ] || {
- echo "$0: file layout error" >&2
- exit 1
-}
-
-#--------------------------------------------------
-# Plot Data
-#--------------------------------------------------
-
-eps_file="$PWD/$eps_file" # make outfile name absolute (hopefully, it is not already...)
-mkdir /tmp/$$ # GMT makes tmpfiles and is not reentrant
-cd /tmp/$$
-
-TMPFILE=/tmp/$$.LWplot_BR
-cat > $TMPFILE
-
-[ -f .gmtdefaults4 ] ||
- gmtset PAPER_MEDIA letter+ \
- LABEL_FONT_SIZE 14 ANNOT_FONT_SIZE_PRIMARY 14 \
- WANT_EURO_FONT true \
- PLOT_DEGREE_FORMAT ddd:mm:ssF
-
-#R=-R-0.8/0.8/-0.3/0.3
-R=-R-2.0/2.0/-0.3/0.3
-U=-R0/1/0/1
-X=-JX10/10
-
-awk '{print $3, $12, $15}' $TMPFILE |
- Cat -QS1:1 -F'$2,$3' |
- psxy -P -K -Mn $R $X -Sc0.1 -Gcoral > "$eps_file"
-
-awk '{print $3, $12, $15}' $TMPFILE |
- Cat -QS1:0 -F'$2,$3' |
- psxy -O -K -Mn $R $X -Sc0.1 -GSeaGreen >> "$eps_file"
-
-{ echo -2.0 0; echo 2.0 0; } | psxy -O -K $R $X -W2/gray30 >> "$eps_file"
-{ echo 0 -0.3; echo 0 0.3; } | psxy -O -K $R $X -W2/gray30 >> "$eps_file"
-
-{ echo -2.0 -0.2; echo 2.0 -0.2; } | psxy -O -K $R $X -W1/gray70 >> "$eps_file"
-{ echo -2.0 -0.1; echo 2.0 -0.1; } | psxy -O -K $R $X -W1/gray70 >> "$eps_file"
-{ echo -2.0 0.1; echo 2.0 0.1; } | psxy -O -K $R $X -W1/gray70 >> "$eps_file"
-{ echo -2.0 0.2; echo 2.0 0.2; } | psxy -O -K $R $X -W1/gray70 >> "$eps_file"
-
-{ echo -1.5 -0.3; echo -1.5 0.3; } | psxy -O -K $R $X -W1/gray70 >> "$eps_file"
-{ echo -1.0 -0.3; echo -1.0 0.3; } | psxy -O -K $R $X -W1/gray70 >> "$eps_file"
-{ echo -0.5 -0.3; echo -0.5 0.3; } | psxy -O -K $R $X -W1/gray70 >> "$eps_file"
-{ echo 0.5 -0.3; echo 0.5 0.3; } | psxy -O -K $R $X -W1/gray70 >> "$eps_file"
-{ echo 1.0 -0.3; echo 1.0 0.3; } | psxy -O -K $R $X -W1/gray70 >> "$eps_file"
-{ echo 1.5 -0.3; echo 1.5 0.3; } | psxy -O -K $R $X -W1/gray70 >> "$eps_file"
-
-echo 0.047 0.965 12 0 0 TL $out_basename $run_label| pstext -O -K $U $X >> "$eps_file"
-
-psbasemap -O -K $R $X -Bf0.1a1:"CTD d@+2@+z/dt@+2@+ [ms@+-3@+]":/f0.01a0.1:"reference-layer ocean w [ms@+-1@+]":WeSn >> "$eps_file"
-psbasemap -O $R $X -B/a100-99W >> "$eps_file"
-
-rm $TMPFILE
-[ -n "`which fixbb`" ] && fixbb "$eps_file"
-
-cd "$PWD"
-rm -rf /tmp/$$
-
--- a/LWplot_Sv Sun Jul 26 20:04:48 2015 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,118 +0,0 @@
-#!/bin/sh
-#======================================================================
-# L W P L O T _ S V
-# doc: Sat Oct 15 13:42:50 2011
-# dlm: Wed May 20 20:43:55 2015
-# (c) 2011 A.M. Thurnherr
-# uE-Info: 52 0 NIL 0 0 72 2 2 4 NIL ofnI
-#======================================================================
-
-# HISTORY:
-# Oct 19, 2011: - adapted from [LWplot_residuals]
-# Oct 24, 2011: - LADCP_bin_length => ADCP_bin_length
-# Nov 14, 2011: - added file layout check
-# Mar 12, 2012: - sh -> ksh as this does not work with /bin/sh on MacOSX 10.6.4
-# Apr 12, 2012: - made re-entrant
-# May 16, 2013: - adapted to file-layout changes
-# May 20, 2013: - renamed volume_scattering_coeff to Sv
-# Apr 5, 2015: - made fixbb optional
-# Apr 16, 2015: - removed copy of input on stdout
-# - changed shell from /bin/ksh to /bin/sh
-# - added seabed if available
-# Apr 20, 2015: - removed _skel dependence
-# May 20, 2015: - made it quit on EOF
-
-#--------------------------------------------------
-# Usage
-#--------------------------------------------------
-
-USAGE="Usage: $0 <eps-file> [in-file]"
- [ $# -eq 2 ] && exec <"$2" "$0" "$1"
- [ $# -ne 1 ] && { echo $USAGE >&2; exit 1; }
-
-eps_file="$1"
-
-#--------------------------------------------------
-# Read Header Data
-#--------------------------------------------------
-
-read line
-while [ -z "$fields" -a -n "$line" ]
-do
- [ -z "$out_basename" ] && out_basename=`expr -- "$line" : '#ANTS#PARAMS#.*out_basename{\([^}]*\)}`
- [ -z "$run_label" ] && run_label=`expr -- "$line" : '#ANTS#PARAMS#.*run_label{\([^}]*\)}`
- [ -z "$min_depth" ] && min_depth=`expr -- "$line" : '#ANTS#PARAMS#.*min_depth{\([^}]*\)}`
- [ -z "$max_depth" ] && max_depth=`expr -- "$line" : '#ANTS#PARAMS#.*max_depth{\([^}]*\)}`
- [ -z "$water_depth" ] && water_depth=`expr -- "$line" : '#ANTS#PARAMS#.*water_depth{\([^}]*\)}`
- [ -z "$min_ens" ] && min_ens=`expr -- "$line" : '#ANTS#PARAMS#.*min_ens{\([^}]*\)}`
- [ -z "$max_ens" ] && max_ens=`expr -- "$line" : '#ANTS#PARAMS#.*max_ens{\([^}]*\)}`
- [ -z "$ADCP_bin_length" ] && ADCP_bin_length=`expr -- "$line" : '#ANTS#PARAMS#.*ADCP_bin_length{\([^}]*\)}`
- [ -z "$fields" ] && fields=`expr -- "$line" : '#ANTS#FIELDS# \(.*\)' | sed -e s/{//g -e s/}//g`
- read line
-done
-
-set -- $fields
-[ "$1" = ensemble -a "$4" = depth -a "${17}" = Sv ] || {
- echo "$0: file layout error" >&2
- exit 1
-}
-
-#--------------------------------------------------
-# Plot Data
-#--------------------------------------------------
-
-eps_file="$PWD/$eps_file" # make outfile name absolute (hopefully, it is not already...)
-mkdir /tmp/$$ # GMT makes tmpfiles and is not reentrant
-cd /tmp/$$
-
-TMPFILE=/tmp/$$.LWplot_Sv
-cat > $TMPFILE
-
-[ -f .gmtdefaults4 ] ||
- gmtset PAPER_MEDIA letter+ \
- LABEL_FONT_SIZE 14 ANNOT_FONT_SIZE_PRIMARY 14 \
- WANT_EURO_FONT true \
- PLOT_DEGREE_FORMAT ddd:mm:ssF
-
-[ -n "$water_depth" ] && blim=`echo "scale=1;$water_depth+25"|bc` \
- || blim=`echo "scale=1;$max_depth+$ADCP_bin_length"|bc`
-R=-R`echo "scale=1;$min_ens-0.5"|bc`/`echo "scale=1;$max_ens+0.5"|bc`/0/$blim
-
-U=-R0/1/0/1
-X=-JX10/-10
-C=-C`which LWplot_Sv | sed 's@LWplot_Sv$@Sv.cpt@'`
-
-ens_width=`echo "scale=5;10/($max_ens-$min_ens+1)"|bc`
-bin_length=`echo "scale=5;10*$ADCP_bin_length/($max_depth-$min_depth+$ADCP_bin_length)"|bc`
-
-awk "{print \$1, \$4, \$17, $ens_width, $bin_length}" $TMPFILE \
- | psxy -P -K $R $X $C -Sr > "$eps_file"
-[ -n "$water_depth" ] && {
- echo $min_ens $blim;
- echo $max_ens $blim;
- echo $max_ens $water_depth;
- echo $min_ens $water_depth;
-} | psxy -O -K $R $X -G204/153/102 >> "$eps_file"
-
-echo 0.02 0.02 12 0 0 TL $out_basename $run_label | pstext -O -K $U $X >> "$eps_file"
-
-if [ 0 -eq `echo "($max_depth-$min_depth)>1000"|bc` ]
-then
- depth_tics=f10a100
- ens_tics=f50a500
-else
- depth_tics=f100a500
- ens_tics=f500a1000
-fi
-
-psbasemap -O -K $R $X -B$ens_tics:"Ensemble":/$depth_tics:"Depth [m]":WeSn >> "$eps_file"
-
-gmtset ANNOT_FONT_SIZE_PRIMARY 7
-psscale -O -E -D8/2/3/0.4 $C -B/:S@-v@-: >> "$eps_file"
-
-rm $TMPFILE
-[ -n "`which fixbb`" ] && fixbb "$eps_file"
-
-cd "$PWD"
-rm -rf /tmp/$$
-
--- a/LWplot_TL Sun Jul 26 20:04:48 2015 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,108 +0,0 @@
-#!/bin/sh
-#======================================================================
-# L W P L O T _ T L
-# doc: Thu Oct 13 10:51:49 2011
-# dlm: Wed May 20 20:44:17 2015
-# (c) 2011 A.M. Thurnherr
-# uE-Info: 46 0 NIL 0 0 72 2 2 4 NIL ofnI
-#======================================================================
-
-# HISTORY:
-# Oct 13, 2011: - created
-# Oct 14, 2011: - fiddled
-# Oct 17, 2011: - turned into filter
-# - added %run_label
-# Nov 14, 2011: - added file layout check
-# Mar 12, 2012: - sh -> ksh as this does not work with /bin/sh on MacOSX 10.6.4
-# Apr 12, 2012: - made re-entrant
-# Oct 12, 2012: - split dc/uc time lagging
-# - reduced number of xtic labels
-# Oct 16, 2012: - renamed elapsed to elapsed.LADCP
-# Mar 23, 2013: - adapted to piece-wice time lagging
-# Oct 30, 2103: - got rid of non-portable echo -e
-# Apr 5, 2015: - made fixbb optional
-# - BUG: ps file had not been closed properly (fixbb took care of that)
-# Apr 16, 2015: - removed copy of input on stdout
-# - changed shell from /bin/ksh to /bin/sh
-# May 20, 2015: - made it quit on EOF
-
-USAGE="Usage: $0 <eps-file> [in-file]"
- [ $# -eq 2 ] && exec <"$2" "$0" "$1"
- [ $# -ne 1 ] && { echo $USAGE >&2; exit 1; }
-eps_file="$1"
-
-read line
-while [ -z "$fields" -a -n "$line" ]
-do
- [ -z "$out_basename" ] && out_basename=`expr -- "$line" : '#ANTS#PARAMS#.*out_basename{\([^}]*\)}`
- [ -z "$run_label" ] && run_label=`expr -- "$line" : '#ANTS#PARAMS#.*run_label{\([^}]*\)}`
- [ -z "$min_elapsed" ] && min_elapsed=`expr -- "$line" : '#ANTS#PARAMS#.*elapsed.min{\([^}]*\)}`
- [ -z "$max_elapsed" ] && max_elapsed=`expr -- "$line" : '#ANTS#PARAMS#.*elapsed.max{\([^}]*\)}`
- [ -z "$bot_elapsed" ] && bot_elapsed=`expr -- "$line" : '#ANTS#PARAMS#.*elapsed.bot{\([^}]*\)}`
- [ -z "$best_scan_offsets" ] && best_scan_offsets=`expr -- "$line" : '#ANTS#PARAMS#.*best_scan_offsets{\([^}]*\)}`
- [ -z "$to_elapsed_limits" ] && to_elapsed_limits=`expr -- "$line" : '#ANTS#PARAMS#.*to_elapsed_limits{\([^}]*\)}`
- [ -z "$fields" ] && fields=`expr -- "$line" : '#ANTS#FIELDS# \(.*\)' | sed -e s/{//g -e s/}//g`
- read line
-done
-
-set -- $fields
-[ "$1" = elapsed.LADCP -a "$2" = scan_offset -a "$4" = downcast ] || {
- echo "$0: file layout error ($1,$2,$4)" >&2
- exit 1
-}
-
-eps_file="$PWD/$eps_file" # make outfile name absolute (hopefully, it is not already...)
-mkdir /tmp/$$ # GMT makes tmpfiles and is not reentrant
-cd /tmp/$$
-
-TMPFILE=/tmp/$$.LWplot_TL
-cat > $TMPFILE
-
-[ -f .gmtdefaults4 ] ||
- gmtset PAPER_MEDIA letter+ \
- LABEL_FONT_SIZE 14 ANNOT_FONT_SIZE_PRIMARY 14 \
- WANT_EURO_FONT true \
- PLOT_DEGREE_FORMAT ddd:mm:ssF
-
-R=-R`echo $min_elapsed/60|bc`/`echo $max_elapsed/60+1|bc`/-24/24
-U=-R0/1/0/1
-J=-JX10
-
-awk '{if ($4 == 1) { print $1/60,$2; }}' $TMPFILE \
- | psxy -P -K $J $R \
- -Bf1a30:"Elapsed Time [min]":/f1a5:"Best Offset [scans]":WeSn \
- -Sc0.1 -Gcoral \
- > "$eps_file"
-
-awk '{if ($4 == 0) { print $1/60,$2; }}' $TMPFILE \
- | psxy -O -K $J $R -Sc0.1 -GSeaGreen \
- >> "$eps_file"
-
-fel=$min_elapsed # from-elapsed limit
-set -- $best_scan_offsets
-while [ -n "$1" ]
-do
- bso=$1
- shift
- best_scan_offsets=$@
-
- set -- $to_elapsed_limits
- tel=$1
- shift
- to_elapsed_limits=$@
-
- { echo `echo $fel/60|bc` $bso; echo `echo $tel/60+1|bc` $bso; } \
- | psxy -O -K $R $J -W4/grey20 >> "$eps_file"
-
- fel=$tel
- set -- $best_scan_offsets
-done
-
-echo 0.02 0.98 12 0 0 TL $out_basename $run_label | pstext -O $U $J >> "$eps_file"
-
-rm $TMPFILE
-[ -n "`which fixbb`" ] && fixbb "$eps_file"
-
-cd "$PWD"
-rm -rf /tmp/$$
-
--- a/LWplot_corr Sun Jul 26 20:04:48 2015 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,106 +0,0 @@
-#!/bin/sh
-#======================================================================
-# L W P L O T _ C O R R
-# doc: Sat Oct 15 13:42:50 2011
-# dlm: Wed May 20 20:44:44 2015
-# (c) 2011 A.M. Thurnherr
-# uE-Info: 48 0 NIL 0 0 72 2 2 4 NIL ofnI
-#======================================================================
-
-# HISTORY:
-# Oct 19, 2011: - adapted from [LWplot_residuals]
-# Oct 24, 2011: - LADCP_bin_length => ADCP_bin_length
-# Nov 14, 2011: - added file layout check
-# Mar 12, 2012: - sh -> ksh as this does not work with /bin/sh on MacOSX 10.6.4
-# Apr 12, 2012: - made re-entrant
-# May 16, 2013: - adapted to file layout change
-# Apr 5, 2015: - made fixbb optional
-# Apr 16, 2015: - removed copy of input on stdout
-# - changed shell from /bin/ksh to /bin/sh
-# Apr 20, 2015: - removed _skel dependence
-# May 20, 2015: - made it quit on EOF
-
-#--------------------------------------------------
-# Usage
-#--------------------------------------------------
-
-USAGE="Usage: $0 <eps-file> [in-file]"
- [ $# -eq 2 ] && exec <"$2" "$0" "$1"
- [ $# -ne 1 ] && { echo $USAGE >&2; exit 1; }
-eps_file="$1"
-
-#--------------------------------------------------
-# Read Header Data
-#--------------------------------------------------
-
-read line
-while [ -z "$fields" -a -n "$line" ]
-do
- [ -z "$out_basename" ] && out_basename=`expr -- "$line" : '#ANTS#PARAMS#.*out_basename{\([^}]*\)}`
- [ -z "$run_label" ] && run_label=`expr -- "$line" : '#ANTS#PARAMS#.*run_label{\([^}]*\)}`
- [ -z "$min_depth" ] && min_depth=`expr -- "$line" : '#ANTS#PARAMS#.*min_depth{\([^}]*\)}`
- [ -z "$max_depth" ] && max_depth=`expr -- "$line" : '#ANTS#PARAMS#.*max_depth{\([^}]*\)}`
- [ -z "$min_ens" ] && min_ens=`expr -- "$line" : '#ANTS#PARAMS#.*min_ens{\([^}]*\)}`
- [ -z "$max_ens" ] && max_ens=`expr -- "$line" : '#ANTS#PARAMS#.*max_ens{\([^}]*\)}`
- [ -z "$ADCP_bin_length" ] && ADCP_bin_length=`expr -- "$line" : '#ANTS#PARAMS#.*ADCP_bin_length{\([^}]*\)}`
- [ -z "$fields" ] && fields=`expr -- "$line" : '#ANTS#FIELDS# \(.*\)' | sed -e s/{//g -e s/}//g`
- read line
-done
-
-set -- $fields
-[ "$1" = ensemble -a "$4" = depth -a "${15}" = correlation ] || {
- echo "$0: file layout error" >&2
- exit 1
-}
-
-#--------------------------------------------------
-# Plot Data
-#--------------------------------------------------
-
-eps_file="$PWD/$eps_file" # make outfile name absolute (hopefully, it is not already...)
-mkdir /tmp/$$ # GMT makes tmpfiles and is not reentrant
-cd /tmp/$$
-
-TMPFILE=/tmp/$$.LWplot_corr
-cat > $TMPFILE
-
-[ -f .gmtdefaults4 ] ||
- gmtset PAPER_MEDIA letter+ \
- LABEL_FONT_SIZE 14 ANNOT_FONT_SIZE_PRIMARY 14 \
- WANT_EURO_FONT true \
- PLOT_DEGREE_FORMAT ddd:mm:ssF
-
-R=-R`echo "scale=1;$min_ens-0.5"|bc`/`echo "scale=1;$max_ens+0.5"|bc`/`\
- echo "scale=1;$min_depth-$ADCP_bin_length/2"|bc`/`echo "scale=1;$max_depth+$ADCP_bin_length/2"|bc`
-U=-R0/1/0/1
-X=-JX10/-10
-C=-C`which LWplot_corr | sed 's@LWplot_corr$@corr.cpt@'`
-
-ens_width=`echo "scale=5;10/($max_ens-$min_ens+1)"|bc`
-bin_length=`echo "scale=5;10*$ADCP_bin_length/($max_depth-$min_depth+$ADCP_bin_length)"|bc`
-
-awk "{print \$1, \$4, \$15, $ens_width, $bin_length}" $TMPFILE \
- | psxy -P -K $R $X $C -Sr > "$eps_file"
-
-echo 0.02 0.02 12 0 0 TL $out_basename $run_label | pstext -O -K $U $X >> "$eps_file"
-
-if [ 0 -eq `echo "($max_depth-$min_depth)>1000"|bc` ]
-then
- depth_tics=f10a100
- ens_tics=f50a500
-else
- depth_tics=f100a500
- ens_tics=f500a1000
-fi
-
-psbasemap -O -K $R $X -B$ens_tics:"Ensemble":/$depth_tics:"Depth [m]":WeSn >> "$eps_file"
-
-gmtset ANNOT_FONT_SIZE_PRIMARY 7
-psscale -O -E -D8/2/3/0.4 $C -B/:corr: >> "$eps_file"
-
-rm $TMPFILE
-[ -n "`which fixbb`" ] && fixbb "$eps_file"
-
-cd "$PWD"
-rm -rf /tmp/$$
-
--- a/LWplot_prof Sun Jul 26 20:04:48 2015 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,149 +0,0 @@
-#!/bin/sh
-#======================================================================
-# L W P L O T _ P R O F
-# doc: Fri Oct 14 09:42:36 2011
-# dlm: Wed May 20 20:45:55 2015
-# (c) 2011 A.M. Thurnherr
-# uE-Info: 56 0 NIL 0 0 72 2 2 4 NIL ofnI
-#======================================================================
-
-# HISTORY:
-# Oct 14, 2011: - created
-# Oct 15, 2011: - added nsamp
-# Oct 16, 2011: - made depth tic-marks range dependent
-# Oct 17, 2011: - turned into filter
-# - added %run_label
-# Nov 14, 2011: - added file layout check
-# Mar 12, 2012: - sh -> ksh as this does not work with /bin/sh on MacOSX 10.6.4
-# Apr 12, 2012: - made re-entrant
-# May 15, 2013: - BUG: plot separation lines/shading did not work any more
-# Oct 30, 2103: - got rid of non-portable echo -e
-# Apr 5, 2015: - made fixbb optional
-# Apr 16, 2015: - removed copy of input on stdout
-# - changed shell from /bin/ksh to /bin/sh
-# Apr 26, 2015: - adapted to LADCP_w_regrid output
-# - removed -N
-# - moved run_label above plot area
-# May 19, 2015: - adapted to new layout (hab)
-# - BUG: erroneously let .VKE profiles pass
-# May 20, 2015: - made it quit on EOF
-
-#--------------------------------------------------
-# Usage
-#--------------------------------------------------
-
-USAGE="Usage: $0 <eps-file> [in-file]"
- [ $# -eq 2 ] && exec <"$2" "$0" "$1"
- [ $# -ne 1 ] && { echo $USAGE >&2; exit 1; }
-eps_file="$1"
-
-#--------------------------------------------------
-# Read Header Data
-#--------------------------------------------------
-
-read line
-while [ -z "$done" -a -n "$line" ]
-do
- [ -z "$out_basename" ] && out_basename=`expr -- "$line" : '#ANTS#PARAMS#.*out_basename{\([^}]*\)}`
- [ -z "$run_label" ] && run_label=`expr -- "$line" : '#ANTS#PARAMS#.*run_label{\([^}]*\)}`
- [ -z "$min_depth" ] && min_depth=`expr -- "$line" : '#ANTS#PARAMS#.*min_depth{\([^}]*\)}`
- [ -z "$max_depth" ] && max_depth=`expr -- "$line" : '#ANTS#PARAMS#.*max_depth{\([^}]*\)}`
- [ -z "$water_depth" ] && water_depth=`expr -- "$line" : '#ANTS#PARAMS#.*water_depth{\([^}]*\)}`
- newfields=`expr -- "$line" : '#ANTS#FIELDS# \(.*\)' | sed -e s/{//g -e s/}//g`
- [ -z "$newfields" ] || fields=$newfields
- done=`expr -- "$line" : '^[^#]\(.*\)'`
- read line
-done
-
-set -- $fields
-[ "$1" = depth -a "$4" = dc_w -a "$5" = dc_w.mad -a "$6" = dc_w.nsamp -a \
- "$8" = uc_w -a "$9" = uc_w.mad -a "${10}" = uc_w.nsamp ] || {
- echo "$0: file layout error ($1, $4, $5, $6, $8, $9, ${10})" >&2
- exit 1
-}
-
-#--------------------------------------------------
-# Plot Data
-#--------------------------------------------------
-
-eps_file="$PWD/$eps_file" # make outfile name absolute (hopefully, it is not already...)
-mkdir /tmp/$$ # GMT makes tmpfiles and is not reentrant
-cd /tmp/$$
-
-TMPFILE=/tmp/$$.LWplot_prof
-{
- echo $line
- sed s/#.*//
-} > $TMPFILE
-
-[ -f .gmtdefaults4 ] ||
- gmtset PAPER_MEDIA letter+ \
- LABEL_FONT_SIZE 14 ANNOT_FONT_SIZE_PRIMARY 14 \
- WANT_EURO_FONT true \
- PLOT_DEGREE_FORMAT ddd:mm:ssF
-
-[ -n "$water_depth" ] && blim=`echo "scale=0;$water_depth/1+25"|bc` \
- || blim=`echo "scale=0;$max_depth/1+25"|bc`
-
-XTICS="-0.05 0.05 0.15"
-XMIN=-0.1
-
-[ -r ./.LWplot_prof ] && . ./.LWplot_prof
-
-R=-R$XMIN/0.35/0/$blim
-R2=-R-200/200/0/$blim
-U=-R0/1/0/1
-X=-JX10/-10
-
-# FRAME
-{ echo 0 $min_depth; echo 0 $max_depth; } | psxy -P -K $R $X > "$eps_file"
-{ echo 0.07 $min_depth; echo 0.07 $max_depth; echo 0.18 $max_depth; echo 0.18 $min_depth; } | psxy -O -K $R $X -L -G200 >> "$eps_file"
-{ echo 50 $min_depth; echo 50 $max_depth; } | psxy -O -K $R2 $X >> "$eps_file"
-{ echo 100 $min_depth; echo 100 $max_depth; } | psxy -O -K $R2 $X >> "$eps_file"
-{ echo 150 $min_depth; echo 150 $max_depth; } | psxy -O -K $R2 $X >> "$eps_file"
-
-# VERTICAL VELOCITIES
-awk '{print $4,$1}' $TMPFILE | psxy -O -K -Mn $R $X -W4/coral >> "$eps_file"
-awk '{print $8,$1}' $TMPFILE | psxy -O -K -Mn $R $X -W4/SeaGreen >> "$eps_file"
-
-# MEAN ABSOLUTE DEVIATIONS
-awk '{print $5,$1,$4}' $TMPFILE | grep -vi nan | psxy -O -K $R $X -Sc0.1c -Gcoral >> "$eps_file"
-awk '{print $9,$1,$8}' $TMPFILE | grep -vi nan | psxy -O -K $R $X -Sc0.1c -GSeaGreen >> "$eps_file"
-
-# NUMBER OF SAMPLES
-awk '{print $6,$1,$5}' $TMPFILE | sed '/nan/s/.*/nan/' | psxy -O -K -Mn $R2 $X -W1/coral >> "$eps_file"
-awk '{print $10,$1,$9}' $TMPFILE | sed '/nan/s/.*/nan/' | psxy -O -K -Mn $R2 $X -W1/SeaGreen >> "$eps_file"
-
-# SEABED
-[ -n "$water_depth" ] && {
- echo $XMIN $blim;
- echo 0.35 $blim;
- echo 0.35 $water_depth;
- echo $XMIN $water_depth;
-} | psxy -O -K $R $X -G204/153/102 >> "$eps_file"
-
-# LABELS
-echo 0.02 -0.05 10 0 0 TL $out_basename $run_label | pstext -O -K -Gblue -N $U $X >> "$eps_file"
-echo 0.6 0.98 12 0 0 BR m.a.d. | pstext -O -K $U $X >> "$eps_file"
-
-if [ 0 -eq `echo "($max_depth-$min_depth)>1000"|bc` ]
-then
- depth_tics=f10a100
-else
- depth_tics=f100a500
-fi
-
-psbasemap -O -K $R $X -Bf0.01a10-10.05:"Vertical Velocity [m/s] ":/$depth_tics:"Depth [m]":WeS >> "$eps_file"
-psbasemap -O -K $R $X -Ba10-9.95S >> "$eps_file"
-psbasemap -O -K $R $X -Ba10-9.85S >> "$eps_file"
-
-psbasemap -O -K $R2 $X -Bf10a1000-950:" # of Samples":N >> "$eps_file"
-psbasemap -O -K $R2 $X -Ba1000-900N >> "$eps_file"
-psbasemap -O $R2 $X -Ba1000-850N >> "$eps_file"
-
-rm $TMPFILE
-[ -n "`which fixbb`" ] && fixbb "$eps_file"
-
-cd "$PWD"
-rm -rf /tmp/$$
-
--- a/LWplot_prof_2beam Sun Jul 26 20:04:48 2015 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,148 +0,0 @@
-#!/bin/sh
-#======================================================================
-# L W P L O T _ P R O F _ 2 B E A M
-# doc: Fri Oct 14 09:42:36 2011
-# dlm: Wed May 20 20:42:08 2015
-# (c) 2011 A.M. Thurnherr
-# uE-Info: 21 39 NIL 0 0 72 2 2 4 NIL ofnI
-#======================================================================
-
-# HISTORY:
-# May 15, 2013: - created from [LWplot_prof]
-# Oct 30, 2103: - got rid of non-portable echo -e
-# Nov 3, 2014: - adapted to updated layout of .prof file
-# Apr 5, 2015: - made fixbb optional
-# Apr 16, 2015: - removed copy of input on stdout
-# - changed shell from /bin/ksh to /bin/sh
-# - slightly increased w range
-# - added seabed if available
-# Apr 23, 2015: - added support for .LWplot_prof_2beam
-# - removed all -N
-# May 20, 2015: - made it quit on EOF
-
-# NOTES:
-# - In order to extend the x-axis range, create a file
-# called [.LWplot_prof_2beam] in the processing directory and
-# add something like the following lines:
-# XMIN=-0.27
-# XTICS="-0.25 -0.15 -0.05 0.05"
-
-#--------------------------------------------------
-# Usage
-#--------------------------------------------------
-
-USAGE="Usage: $0 <eps-file> [in-file]"
- [ $# -eq 2 ] && exec <"$2" "$0" "$1"
- [ $# -ne 1 ] && { echo $USAGE >&2; exit 1; }
-eps_file="$1"
-
-#--------------------------------------------------
-# Read Header Data
-#--------------------------------------------------
-
-read line
-while [ -z "$fields" -a -n "$line" ]
-do
- [ -z "$out_basename" ] && out_basename=`expr -- "$line" : '#ANTS#PARAMS#.*out_basename{\([^}]*\)}`
- [ -z "$run_label" ] && run_label=`expr -- "$line" : '#ANTS#PARAMS#.*run_label{\([^}]*\)}`
- [ -z "$min_depth" ] && min_depth=`expr -- "$line" : '#ANTS#PARAMS#.*min_depth{\([^}]*\)}`
- [ -z "$max_depth" ] && max_depth=`expr -- "$line" : '#ANTS#PARAMS#.*max_depth{\([^}]*\)}`
- [ -z "$water_depth" ] && water_depth=`expr -- "$line" : '#ANTS#PARAMS#.*water_depth{\([^}]*\)}`
- [ -z "$fields" ] && fields=`expr -- "$line" : '#ANTS#FIELDS# \(.*\)' | sed -e s/{//g -e s/}//g`
- read line
-done
-
-set -- $fields
-[ "$1" = depth -a "$7" = dc_w12 -a "$8" = dc_w34 -a "$5" = dc_w.mad -a "$6" = dc_w.nsamp -a \
- "${14}" = uc_w12 -a "${15}" = uc_w34 -a "${12}" = uc_w.mad -a "${13}" = uc_w.nsamp -a \
- "${16}" = BT_w -a "${17}" = BT_w.mad -a "${18}" = BT_w.nsamp ] || {
- echo "$0: file layout error" >&2
- exit 1
-}
-
-#--------------------------------------------------
-# Plot Data
-#--------------------------------------------------
-
-[ -n "$water_depth" ] && blim=`echo "scale=0;$water_depth/1+25"|bc` \
- || blim=`echo "scale=0;$max_depth/1+25"|bc`
-
-XTICS="-0.05 0.05 0.15"
-XMIN=-0.1
-
-[ -r ./.LWplot_prof_2beam ] && . ./.LWplot_prof_2beam
-
-R=-R$XMIN/0.35/0/$blim
-R2=-R-200/200/0/$blim
-U=-R0/1/0/1
-X=-JX10/-10
-
-eps_file="$PWD/$eps_file" # make outfile name absolute (hopefully, it is not already...)
-mkdir /tmp/$$ # GMT makes tmpfiles and is not reentrant
-cd /tmp/$$
-
-TMPFILE=/tmp/$$.LWplot_prof
-cat > $TMPFILE
-
-[ -f .gmtdefaults4 ] ||
- gmtset PAPER_MEDIA letter+ \
- LABEL_FONT_SIZE 14 ANNOT_FONT_SIZE_PRIMARY 14 \
- WANT_EURO_FONT true \
- PLOT_DEGREE_FORMAT ddd:mm:ssF
-
-# FRAME
-{ echo 0 0; echo 0 $blim; } | psxy -P -K $R $X > "$eps_file"
-{ echo 0.07 0; echo 0.07 $blim; echo 0.18 $blim; echo 0.18 0; } | psxy -O -K $R $X -L -G200 >> "$eps_file"
-{ echo 50 0; echo 50 $blim; } | psxy -O -K $R2 $X >> "$eps_file"
-{ echo 100 0; echo 100 $blim; } | psxy -O -K $R2 $X >> "$eps_file"
-{ echo 150 0; echo 150 $blim; } | psxy -O -K $R2 $X >> "$eps_file"
-
-# VERTICAL VELOCITIES (2-BEAM SOLUTIONS)
-awk '{print $7, $1}' $TMPFILE | psxy -O -K -Mn $R $X -W4,coral,6_2:0 >> "$eps_file"
-awk '{print $8, $1}' $TMPFILE | psxy -O -K -Mn $R $X -W4,coral,4_6:0 >> "$eps_file"
-awk '{print $14,$1}' $TMPFILE | psxy -O -K -Mn $R $X -W4,SeaGreen,6_2:0 >> "$eps_file"
-awk '{print $15,$1}' $TMPFILE | psxy -O -K -Mn $R $X -W4,SeaGreen,4_6:0 >> "$eps_file"
-awk '{print $16,$1}' $TMPFILE | psxy -O -K -Mn $R $X -W4,black >> "$eps_file"
-
-# MEAN ABSOLUTE DEVIATIONS (COMBINED SOLUTION)
-awk '{print $5,$1, $4}' $TMPFILE | grep -vi nan | psxy -O -K $R $X -Sc0.1c -Gcoral >> "$eps_file"
-awk '{print $12,$1,$11}' $TMPFILE | grep -vi nan | psxy -O -K $R $X -Sc0.1c -GSeaGreen >> "$eps_file"
-awk '{print $17,$1,$20}' $TMPFILE | grep -vi nan | psxy -O -K $R $X -Sc0.1c -Gblack >> "$eps_file"
-
-# NUMBER OF SAMPLES (COMBINED SOLUTION)
-awk '{print $6,$1, $4}' $TMPFILE | sed '/nan/s/.*/nan/' | psxy -O -K -Mn $R2 $X -W1/coral >> "$eps_file"
-awk '{print $13,$1,$11}' $TMPFILE | sed '/nan/s/.*/nan/' | psxy -O -K -Mn $R2 $X -W1/SeaGreen >> "$eps_file"
-awk '{print $18,$1,$20}' $TMPFILE | sed '/nan/s/.*/nan/' | psxy -O -K -Mn $R2 $X -W1/black >> "$eps_file"
-
-# SEABED
-[ -n "$water_depth" ] && {
- echo $XMIN $blim;
- echo 0.35 $blim;
- echo 0.35 $water_depth;
- echo $XMIN $water_depth;
-} | psxy -O -K $R $X -G204/153/102 >> "$eps_file"
-
-# LABELS
-echo 0.02 0.02 12 0 0 TL $out_basename $run_label | pstext -O -K $U $X >> "$eps_file"
-echo 0.6 0.98 12 0 0 BR m.a.d. | pstext -O -K $U $X >> "$eps_file"
-
-# AXES
-[ $blim -lt 1000 ] && depth_tics=f10a100\
- || depth_tics=f100a500
-
-psbasemap -O -K $R $X -Bf0.01:"Vertical Velocity [m/s] ":/$depth_tics:"Depth [m]":WeS >> "$eps_file"
-for t in $XTICS
-do
- psbasemap -O -K $R $X -Ba10-`echo "10-($t)"|bc`S >> "$eps_file"
-done
-
-psbasemap -O -K $R2 $X -Bf10a1000-950:" # of Samples":N >> "$eps_file"
-psbasemap -O -K $R2 $X -Ba1000-900N >> "$eps_file"
-psbasemap -O $R2 $X -Ba1000-850N >> "$eps_file"
-
-rm $TMPFILE
-[ -n "`which fixbb`" ] && fixbb "$eps_file"
-
-cd "$PWD"
-rm -rf /tmp/$$
-
--- a/LWplot_residuals Sun Jul 26 20:04:48 2015 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,115 +0,0 @@
-#!/bin/sh
-#======================================================================
-# L W P L O T _ R E S I D U A L S
-# doc: Sat Oct 15 13:42:50 2011
-# dlm: Wed May 20 20:46:41 2015
-# (c) 2011 A.M. Thurnherr
-# uE-Info: 50 0 NIL 0 0 72 0 2 4 NIL ofnI
-#======================================================================
-
-# HISTORY:
-# Oct 15, 2011: - created
-# Oct 17, 2011: - turned into filter
-# - added %run_label
-# Oct 24, 2011: - LADCP_bin_length => ADCP_bin_length
-# Nov 14, 2011: - added file layout check
-# Mar 12, 2012: - sh -> ksh as this does not work with /bin/sh on MacOSX 10.6.4
-# Apr 12, 2012: - made re-entrant
-# Apr 5, 2015: - made fixbb optional
-# Apr 16, 2015: - removed copy of input on stdout
-# - changed shell from /bin/ksh to /bin/sh
-# - added seabed if available
-# May 20, 2015: - made it quit on EOF
-
-#--------------------------------------------------
-# Usage
-#--------------------------------------------------
-
-USAGE="Usage: $0 <eps-file> [in-file]"
- [ $# -eq 2 ] && exec <"$2" "$0" "$1"
- [ $# -ne 1 ] && { echo $USAGE >&2; exit 1; }
-eps_file="$1"
-
-#--------------------------------------------------
-# Read Header Data
-#--------------------------------------------------
-
-read line
-while [ -z "$fields" -a -n "$line" ]
-do
- [ -z "$out_basename" ] && out_basename=`expr -- "$line" : '#ANTS#PARAMS#.*out_basename{\([^}]*\)}`
- [ -z "$run_label" ] && run_label=`expr -- "$line" : '#ANTS#PARAMS#.*run_label{\([^}]*\)}`
- [ -z "$min_depth" ] && min_depth=`expr -- "$line" : '#ANTS#PARAMS#.*min_depth{\([^}]*\)}`
- [ -z "$max_depth" ] && max_depth=`expr -- "$line" : '#ANTS#PARAMS#.*max_depth{\([^}]*\)}`
- [ -z "$water_depth" ] && water_depth=`expr -- "$line" : '#ANTS#PARAMS#.*water_depth{\([^}]*\)}`
- [ -z "$min_ens" ] && min_ens=`expr -- "$line" : '#ANTS#PARAMS#.*min_ens{\([^}]*\)}`
- [ -z "$max_ens" ] && max_ens=`expr -- "$line" : '#ANTS#PARAMS#.*max_ens{\([^}]*\)}`
- [ -z "$ADCP_bin_length" ] && ADCP_bin_length=`expr -- "$line" : '#ANTS#PARAMS#.*ADCP_bin_length{\([^}]*\)}`
- [ -z "$fields" ] && fields=`expr -- "$line" : '#ANTS#FIELDS# \(.*\)' | sed -e s/{//g -e s/}//g`
- read line
-done
-
-set -- $fields
-[ "$1" = ensemble -a "$4" = depth -a "${10}" = residual ] || {
- echo "$0: file layout error ($1, $4, ${10})" >&2
- exit 1
-}
-
-#--------------------------------------------------
-# Plot Data
-#--------------------------------------------------
-
-eps_file="$PWD/$eps_file" # make outfile name absolute (hopefully, it is not already...)
-mkdir /tmp/$$ # GMT makes tmpfiles and is not reentrant
-cd /tmp/$$
-
-TMPFILE=/tmp/$$.LWplot_residuals
-cat > $TMPFILE
-
-[ -f .gmtdefaults4 ] ||
- gmtset PAPER_MEDIA letter+ \
- LABEL_FONT_SIZE 14 ANNOT_FONT_SIZE_PRIMARY 14 \
- WANT_EURO_FONT true \
- PLOT_DEGREE_FORMAT ddd:mm:ssF
-
-[ -n "$water_depth" ] && blim=`echo "scale=1;$water_depth+25"|bc` \
- || blim=`echo "scale=1;$max_depth+$ADCP_bin_length"|bc`
-R=-R`echo "scale=1;$min_ens-0.5"|bc`/`echo "scale=1;$max_ens+0.5"|bc`/0/$blim
-U=-R0/1/0/1
-X=-JX10/-10
-C=-C`which LWplot_residuals | sed 's@LWplot_residuals$@residuals.cpt@'`
-
-ens_width=`echo "scale=5;10/($max_ens-$min_ens+1)"|bc`
-bin_length=`echo "scale=5;10*$ADCP_bin_length/($max_depth-$min_depth+$ADCP_bin_length)"|bc`
-
-awk "{print \$1, \$4, \$10, $ens_width, $bin_length}" $TMPFILE \
- | psxy -P -K $R $X $C -Sr > "$eps_file"
-[ -n "$water_depth" ] && {
- echo $min_ens $blim;
- echo $max_ens $blim;
- echo $max_ens $water_depth;
- echo $min_ens $water_depth;
-} | psxy -O -K $R $X -G204/153/102 >> "$eps_file"
-
-echo 0.02 0.02 12 0 0 TL $out_basename $run_label | pstext -O -K $U $X >> "$eps_file"
-
-if [ 0 -eq `echo "($max_depth-$min_depth)>1000"|bc` ]
-then
- depth_tics=f10a100
- ens_tics=f50a500
-else
- depth_tics=f100a500
- ens_tics=f500a1000
-fi
-
-psbasemap -O -K $R $X -B$ens_tics:"Ensemble":/$depth_tics:"Depth [m]":WeSn >> "$eps_file"
-
-gmtset ANNOT_FONT_SIZE_PRIMARY 7
-psscale -O -E -D8/2/3/0.4 $C -B/:residuals: >> "$eps_file"
-
-rm $TMPFILE
-[ -n "`which fixbb`" ] && fixbb "$eps_file"
-
-cd "$PWD"
-rm -rf /tmp/$$
-
--- a/LWplot_spec Sun Jul 26 20:04:48 2015 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,135 +0,0 @@
-#!/bin/sh
-#======================================================================
-# L W P L O T _ S P E C
-# doc: Thu Sep 5 18:23:41 2013
-# dlm: Wed May 20 20:47:00 2015
-# (c) 2013 A.M. Thurnherr
-# uE-Info: 44 0 NIL 0 0 72 2 2 4 NIL ofnI
-#======================================================================
-
-# NB: THIS PLOTTING ROUTINE REQUIRES NON-PUBLIC ANTS TOOLS
-
-# HISTORY:
-# Sep 5, 2013: - created from LWplot_prof
-# Oct 30, 2103: - got rid of non-portable echo -e
-# Nov 6, 2013: - add interpolation of missing values
-# Jul 12, 2013: - added a -N to pgram to make it work with partial-depth casts
-# Apr 5, 2015: - made fixbb optional
-# Apr 16, 2015: - removed copy of input on stdout
-# - changed shell from /bin/ksh to /bin/sh
-# May 20, 2015: - made it quit on EOF
-
-#--------------------------------------------------
-# Usage
-#--------------------------------------------------
-
-USAGE="Usage: $0 <eps-file> [in-file]"
- [ $# -eq 2 ] && exec <"$2" "$0" "$1"
- [ $# -ne 1 ] && { echo $USAGE >&2; exit 1; }
-eps_file="$1"
-
-#--------------------------------------------------
-# Read Header Data
-#--------------------------------------------------
-
-read line
-while [ -z "$fields" -a -n "$line" ]
-do
- [ -z "$out_basename" ] && out_basename=`expr -- "$line" : '#ANTS#PARAMS#.*out_basename{\([^}]*\)}`
- [ -z "$run_label" ] && run_label=`expr -- "$line" : '#ANTS#PARAMS#.*run_label{\([^}]*\)}`
- [ -z "$min_depth" ] && min_depth=`expr -- "$line" : '#ANTS#PARAMS#.*min_depth{\([^}]*\)}`
- [ -z "$max_depth" ] && max_depth=`expr -- "$line" : '#ANTS#PARAMS#.*max_depth{\([^}]*\)}`
- [ -z "$fields" ] && fields=`expr -- "$line" : '#ANTS#FIELDS# \(.*\)' | sed -e s/{//g -e s/}//g`
- read line
-done
-
-set -- $fields
-[ "$1" = depth -a "$4" = dc_w -a "$5" = dc_w.mad -a "$6" = dc_w.nsamp -a \
- "${11}" = uc_w -a "${12}" = uc_w.mad -a "${13}" = uc_w.nsamp ] || {
- echo "$0: file layout error" >&2
- exit 1
-}
-
-#--------------------------------------------------
-# Plot Data
-#--------------------------------------------------
-
-eps_file="$PWD/$eps_file" # make outfile name absolute (hopefully, it is not already...)
-mkdir /tmp/$$ # GMT makes tmpfiles and is not reentrant
-cd /tmp/$$
-
-TMPFILE=/tmp/$$.LWplot_spec
-cat > $TMPFILE
-
-[ -f .gmtdefaults4 ] ||
- gmtset PAPER_MEDIA letter+ \
- LABEL_FONT_SIZE 14 ANNOT_FONT_SIZE_PRIMARY 14 \
- WANT_EURO_FONT true \
- PLOT_DEGREE_FORMAT ddd:mm:ssF
-
-R=-R10/2000/1e-6/0.1
-U=-R0/1/0/1
-X=-JX10l
-
-# 1 & 3MM/S ERROR LEVELS
-err=`awk '{print $4, $1}' $TMPFILE |
- fillgaps -Qi linear -f '$1' '$2' |
- pgram -N'$1' -S'$2>80' -b4 -d '$2' '$1' 2>/dev/null |
- list -Q =1e-6/%pgram_resolution_bandwidth`
-{ echo 15 $err; echo 500 $err; } | psxy -P -X4 -K $R $X > "$eps_file"
-echo 500 $err 10 0 0 ML 1mm s@+-1@+ | pstext -O -K $R $X >> "$eps_file"
-err=`abc "9*$err"`
-{ echo 15 $err; echo 500 $err; } | psxy -O -K $R $X >> "$eps_file"
-echo 500 $err 10 0 0 ML 3mm s@+-1@+ | pstext -O -K $R $X >> "$eps_file"
-
-# EPS PARAMETERIZATION
-c1=`abc '10**(-1.754)/(4*$pi**2)'`
-l1=20; l2=1000; eps=-10;
-{ echo $l1 `abc "$c1*sqrt(1e$eps)*$l1**2"`; echo $l2 `abc "$c1*sqrt(1e$eps)*$l2**2"`; } |
- psxy -O -K $R $X -W2/blue >> "$eps_file"
-echo `abc $l1*0.99` `abc "$c1*sqrt(1e$eps)*$l1**2"` 10 0 0 MR 10@+$eps@+ |
- pstext -O -K $R $X -Gblue >> "$eps_file"
-echo `abc $l1*1.13` `abc "$c1*sqrt(1e$eps)*$l1**2"` 10 0 0 ML W kg@+-1@+ |
- pstext -O -K $R $X -Gblue >> "$eps_file"
-l1=20; l2=1000; eps=-9;
-{ echo $l1 `abc "$c1*sqrt(1e$eps)*$l1**2"`; echo $l2 `abc "$c1*sqrt(1e$eps)*$l2**2"`; } |
- psxy -O -K $R $X -W2/blue >> "$eps_file"
-echo `abc $l1*0.99` `abc "$c1*sqrt(1e$eps)*$l1**2"` 10 0 0 MR 10@+$eps@+ |
- pstext -O -K $R $X -Gblue >> "$eps_file"
-l1=20; l2=1000; eps=-8;
-{ echo $l1 `abc "$c1*sqrt(1e$eps)*$l1**2"`; echo $l2 `abc "$c1*sqrt(1e$eps)*$l2**2"`; } |
- psxy -O -K $R $X -W2/blue >> "$eps_file"
-echo `abc $l1*0.99` `abc "$c1*sqrt(1e$eps)*$l1**2"` 10 0 0 MR 10@+$eps@+ |
- pstext -O -K $R $X -Gblue >> "$eps_file"
-l1=20; l2=1000; eps=-7;
-{ echo $l1 `abc "$c1*sqrt(1e$eps)*$l1**2"`; echo $l2 `abc "$c1*sqrt(1e$eps)*$l2**2"`; } |
- psxy -O -K $R $X -W2/blue >> "$eps_file"
-echo `abc $l1*0.99` `abc "$c1*sqrt(1e$eps)*$l1**2"` 10 0 0 MR 10@+$eps@+ |
- pstext -O -K $R $X -Gblue >> "$eps_file"
-l1=20; l2=1000; eps=-6;
-{ echo $l1 `abc "$c1*sqrt(1e$eps)*$l1**2"`; echo $l2 `abc "$c1*sqrt(1e$eps)*$l2**2"`; } |
- psxy -O -K $R $X -W2/blue >> "$eps_file"
-echo `abc $l1*0.99` `abc "$c1*sqrt(1e$eps)*$l1**2"` 10 0 0 MR 10@+$eps@+ |
- pstext -O -K $R $X -Gblue >> "$eps_file"
-
-# SPECTRA
-awk '{print $4, $1}' $TMPFILE |
- fillgaps -Qi linear -f '$1' '$2' |
- pgram -N'$1' -S'$2>80' -b4 -dQFT,pwrdens '$2' '$1' |
- psxy -O -K -N -Mn $R $X -W8/coral >> "$eps_file"
-awk '{print $11,$1}' $TMPFILE |
- fillgaps -Qi linear -f '$1' '$2' |
- pgram -N'$1' -S'$2>80' -b4 -dQFT,pwrdens '$2' '$1' |
- psxy -O -K -N -Mn $R $X -W8/SeaGreen >> "$eps_file"
-
-# LABELS
-echo 0.98 0.05 12 0 0 TR $out_basename $run_label | pstext -O -K $U -JX10/10 >> "$eps_file"
-
-psbasemap -O -K $R $X -Bf3a2:"Vertical Wavelength [m]":/f3a1:"w Power Density [m@+2@+s@+-2@+/(rad m@+-1@+)]":WeSn >> "$eps_file"
-
-rm $TMPFILE
-[ -n "`which fixbb`" ] && fixbb "$eps_file"
-
-cd "$PWD"
-rm -rf /tmp/$$
-
--- a/LWplot_w Sun Jul 26 20:04:48 2015 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,118 +0,0 @@
-#!/bin/sh
-#======================================================================
-# L W P L O T _ W
-# doc: Sat Oct 15 13:42:50 2011
-# dlm: Wed May 20 20:47:23 2015
-# (c) 2011 A.M. Thurnherr
-# uE-Info: 52 0 NIL 0 0 72 2 2 4 NIL ofnI
-#======================================================================
-
-# HISTORY:
-# Oct 15, 2011: - created
-# Oct 17, 2011: - turned into filter
-# - added %run_label
-# Oct 19, 2011: - fiddled
-# Oct 24, 2011: - LADCP_bin_length => ADCP_bin_length
-# Nov 14, 2011: - added file layout check
-# Mar 12, 2012: - sh -> ksh as this does not work with /bin/sh on MacOSX 10.6.4
-# Apr 12, 2012: - made re-entrant
-# Apr 5, 2015: - made fixbb optional
-# Apr 16, 2015: - removed copy of input on stdout
-# - changed shell from /bin/ksh to /bin/sh
-# - added seabed if available
-# Apr 20, 2015: - removed _skel dependence
-# May 20, 2015: - made it quit on EOF
-
-#--------------------------------------------------
-# Usage
-#--------------------------------------------------
-
-USAGE="Usage: $0 <eps-file> [in-file]"
- [ $# -eq 2 ] && exec <"$2" "$0" "$1"
- [ $# -ne 1 ] && { echo $USAGE >&2; exit 1; }
-eps_file="$1"
-
-#--------------------------------------------------
-# Read Header Data
-#--------------------------------------------------
-
-read line
-while [ -z "$fields" -a -n "$line" ]
-do
- [ -z "$out_basename" ] && out_basename=`expr -- "$line" : '#ANTS#PARAMS#.*out_basename{\([^}]*\)}`
- [ -z "$run_label" ] && run_label=`expr -- "$line" : '#ANTS#PARAMS#.*run_label{\([^}]*\)}`
- [ -z "$min_depth" ] && min_depth=`expr -- "$line" : '#ANTS#PARAMS#.*min_depth{\([^}]*\)}`
- [ -z "$max_depth" ] && max_depth=`expr -- "$line" : '#ANTS#PARAMS#.*max_depth{\([^}]*\)}`
- [ -z "$water_depth" ] && water_depth=`expr -- "$line" : '#ANTS#PARAMS#.*water_depth{\([^}]*\)}`
- [ -z "$min_ens" ] && min_ens=`expr -- "$line" : '#ANTS#PARAMS#.*min_ens{\([^}]*\)}`
- [ -z "$max_ens" ] && max_ens=`expr -- "$line" : '#ANTS#PARAMS#.*max_ens{\([^}]*\)}`
- [ -z "$ADCP_bin_length" ] && ADCP_bin_length=`expr -- "$line" : '#ANTS#PARAMS#.*ADCP_bin_length{\([^}]*\)}`
- [ -z "$fields" ] && fields=`expr -- "$line" : '#ANTS#FIELDS# \(.*\)' | sed -e s/{//g -e s/}//g`
- read line
-done
-
-set -- $fields
-[ "$1" = ensemble -a "$4" = depth -a "$7" = w ] || {
- echo "$0: file layout error" >&2
- exit 1
-}
-
-#--------------------------------------------------
-# Plot Data
-#--------------------------------------------------
-
-eps_file="$PWD/$eps_file" # make outfile name absolute (hopefully, it is not already...)
-mkdir /tmp/$$ # GMT makes tmpfiles and is not reentrant
-cd /tmp/$$
-
-TMPFILE=/tmp/$$.LWplot_w
-cat > $TMPFILE
-
-[ -f .gmtdefaults4 ] ||
- gmtset PAPER_MEDIA letter+ \
- LABEL_FONT_SIZE 14 ANNOT_FONT_SIZE_PRIMARY 14 \
- WANT_EURO_FONT true \
- PLOT_DEGREE_FORMAT ddd:mm:ssF
-
-[ -n "$water_depth" ] && blim=`echo "scale=1;$water_depth+25"|bc` \
- || blim=`echo "scale=1;$max_depth+$ADCP_bin_length"|bc`
-R=-R`echo "scale=1;$min_ens-0.5"|bc`/`echo "scale=1;$max_ens+0.5"|bc`/0/$blim
-
-U=-R0/1/0/1
-X=-JX10/-10
-C=-C`which LWplot_w | sed 's@LWplot_w$@w.cpt@'`
-
-ens_width=`echo "scale=5;10/($max_ens-$min_ens+1)"|bc`
-bin_length=`echo "scale=5;10*$ADCP_bin_length/($max_depth-$min_depth+$ADCP_bin_length)"|bc`
-
-awk "{print \$1, \$4, \$7, $ens_width, $bin_length}" $TMPFILE \
- | psxy -P -K $R $X $C -Sr > "$eps_file"
-[ -n "$water_depth" ] && {
- echo $min_ens $blim;
- echo $max_ens $blim;
- echo $max_ens $water_depth;
- echo $min_ens $water_depth;
-} | psxy -O -K $R $X -G204/153/102 >> "$eps_file"
-
-echo 0.02 0.02 12 0 0 TL $out_basename $run_label | pstext -O -K $U $X >> "$eps_file"
-
-if [ 0 -eq `echo "($max_depth-$min_depth)>1000"|bc` ]
-then
- depth_tics=f10a100
- ens_tics=f50a500
-else
- depth_tics=f100a500
- ens_tics=f500a1000
-fi
-
-psbasemap -O -K $R $X -B$ens_tics:"Ensemble":/$depth_tics:"Depth [m]":WeSn >> "$eps_file"
-
-gmtset ANNOT_FONT_SIZE_PRIMARY 7
-psscale -O -E -D8/2/3/0.4 $C -B/:w: >> "$eps_file"
-
-rm $TMPFILE
-[ -n "`which fixbb`" ] && fixbb "$eps_file"
-
-cd "$PWD"
-rm -rf /tmp/$$
-
--- a/defaults.pl Sun Jul 26 20:04:48 2015 +0000
+++ b/defaults.pl Thu Jul 30 09:11:43 2015 +0000
@@ -1,9 +1,9 @@
#======================================================================
# D E F A U L T S . P L
# doc: Tue Oct 11 17:11:21 2011
-# dlm: Sun Jul 26 17:12:51 2015
+# dlm: Wed Jul 29 07:19:25 2015
# (c) 2011 A.M. Thurnherr
-# uE-Info: 379 12 NIL 0 0 72 0 2 4 NIL ofnI
+# uE-Info: 438 69 NIL 0 0 72 0 2 4 NIL ofnI
#======================================================================
# HISTORY:
@@ -52,9 +52,12 @@
# - decreased default verbosity
# May 15, 2015: - added $min_valid_vels
# May 20, 2015: - STN -> PROF
-# Jul 23, 2015: - began adaptation to libGMT.pl
+# Jul 26, 2015: - began adaptation to libGMT.pl
# - changed .prof output .wprof
# - -v docu was wrong
+# - added $outGrid_firstBin, $outGrid_lastBin
+# Jul 28, 2015: - implemented new plotting system
+# Jul 29, 2015: - implemented new plotting system
#======================================================================
# Data Input
@@ -105,16 +108,6 @@
&antsCardOpt(\$opt_v,1);
-# output bin size in meters
-
-&antsFloatOpt(\$opt_o,10);
-
-
-# min w samples required for each vertical-velocity bin
-
-&antsCardOpt(\$opt_k,20);
-
-
# output base name
$out_basename = sprintf('%03d',$PROF);
@@ -126,6 +119,26 @@
$data_subdir = $plot_subdir = $log_subdir = $RUN;
+# min w samples required for each vertical-velocity bin
+# - value recorded in %outgrid_minsamp and used by [LADCP_w_regrid]
+
+&antsCardOpt(\$opt_k,20);
+
+
+# output grid resolution in meters
+# - value recorded in %outgrid_dz and used by [LADCP_w_regrid]
+
+&antsFloatOpt(\$opt_o,10);
+
+
+# the following variables limit the bins used to grid w_oean
+# - in contrast to -b, the other bins are still used e.g. for BT
+# - values recorded in %outgrid_firstbin, %outgrid_lastbin
+
+$outGrid_firstBin = 0;
+$outGrid_lastBin = 999;
+
+
#======================================================================
# Data Editing
#======================================================================
@@ -388,17 +401,17 @@
# Data:
# *.samp w sample data
# Standard Plots:
-# *_w.eps vertical velocity time-depth plot
-# *_residuals.eps residual vertical velocity time-depth plot
-# *_Sv.eps volume scattering coefficient time-depth plot
+# *_w.ps vertical velocity time-depth plot
+# *_residuals.ps residual vertical velocity time-depth plot
+# *_backscatter.ps volume scattering coefficient time-depth plot
# Optional Plots:
-# *_corr.eps correlation time-depth plot [REMOVED FROM DEFAULTS 2013/05/16]
+# *_correlation.ps correlation time-depth plot
#----------------------------------------------------------------------
-@out_w = ("| LWplot_residuals $plot_subdir/${out_basename}_residuals.eps",
- "| LWplot_Sv $plot_subdir/${out_basename}_Sv.eps",
-# "| LWplot_corr $plot_subdir/${out_basename}_corr.eps",
- "| LWplot_w $plot_subdir/${out_basename}_w.eps",
+@out_w = ("plot_residuals($plot_subdir/${out_basename}_residuals.ps)",
+ "plot_backscatter($plot_subdir/${out_basename}_backscatter.ps)",
+# "plot_correlation($plot_subdir/${out_basename}_correlation.ps)",
+ "plot_w($plot_subdir/${out_basename}_w.ps)",
"$data_subdir/$out_basename.samp");
@@ -407,25 +420,21 @@
# Data:
# *.tis combined CTD/LADCP time-series data, including
# package- and LADCP reference layer w
-# Optional Plots:
-# *_CAE.eps plot of CTD acceleration effects on reference-layer w
#----------------------------------------------------------------------
-@out_timeseries = (
-# "| LWplot_CAE $plot_subdir/${out_basename}_CAE.eps",
- "$data_subdir/$out_basename.tis");
+@out_timeseries = ("$data_subdir/$out_basename.tis");
#----------------------------------------------------------------------
# Per-bin vertical-velocity residuals (plot only)
#----------------------------------------------------------------------
-@out_BR = ("| LWplot_BR $plot_subdir/${out_basename}_BR.eps");
+@out_BR = ("plot_mean_residuals($plot_subdir/${out_basename}_mean_residuals.ps)");
#----------------------------------------------------------------------
# Time-lagging correlation statistics (plot only)
#----------------------------------------------------------------------
-@out_TL = ("| LWplot_TL $plot_subdir/${out_basename}_TL.eps");
+@out_TL = ("plot_time_lags($plot_subdir/${out_basename}_time_lags.ps)");
1; # return true
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/plot_backscatter.pl Thu Jul 30 09:11:43 2015 +0000
@@ -0,0 +1,67 @@
+#======================================================================
+# P L O T _ B A C K S C A T T E R . P L
+# doc: Tue Jul 28 13:21:09 2015
+# dlm: Wed Jul 29 07:13:33 2015
+# (c) 2015 A.M. Thurnherr
+# uE-Info: 59 45 NIL 0 0 72 0 2 4 NIL ofnI
+#======================================================================
+
+# HISTORY:
+# Jul 28, 2015: - created from [LWplot_Sv]
+
+require "$ANTS/libGMT.pl";
+
+sub plot_backscatter($)
+{
+ my($pfn) = @_;
+
+ my($xmin) = $P{min_ens}-0.5;
+ my($xmax) = $P{max_ens}+0.5;
+ my($ymin) = 0;
+ my($ymax) = ($P{water_depth} > 0) ?
+ round($P{water_depth} + 25) :
+ round($P{max_depth} + $P{ADCP_bin_length});
+
+ my($ens_width) = 10 / ($P{max_ens} - $P{min_ens} + 1);
+ my($bin_length) = 10 * $P{ADCP_bin_length} /
+ ($P{max_depth}-$P{min_depth}+$P{ADCP_bin_length});
+
+ my($R) = "-R$xmin/$xmax/$ymin/$ymax";
+ GMT_begin($pfn,'-JX10/-10',$R,'-P');
+
+ my($C) = "-C$WCALC/Sv.cpt";
+ GMT_psxy("$C -Sr");
+ for ($ens=$firstGoodEns; $ens<=$realLastGoodEns; $ens++) {
+ next unless numberp($LADCP{ENSEMBLE}[$ens]->{CTD_DEPTH});
+ my(@bindepth) = calc_binDepths($ens);
+ for ($bin=$LADCP_firstBin-1; $bin<=$LADCP_lastBin-1; $bin++) {
+ next unless numberp($LADCP{ENSEMBLE}[$ens]->{W}[$bin]);
+ my($bi) = $bindepth[$bin]/$opt_o;
+ printf(GMT "%d %f %f $ens_width $bin_length\n",
+ $LADCP{ENSEMBLE}[$ens]->{NUMBER},
+ $bindepth[$bin],
+ $LADCP{ENSEMBLE}[$ens]->{SV}[$bin]);
+ }
+ }
+
+ if ($P{water_depth} > 0) { # SEABED
+ GMT_psxy('-G204/153/102');
+ print(GMT "$xmin $ymax\n$xmax $ymax\n$xmax $P{water_depth}\n $xmin $P{water_depth}\n");
+ }
+
+ GMT_unitcoords(); # LABELS
+ GMT_pstext(-Gblue);
+ print(GMT "0.02 0.98 12 0 0 BL $P{out_basename} $P{run_label}\n");
+
+ my($depth_tics) = ($ymax < 1000 ) ? 'f10a100' : 'f100a500'; # AXES
+ my($ens_tics) = ($ymax < 1000 ) ? 'f50a500' : 'f500a1000';
+ GMT_setR($R);
+ GMT_psbasemap("-B$ens_tics:'Ensemble [#]':/$depth_tics:'Depth [m]':WeSn");
+
+ GMT_setAnnotFontSize(7); # SCALE BAR
+ GMT_psscale("-E -D8/2/3/0.4 $C -B/:S\@-v\@-:");
+
+ GMT_end(); # FINISH PLOT
+}
+
+1; # return true on require
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/plot_correlation.pl Thu Jul 30 09:11:43 2015 +0000
@@ -0,0 +1,67 @@
+#======================================================================
+# P L O T _ C O R R E L A T I O N . P L
+# doc: Tue Jul 28 13:21:09 2015
+# dlm: Wed Jul 29 07:13:45 2015
+# (c) 2015 A.M. Thurnherr
+# uE-Info: 59 45 NIL 0 0 72 0 2 4 NIL ofnI
+#======================================================================
+
+# HISTORY:
+# Jul 28, 2015: - created from [LWplot_corr]
+
+require "$ANTS/libGMT.pl";
+
+sub plot_correlation($)
+{
+ my($pfn) = @_;
+
+ my($xmin) = $P{min_ens}-0.5;
+ my($xmax) = $P{max_ens}+0.5;
+ my($ymin) = 0;
+ my($ymax) = ($P{water_depth} > 0) ?
+ round($P{water_depth} + 25) :
+ round($P{max_depth} + $P{ADCP_bin_length});
+
+ my($ens_width) = 10 / ($P{max_ens} - $P{min_ens} + 1);
+ my($bin_length) = 10 * $P{ADCP_bin_length} /
+ ($P{max_depth}-$P{min_depth}+$P{ADCP_bin_length});
+
+ my($R) = "-R$xmin/$xmax/$ymin/$ymax";
+ GMT_begin($pfn,'-JX10/-10',$R,'-P');
+
+ my($C) = "-C$WCALC/corr.cpt";
+ GMT_psxy("$C -Sr");
+ for ($ens=$firstGoodEns; $ens<=$realLastGoodEns; $ens++) {
+ next unless numberp($LADCP{ENSEMBLE}[$ens]->{CTD_DEPTH});
+ my(@bindepth) = calc_binDepths($ens);
+ for ($bin=$LADCP_firstBin-1; $bin<=$LADCP_lastBin-1; $bin++) {
+ next unless numberp($LADCP{ENSEMBLE}[$ens]->{W}[$bin]);
+ my($bi) = $bindepth[$bin]/$opt_o;
+ printf(GMT "%d %f %f $ens_width $bin_length\n",
+ $LADCP{ENSEMBLE}[$ens]->{NUMBER},
+ $bindepth[$bin],
+ $LADCP{ENSEMBLE}[$ens]->{CORRELATION}[$bin]);
+ }
+ }
+
+ if ($P{water_depth} > 0) { # SEABED
+ GMT_psxy('-G204/153/102');
+ print(GMT "$xmin $ymax\n$xmax $ymax\n$xmax $P{water_depth}\n $xmin $P{water_depth}\n");
+ }
+
+ GMT_unitcoords(); # LABELS
+ GMT_pstext(-Gblue);
+ print(GMT "0.02 0.98 12 0 0 BL $P{out_basename} $P{run_label}\n");
+
+ my($depth_tics) = ($ymax < 1000 ) ? 'f10a100' : 'f100a500'; # AXES
+ my($ens_tics) = ($ymax < 1000 ) ? 'f50a500' : 'f500a1000';
+ GMT_setR($R);
+ GMT_psbasemap("-B$ens_tics:'Ensemble [#]':/$depth_tics:'Depth [m]':WeSn");
+
+ GMT_setAnnotFontSize(7); # SCALE BAR
+ GMT_psscale("-E -D8/2/3/0.4 $C -B/:corr:");
+
+ GMT_end(); # FINISH PLOT
+}
+
+1; # return true on require
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/plot_mean_residuals.pl Thu Jul 30 09:11:43 2015 +0000
@@ -0,0 +1,63 @@
+#======================================================================
+# P L O T _ M E A N _ R E S I D U A L S . P L
+# doc: Tue Jul 28 13:21:09 2015
+# dlm: Wed Jul 29 14:13:08 2015
+# (c) 2015 A.M. Thurnherr
+# uE-Info: 61 0 NIL 0 0 72 2 2 4 NIL ofnI
+#======================================================================
+
+# HISTORY:
+# Jul 28, 2015: - created from [LWplot_BR]
+# Jul 29, 2015: - finished
+
+require "$ANTS/libGMT.pl";
+
+sub plot_mean_residuals($)
+{
+ my($pfn) = @_;
+
+ my($xmin) = -0.05;
+ my($xmax) = 0.05;
+ my($ymin) = 0.5;
+ my($ymax) = $P{BR_max_bin} + 0.5;
+
+ my($R) = "-R$xmin/$xmax/$ymin/$ymax";
+ GMT_begin($pfn,'-JX10/-10',$R,'-P');
+
+ GMT_psxy('-W1');
+ printf(GMT "0 $ymin\n0 $ymax\n");
+
+ GMT_psxy('-Mn -W4/coral');
+ for (my($bin)=0; $bin<scalar(@dc_bres); $bin++) {
+ printf(GMT "%f %d\n",$dc_avg_bres[$bin],$bin+1);
+ }
+ GMT_psxy('-Mn -Ex0.2/4/coral');
+ for (my($bin)=0; $bin<scalar(@dc_bres); $bin++) {
+ printf(GMT "%f %d %f\n",
+ $dc_avg_bres[$bin],
+ $bin+1,
+ (scalar(@{$dc_bres[$bin]}) > 1) ?
+ $dc_sig_bres[$bin]/sqrt(scalar(@{$dc_bres[$bin]})-1) : 0);
+ }
+ GMT_psxy('-Mn -W4/SeaGreen');
+ for (my($bin)=0; $bin<scalar(@uc_bres); $bin++) {
+ printf(GMT "%f %d\n",$uc_avg_bres[$bin],$bin+1);
+ }
+ GMT_psxy('-Mn -Ex0.2/4/SeaGreen');
+ for (my($bin)=0; $bin<scalar(@uc_bres); $bin++) {
+ printf(GMT "%f %d %f\n",
+ $uc_avg_bres[$bin],
+ $bin+1,
+ (scalar(@{$uc_bres[$bin]}) > 1) ?
+ $uc_sig_bres[$bin]/sqrt(scalar(@{$uc_bres[$bin]})-1) : 0);
+ }
+
+ GMT_unitcoords(); # LABELS
+ GMT_pstext(-Gblue);
+ print(GMT "0.02 0.98 12 0 0 BL $P{out_basename} $P{run_label}\n");
+
+ GMT_setR($R); # FINISH PLOT
+ GMT_end('-Bf0.005a0.02:"Residual Vertical Velocity [m/s]":/f1a1:"Bin [#]":WeSn');
+}
+
+1; # return true on require
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/plot_residuals.pl Thu Jul 30 09:11:43 2015 +0000
@@ -0,0 +1,79 @@
+#======================================================================
+# P L O T _ R E S I D U A L S . P L
+# doc: Tue Jul 28 13:21:09 2015
+# dlm: Wed Jul 29 07:13:59 2015
+# (c) 2015 A.M. Thurnherr
+# uE-Info: 71 44 NIL 0 0 72 0 2 4 NIL ofnI
+#======================================================================
+
+# HISTORY:
+# Jul 28, 2015: - created from [LWplot_residuals]
+
+require "$ANTS/libGMT.pl";
+
+sub plot_residuals($)
+{
+ my($pfn) = @_;
+
+ my($xmin) = $P{min_ens}-0.5;
+ my($xmax) = $P{max_ens}+0.5;
+ my($ymin) = 0;
+ my($ymax) = ($P{water_depth} > 0) ?
+ round($P{water_depth} + 25) :
+ round($P{max_depth} + $P{ADCP_bin_length});
+
+ my($ens_width) = 10 / ($P{max_ens} - $P{min_ens} + 1);
+ my($bin_length) = 10 * $P{ADCP_bin_length} /
+ ($P{max_depth}-$P{min_depth}+$P{ADCP_bin_length});
+
+ my($R) = "-R$xmin/$xmax/$ymin/$ymax";
+ GMT_begin($pfn,'-JX10/-10',$R,'-P');
+
+ my($C) = "-C$WCALC/residuals.cpt";
+ GMT_psxy("$C -Sr");
+ for ($ens=$firstGoodEns; $ens<$LADCP_atbottom; $ens++) { # downcast
+ next unless numberp($LADCP{ENSEMBLE}[$ens]->{CTD_DEPTH});
+ my(@bindepth) = calc_binDepths($ens);
+ for ($bin=$LADCP_firstBin-1; $bin<=$LADCP_lastBin-1; $bin++) {
+ next unless numberp($LADCP{ENSEMBLE}[$ens]->{W}[$bin]);
+ my($bi) = $bindepth[$bin]/$opt_o;
+ printf(GMT "%d %f %f $ens_width $bin_length\n",
+ $LADCP{ENSEMBLE}[$ens]->{NUMBER},
+ $bindepth[$bin],
+ $LADCP{ENSEMBLE}[$ens]->{SSCORRECTED_OCEAN_W}[$bin] - $DNCAST{MEDIAN_W}[$bi]);
+ }
+ }
+ for ($ens=$LADCP_atbottom; $ens<=$realLastGoodEns; $ens++) { # upcast
+ next unless numberp($LADCP{ENSEMBLE}[$ens]->{CTD_DEPTH});
+ my(@bindepth) = calc_binDepths($ens);
+ for ($bin=$LADCP_firstBin-1; $bin<=$LADCP_lastBin-1; $bin++) {
+ next unless numberp($LADCP{ENSEMBLE}[$ens]->{W}[$bin]);
+ my($bi) = $bindepth[$bin]/$opt_o;
+ printf(GMT "%d %f %f $ens_width $bin_length\n",
+ $LADCP{ENSEMBLE}[$ens]->{NUMBER},
+ $bindepth[$bin],
+ $LADCP{ENSEMBLE}[$ens]->{SSCORRECTED_OCEAN_W}[$bin] - $UPCAST{MEDIAN_W}[$bi]);
+ }
+ }
+
+ if ($P{water_depth} > 0) { # SEABED
+ GMT_psxy('-G204/153/102');
+ print(GMT "$xmin $ymax\n$xmax $ymax\n$xmax $P{water_depth}\n $xmin $P{water_depth}\n");
+ }
+
+ GMT_unitcoords(); # LABELS
+ GMT_pstext(-Gblue);
+ print(GMT "0.02 0.98 12 0 0 BL $P{out_basename} $P{run_label}\n");
+
+ my($depth_tics) = ($ymax < 1000 ) ? 'f10a100' : 'f100a500'; # AXES
+ my($ens_tics) = ($ymax < 1000 ) ? 'f50a500' : 'f500a1000';
+ GMT_setR($R);
+ GMT_psbasemap("-B$ens_tics:'Ensemble [#]':/$depth_tics:'Depth [m]':WeSn");
+
+ GMT_setAnnotFontSize(7); # SCALE BAR
+ GMT_psscale("-E -D8/2/3/0.4 $C -B/:residuals:");
+
+ GMT_end(); # FINISH PLOT
+}
+
+1; # return true on require
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/plot_time_lags.pl Thu Jul 30 09:11:43 2015 +0000
@@ -0,0 +1,54 @@
+#======================================================================
+# P L O T _ T I M E _ L A G S . P L
+# doc: Tue Jul 28 13:21:09 2015
+# dlm: Wed Jul 29 14:47:57 2015
+# (c) 2015 A.M. Thurnherr
+# uE-Info: 39 30 NIL 0 0 72 2 2 4 NIL ofnI
+#======================================================================
+
+# HISTORY:
+# Jul 29, 2015: - created from [LWplot_TL]
+
+require "$ANTS/libGMT.pl";
+
+sub plot_time_lags($)
+{
+ my($pfn) = @_;
+
+ my($xmin) = $P{'elapsed.min'}/60;
+ my($xmax) = $P{'elapsed.max'}/60;
+ my($ymin) = -24;
+ my($ymax) = 24;
+
+ my($R) = "-R$xmin/$xmax/$ymin/$ymax";
+ GMT_begin($pfn,'-JX10',$R,'-P');
+
+ GMT_psxy('-Sc0.1 -Gcoral');
+ for (my($wi)=0; $wi<@elapsed_buf; $wi++) {
+ last unless ($elapsed_buf[$wi]<$LADCP{ENSEMBLE}[$LADCP_atbottom]->{ELAPSED});
+ printf(GMT "%f %f\n",$elapsed_buf[$wi]/60,$so_buf[$wi]);
+ }
+ GMT_psxy('-Sc0.1 -GSeaGreen');
+ for (my($wi)=0; $wi<@elapsed_buf; $wi++) {
+ next if ($elapsed_buf[$wi]<$LADCP{ENSEMBLE}[$LADCP_atbottom]->{ELAPSED});
+ printf(GMT "%f %f\n",$elapsed_buf[$wi]/60,$so_buf[$wi]);
+ }
+
+ my($fel) = $P{min_elapsed}; # from-elapsed limit
+ GMT_psxy('-W4/grey20 -M');
+ for (my($i)=0; $i<@bmo_buf; $i++) {
+ printf(GMT ">\n%f %f\n%f %f\n",
+ $fel/60, $bmo_buf[$i],
+ $te_buf[$i]/60+1,$bmo_buf[$i]);
+ $fel = $te_buf[$i];
+ }
+
+ GMT_unitcoords(); # LABELS
+ GMT_pstext(-Gblue);
+ print(GMT "0.02 0.02 12 0 0 BL $P{out_basename} $P{run_label}\n");
+
+ GMT_setR($R);
+ GMT_end('-Bf1a30:"Elapsed Time [min]":/f1a5:"Best Offset [scans]":WeSn'); # FINISH PLOT
+}
+
+1; # return true on require
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/plot_w.pl Thu Jul 30 09:11:43 2015 +0000
@@ -0,0 +1,67 @@
+#======================================================================
+# P L O T _ W . P L
+# doc: Tue Jul 28 13:21:09 2015
+# dlm: Wed Jul 29 07:14:28 2015
+# (c) 2015 A.M. Thurnherr
+# uE-Info: 59 45 NIL 0 0 72 0 2 4 NIL ofnI
+#======================================================================
+
+# HISTORY:
+# Jul 28, 2015: - created from [LWplot_w]
+
+require "$ANTS/libGMT.pl";
+
+sub plot_w($)
+{
+ my($pfn) = @_;
+
+ my($xmin) = $P{min_ens}-0.5;
+ my($xmax) = $P{max_ens}+0.5;
+ my($ymin) = 0;
+ my($ymax) = ($P{water_depth} > 0) ?
+ round($P{water_depth} + 25) :
+ round($P{max_depth} + $P{ADCP_bin_length});
+
+ my($ens_width) = 10 / ($P{max_ens} - $P{min_ens} + 1);
+ my($bin_length) = 10 * $P{ADCP_bin_length} /
+ ($P{max_depth}-$P{min_depth}+$P{ADCP_bin_length});
+
+ my($R) = "-R$xmin/$xmax/$ymin/$ymax";
+ GMT_begin($pfn,'-JX10/-10',$R,'-P');
+
+ my($C) = "-C$WCALC/w.cpt";
+ GMT_psxy("$C -Sr");
+ for ($ens=$firstGoodEns; $ens<=$realLastGoodEns; $ens++) {
+ next unless numberp($LADCP{ENSEMBLE}[$ens]->{CTD_DEPTH});
+ my(@bindepth) = calc_binDepths($ens);
+ for ($bin=$LADCP_firstBin-1; $bin<=$LADCP_lastBin-1; $bin++) {
+ next unless numberp($LADCP{ENSEMBLE}[$ens]->{W}[$bin]);
+ my($bi) = $bindepth[$bin]/$opt_o;
+ printf(GMT "%d %f %f $ens_width $bin_length\n",
+ $LADCP{ENSEMBLE}[$ens]->{NUMBER},
+ $bindepth[$bin],
+ $LADCP{ENSEMBLE}[$ens]->{SSCORRECTED_OCEAN_W}[$bin]);
+ }
+ }
+
+ if ($P{water_depth} > 0) { # SEABED
+ GMT_psxy('-G204/153/102');
+ print(GMT "$xmin $ymax\n$xmax $ymax\n$xmax $P{water_depth}\n $xmin $P{water_depth}\n");
+ }
+
+ GMT_unitcoords(); # LABELS
+ GMT_pstext(-Gblue);
+ print(GMT "0.02 0.98 12 0 0 BL $P{out_basename} $P{run_label}\n");
+
+ my($depth_tics) = ($ymax < 1000 ) ? 'f10a100' : 'f100a500'; # AXES
+ my($ens_tics) = ($ymax < 1000 ) ? 'f50a500' : 'f500a1000';
+ GMT_setR($R);
+ GMT_psbasemap("-B$ens_tics:'Ensemble [#]':/$depth_tics:'Depth [m]':WeSn");
+
+ GMT_setAnnotFontSize(7); # SCALE BAR
+ GMT_psscale("-E -D8/2/3/0.4 $C -B/:w:");
+
+ GMT_end(); # FINISH PLOT
+}
+
+1; # return true on require
--- a/time_lag.pl Sun Jul 26 20:04:48 2015 +0000
+++ b/time_lag.pl Thu Jul 30 09:11:43 2015 +0000
@@ -1,9 +1,9 @@
#======================================================================
# T I M E _ L A G . P L
# doc: Fri Dec 17 21:59:07 2010
-# dlm: Fri Jun 19 07:23:38 2015
+# dlm: Wed Jul 29 14:43:08 2015
# (c) 2010 A.M. Thurnherr
-# uE-Info: 61 10 NIL 0 0 72 2 2 4 NIL ofnI
+# uE-Info: 272 59 NIL 0 0 72 2 2 4 NIL ofnI
#======================================================================
# HISTORY:
@@ -59,6 +59,7 @@
# - croak -> error
# May 15, 2015: - fiddled with assertions
# Jun 19, 2015: - disabled L2 warning on partial-depth time-lagging failures
+# Jul 29, 2015: - support for new plotting system
# DIFFICULT STATIONS:
# NBP0901#131 this requires the search-radius doubling heuristic
@@ -126,7 +127,7 @@
{ # STATIC SCOPE
-my(@elapsed_buf,@so_buf,@mad_buf,@bmo_buf,@te_buf,$elapsed_min_buf);
+local(@elapsed_buf,@so_buf,@mad_buf,@bmo_buf,@te_buf,$elapsed_min_buf); # available to plot routines
sub calc_lag($$$$$)
{
@@ -274,6 +275,12 @@
foreach my $of (@out_TL) {
progress("<$of> ");
+ my($plot,$out) = ($of =~ /^([^\(]+)\(([^\)]+)\)$/); # plot_sub(out_file)
+ if (defined($out)) {
+ require "$WCALC/${plot}.pl";
+ &{$plot}($out);
+ next;
+ }
$of = ">$of" unless ($of =~ /^$|^\s*\|/);
open(STDOUT,$of) || error("$of: $!\n");
undef($antsActiveHeader) unless ($ANTS_TOOLS_AVAILABLE);