listBins
author A.M. Thurnherr <athurnherr@yahoo.com>
Sun, 12 Mar 2017 12:11:40 -0400
changeset 37 40d85448debf
parent 36 515b06dae59c
child 40 6a46e9d31106
permissions -rwxr-xr-x
V1.9
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
     1
#!/usr/bin/perl
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
     2
#======================================================================
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
     3
#                    L I S T B I N S 
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
     4
#                    doc: Fri Aug 25 15:57:05 2006
37
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 36
diff changeset
     5
#                    dlm: Fri Jan 27 17:41:10 2017
0
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
     6
#                    (c) 2006 A.M. Thurnherr
37
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 36
diff changeset
     7
#                    uE-Info: 68 81 NIL 0 0 72 2 2 4 NIL ofnI
0
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
     8
#======================================================================
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
     9
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
    10
# Split data file into per-bin time series.
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
    11
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
    12
# HISTORY:
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
    13
#	Aug 25, 2006: - created from [listEns]
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
    14
#	Aug 26, 2006: - added -M)agdecl
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
    15
#				  - changed -b to -f
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
    16
#	Aug 27, 2006: - added %bin
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
    17
#	Aug 28, 2006: - BUG: options were confused
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
    18
#	Jan  4, 2007: - improved usage message for -a
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
    19
#				  - added %mag_decl
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
    20
#				  - BUG: roundoff error in %pct_good_vels
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
    21
#	Sep 19, 2007: - adapted to new [RDI_BB_Read.pl]
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
    22
#	Feb  7, 2008: - added sound-speed correction
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
    23
#				  - enabled 3-beam solutions
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
    24
#	Feb  8, 2008: - added -d)iscard <beam>
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
    25
#				  - added -b)eam coordinate output
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
    26
#	Feb 12, 2008: - modified 3-beam output
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
    27
#				  - added -p)ct_good <min>
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
    28
#	Feb 13, 2008: - various improvements
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
    29
#	Feb 19, 2008: - BUG: division by zero
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
    30
#					BUG: min() did not work with 1st elt undef
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
    31
#	Feb 21, 2008: - BUG: had forgotten to undo debugging changes
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
    32
#				  - removed missing magdecl warning on -b
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
    33
#	Feb 22, 2008: - moved ssCorr() to [RDI_Utils.pl]
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
    34
#				  - BUG: %d complete ensembles was written to STDOUT
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
    35
#				  - BUG: %N_ensembles was total number of ensembles, not
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
    36
#						 only the ones used
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
    37
#				  - BUG: 0 errvel was output for 3-beam solutions =>
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
    38
#						 wrong time-average statistics
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
    39
#	May 19, 2009: - added -w to calculate vertical velocities from
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
    40
#					two beam pairs separately
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
    41
#	May 21, 2009: - added horizontal beampair velocities on -w
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
    42
#				  - -P)itchRoll <bias/bias>
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
    43
#	May 22, 2009: - added -B) <bias/bias/bias/bias>
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
    44
#	May 23, 2009: - adapted to changed beampair-velocity fun name
1
a3b6a908dec5 after P302 cruise
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents: 0
diff changeset
    45
#	Aug 22, 2010: - added -R
12
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 1
diff changeset
    46
#	Apr 29, 2013: - cosmetics
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 1
diff changeset
    47
#				  - added warning on missing -S
13
b176da8559b3 before implementing WBWens (PD0 writing)
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 12
diff changeset
    48
#	Aug  7, 2013: - BUG: -w did not respect -d
18
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 13
diff changeset
    49
#   Mar  4, 2014: - added support for missing PITCH/ROLL/HEADING
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 13
diff changeset
    50
#	Apr 22, 2014: - BUG: extraneous semicolon
21
0b5bbe60131c version sent to P16N
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 18
diff changeset
    51
#	Nov 24, 2014: - enabled -w always
23
fb0c269b1eaa V1.2 release candidate
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 21
diff changeset
    52
#	Mar 22, 2015: - replaced -f by -o (allowing for pipes)
24
1a761865f839 DoMORE-2
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 23
diff changeset
    53
#	Jun 16, 2015: - BUG: velocity bias code did not respect bad velocities
28
7c7da52363c2 transport version
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 24
diff changeset
    54
#	Jan  5, 2016: - adapted to [ANTS_tools_lib.pl]
7c7da52363c2 transport version
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 24
diff changeset
    55
#				  - adapted to calculation of w12, w34 from earth-coordinate data
7c7da52363c2 transport version
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 24
diff changeset
    56
#				  - several other changes to the code that should not affect the results
32
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 31
diff changeset
    57
#	Jan  6, 2016: - -b removed (always output beamvels)
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 31
diff changeset
    58
#	Jan 31, 2016: - started debugging the obviously wrong Earth2Beam() transformation
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 31
diff changeset
    59
#	Feb 29, 2016: - continued debugging; removed debugging code
33
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 32
diff changeset
    60
#   Mar 17, 2016: - adapted to new Getopt library
36
515b06dae59c version at end of ECOGIG EN586 cruise
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 33
diff changeset
    61
#	Jun  9, 2016: - minor improvements
515b06dae59c version at end of ECOGIG EN586 cruise
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 33
diff changeset
    62
#				  - BUG: velBeamToEarth() has new interface
37
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 36
diff changeset
    63
#	Jan 27, 2017: - BUG: earth-coordinate label was wrong
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 36
diff changeset
    64
#				  - changed semantics to include all %-good fields of earth-coordinate data
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 36
diff changeset
    65
#					and also report total pcg (3+4 beam) in min_pcg
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 36
diff changeset
    66
#				  - BUG: 3-beam %ages were incorrect: 1) they were based on goodvels instead of the
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 36
diff changeset
    67
#						 entire ensemble range; 2) pings-per-ensemble were not considered
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 36
diff changeset
    68
#				  - BUG: output layout was all messed up for non-valid velocities
0
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
    69
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
    70
# General Notes:
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
    71
#	- everything (e.g. beams) is numbered from 1
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
    72
#	- no support for BT data
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
    73
23
fb0c269b1eaa V1.2 release candidate
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 21
diff changeset
    74
# Post-Processing:
fb0c269b1eaa V1.2 release candidate
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 21
diff changeset
    75
#	- e.g. in a Makefile,
fb0c269b1eaa V1.2 release candidate
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 21
diff changeset
    76
#		BFILT = | list -Lconv ensemble elapsed dn12='str2dec_time(\$$date,\$$time,2012)' heading pitch roll temp u v w err_vel w12 w34 corr1 corr2 corr3 corr4 amp1 amp2 amp3 amp4 > `basename $@ .b1`.b%d
fb0c269b1eaa V1.2 release candidate
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 21
diff changeset
    77
#	- used as follows
fb0c269b1eaa V1.2 release candidate
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 21
diff changeset
    78
#		listBins -o "${BFILT}"
fb0c269b1eaa V1.2 release candidate
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 21
diff changeset
    79
#	- this writes only the interesting fields and calculates a 2012-referenced decimal day field
fb0c269b1eaa V1.2 release candidate
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 21
diff changeset
    80
0
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
    81
# Soundspeed Correction:
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
    82
#	- applied as described in the RDI coord-trans manual
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
    83
#	- sound-speed variation over range is ignored (valid for small gradients)
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
    84
#	=> - same simple correction for all velocity components
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
    85
#	   - simple correction for cell depths
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
    86
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
    87
# Min %-good (min_pcg):
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
    88
#	- nan for records w/o valid velocities
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
    89
#	- min(%-good) of the beams used for the velocity solution
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
    90
#	- min_pcg does not have to decrease monotonically with distance,
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
    91
#	  at least when 3-beam solutions are allowed and when -p is used to
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
    92
#	  edit the data
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
    93
#	- non-monotonic min_pcg is particularly obvious with the DYNAMUCK BM_ADCP
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
    94
#	  data, where one of the beams performed much worse than the others
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
    95
37
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 36
diff changeset
    96
# %-good of earth-coordinate data:
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 36
diff changeset
    97
#	pcg1	3-beam (correlation threshold)
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 36
diff changeset
    98
#	pcg2	bad (errvel threshold)
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 36
diff changeset
    99
#	pcg3	bad (>1 bad beam)
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 36
diff changeset
   100
#	pcg4	4-beam
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 36
diff changeset
   101
33
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 32
diff changeset
   102
use Getopt::Std;
28
7c7da52363c2 transport version
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 24
diff changeset
   103
7c7da52363c2 transport version
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 24
diff changeset
   104
$ADCP_tools_minVersion = 1.4;
7c7da52363c2 transport version
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 24
diff changeset
   105
($ADCP_TOOLS) = ($0 =~ m{(.*/)[^/]+});
7c7da52363c2 transport version
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 24
diff changeset
   106
require "$ADCP_TOOLS/ADCP_tools_lib.pl";
0
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
   107
1
a3b6a908dec5 after P302 cruise
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents: 0
diff changeset
   108
die("Usage: $0 [-r)ange <first_ens,last_ens>] [-R)enumber ensembles] " .
23
fb0c269b1eaa V1.2 release candidate
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 21
diff changeset
   109
			  "[-o)utput <redirection[>bin%d.raw]>] " .
fb0c269b1eaa V1.2 release candidate
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 21
diff changeset
   110
			  "[output -a)ll ens (not just those with good vels)] " .
0
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
   111
			  "[-M)agnetic <declination>] " .
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
   112
			  "[-S)oundspeed correction <salin|*,temp|*,depth|*> " .
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
   113
			  "[-P)itch/Roll <bias/bias>] [-B)eamvel <bias/bias/bias/bias>] " .
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
   114
		 	  "[require -4)-beam solutions] [-d)iscard <beam#>] " .
12
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 1
diff changeset
   115
		 	  "[-p)ct-good <min>] " .
0
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
   116
			  "<RDI file>\n")
33
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 32
diff changeset
   117
	unless (&getopts("4aB:d:M:o:p:r:P:RS:") && @ARGV == 1);
0
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
   118
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
   119
($P{pitch_bias},$P{roll_bias}) = split('[,/]',$opt_P);
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
   120
($P{velbias_b1},$P{velbias_b2},$P{velbias_b3},$P{velbias_b4}) = split('[,/]',$opt_B);
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
   121
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
   122
die("$0: -4 and -d are mutually exclusive\n")
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
   123
	if ($opt_4 && defined($opt_d));
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
   124
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
   125
$opt_p = 0 unless defined($opt_p);
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
   126
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
   127
$RDI_Coords::minValidVels = 4 if ($opt_4);			# no 3-beam solutions
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
   128
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
   129
print(STDERR "WARNING: magnetic declination not set!\n")
28
7c7da52363c2 transport version
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 24
diff changeset
   130
	unless defined($opt_M);
0
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
   131
23
fb0c269b1eaa V1.2 release candidate
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 21
diff changeset
   132
$opt_o = '>bin%d.raw' unless defined($opt_o);
0
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
   133
$ifn = $ARGV[0];
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
   134
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
   135
($first_ens,$last_ens) = split(',',$opt_r)
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
   136
	if defined($opt_r);
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
   137
12
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 1
diff changeset
   138
if (defined($opt_S)) {
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 1
diff changeset
   139
	($SS_salin,$SS_temp,$SS_depth) = split(',',$opt_S);
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 1
diff changeset
   140
	$variable_ssCorr = ($SS_salin eq '*' || $SS_temp eq '*' || $SS_depth eq '*');
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 1
diff changeset
   141
} else {
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 1
diff changeset
   142
	print(STDERR "WARNING: no soundspeed correction applied!\n");
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 1
diff changeset
   143
}
0
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
   144
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
   145
#----------------------------------------------------------------------
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
   146
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
   147
sub min(@)								# return minimum
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
   148
{
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
   149
	my($min) = 99e99;
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
   150
	for (my($i)=0; $i<=$#_; $i++) {
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
   151
		$min = $_[$i] if defined($_[$i]) && ($_[$i] < $min);
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
   152
	}
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
   153
	return ($min == 99e99) ? nan : $min;
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
   154
}
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
   155
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
   156
sub dumpBin($$$)						# write time series of single bin
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
   157
{
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
   158
	my($b,$fe,$le) = @_;
23
fb0c269b1eaa V1.2 release candidate
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 21
diff changeset
   159
	my($out) = sprintf($opt_o,$b+1);
0
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
   160
23
fb0c269b1eaa V1.2 release candidate
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 21
diff changeset
   161
	open(P,"$out") || die("$out: $!\n");
0
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
   162
	print(P "#ANTS#PARAMS# ");
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
   163
	foreach my $k (keys(%P)) {
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
   164
		print(P "$k\{$P{$k}\} ");
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
   165
	}
37
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 36
diff changeset
   166
	my($pct3b) = 100*$three_beam[$b]/(($le-$fe+1) * $dta{PINGS_PER_ENSEMBLE});
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 36
diff changeset
   167
	die("assertion failed: gv[$b] = $good_vels[$b]; 3b = $three_beam[$b]; ens=$fe..$le; ")
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 36
diff changeset
   168
		if ($pct3b > 100);
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 36
diff changeset
   169
	printf(STDERR "%02d:%.0f%%/%.0f%% ",$b+1,100*$good_vels[$b]/($le-$fe+1),$pct3b);
28
7c7da52363c2 transport version
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 24
diff changeset
   170
7c7da52363c2 transport version
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 24
diff changeset
   171
	printf(P "pct_3_beam{%.0f} ",$pct3b);
0
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
   172
	printf(P "pct_good_vels{%.0f} ",100*$good_vels[$b]/($le-$fe+1));
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
   173
	printf(P "bin{%d}",$b+1);
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
   174
	printf(P " soundspeed_correction{%s}",defined($opt_S) ? $opt_S : 'NONE!');
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
   175
	printf(P " dz{%g}",$dz[$b] *
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
   176
				(defined($opt_S) ? ssCorr($dta{ENSEMBLE}[$fe],$SS_salin,$SS_temp,$SS_depth) : 1)
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
   177
	) unless ($variable_ssCorr);
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
   178
	print( P "\n");
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
   179
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
   180
	print(P "#ANTS#FIELDS# " .
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
   181
			"{ensemble} {date} {time} {elapsed} " .
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
   182
			"{heading} {pitch} {roll} " .
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
   183
			"{sig_heading} {sig_pitch} {sig_roll} " .
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
   184
			"{xmit_current} {xmit_voltage} " .
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
   185
			"{temp} " .
28
7c7da52363c2 transport version
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 24
diff changeset
   186
			"{bv1} {bv2} {bv3} {bv4} {u} {v} {w} {err_vel} " .
21
0b5bbe60131c version sent to P16N
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 18
diff changeset
   187
			"{v12} {w12} {v34} {w34} " .
0
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
   188
			"{corr1} {corr2} {corr3} {corr4} " .
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
   189
			"{amp1} {amp2} {amp3} {amp4} " .
28
7c7da52363c2 transport version
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 24
diff changeset
   190
			"{pcg1} {pcg2} {pcg3} {pcg4} {3_beam} {min_pcg}"
0
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
   191
	);
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
   192
	print(P " {dz}") if ($variable_ssCorr);
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
   193
	print(P "\n");
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
   194
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
   195
	my($t0) = $dta{ENSEMBLE}[$fe]->{UNIX_TIME};
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
   196
	for (my($e)=$fe; $e<=$le; $e++) {
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
   197
		next unless ($opt_a || $dta{ENSEMBLE}[$e]->{GOOD_VEL}[$b]);
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
   198
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
   199
		my($ssCorr) = defined($opt_S) ? ssCorr($dta{ENSEMBLE}[$e],$SS_salin,$SS_temp,$SS_depth) : 1;
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
   200
		
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
   201
		print(P "$dta{ENSEMBLE}[$e]->{NUMBER} ");
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
   202
		print(P "$dta{ENSEMBLE}[$e]->{DATE} ");
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
   203
		print(P "$dta{ENSEMBLE}[$e]->{TIME} ");
23
fb0c269b1eaa V1.2 release candidate
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 21
diff changeset
   204
		printf(P "%d ",$dta{ENSEMBLE}[$e]->{UNIX_TIME}-$t0);		# elapsed time
18
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 13
diff changeset
   205
		print(P defined($dta{ENSEMBLE}[$e]->{HEADING}) ? "$dta{ENSEMBLE}[$e]->{HEADING} " : 'nan ');
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 13
diff changeset
   206
		print(P defined($dta{ENSEMBLE}[$e]->{PITCH}) ? "$dta{ENSEMBLE}[$e]->{PITCH} " : 'nan ');
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 13
diff changeset
   207
		print(P defined($dta{ENSEMBLE}[$e]->{ROLL}) ? "$dta{ENSEMBLE}[$e]->{ROLL} " : 'nan ');
0
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
   208
		print(P "$dta{ENSEMBLE}[$e]->{HEADING_STDDEV} ");
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
   209
		print(P "$dta{ENSEMBLE}[$e]->{PITCH_STDDEV} ");
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
   210
		print(P "$dta{ENSEMBLE}[$e]->{ROLL_STDDEV} ");
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
   211
		print(P "$dta{ENSEMBLE}[$e]->{ADC_XMIT_CURRENT} ");
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
   212
		print(P "$dta{ENSEMBLE}[$e]->{ADC_XMIT_VOLTAGE} ");
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
   213
		print(P "$dta{ENSEMBLE}[$e]->{TEMPERATURE} ");
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
   214
		if ($dta{ENSEMBLE}[$e]->{GOOD_VEL}[$b]) {
28
7c7da52363c2 transport version
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 24
diff changeset
   215
			printf(P "%g %g %g %g ",@{$dta{ENSEMBLE}[$e]->{BEAM_VELOCITY}[$b]});
0
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
   216
			printf(P "%g ",$dta{ENSEMBLE}[$e]->{VELOCITY}[$b][0] * $ssCorr);
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
   217
			printf(P "%g ",$dta{ENSEMBLE}[$e]->{VELOCITY}[$b][1] * $ssCorr);
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
   218
			printf(P "%g ",$dta{ENSEMBLE}[$e]->{VELOCITY}[$b][2] * $ssCorr);
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
   219
			if ($dta{ENSEMBLE}[$e]->{THREE_BEAM}[$b]) {
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
   220
				print(P "nan ");
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
   221
			} else {
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
   222
				printf(P "%g ",$dta{ENSEMBLE}[$e]->{VELOCITY}[$b][3] * $ssCorr);
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
   223
			}
21
0b5bbe60131c version sent to P16N
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 18
diff changeset
   224
			printf(P defined($dta{ENSEMBLE}[$e]->{BEAMPAIR_VELOCITY}[$b][0]) ? "%g " : "nan ",
0b5bbe60131c version sent to P16N
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 18
diff changeset
   225
						$dta{ENSEMBLE}[$e]->{BEAMPAIR_VELOCITY}[$b][0]);
0b5bbe60131c version sent to P16N
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 18
diff changeset
   226
			printf(P defined($dta{ENSEMBLE}[$e]->{BEAMPAIR_VELOCITY}[$b][1]) ? "%g " : "nan ",
0b5bbe60131c version sent to P16N
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 18
diff changeset
   227
						$dta{ENSEMBLE}[$e]->{BEAMPAIR_VELOCITY}[$b][1]);
0b5bbe60131c version sent to P16N
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 18
diff changeset
   228
			printf(P defined($dta{ENSEMBLE}[$e]->{BEAMPAIR_VELOCITY}[$b][2]) ? "%g " : "nan ",
0b5bbe60131c version sent to P16N
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 18
diff changeset
   229
						$dta{ENSEMBLE}[$e]->{BEAMPAIR_VELOCITY}[$b][2]);
0b5bbe60131c version sent to P16N
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 18
diff changeset
   230
			printf(P defined($dta{ENSEMBLE}[$e]->{BEAMPAIR_VELOCITY}[$b][3]) ? "%g " : "nan ",
0b5bbe60131c version sent to P16N
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 18
diff changeset
   231
						$dta{ENSEMBLE}[$e]->{BEAMPAIR_VELOCITY}[$b][3]);
0
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
   232
		} else {
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
   233
			print(P "nan nan nan nan ");
21
0b5bbe60131c version sent to P16N
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 18
diff changeset
   234
			print(P "nan nan nan nan ");
37
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 36
diff changeset
   235
			print(P "nan nan nan nan ");
0
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
   236
		}
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
   237
		print(P "@{$dta{ENSEMBLE}[$e]->{CORRELATION}[$b]} ");
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
   238
		print(P "@{$dta{ENSEMBLE}[$e]->{ECHO_AMPLITUDE}[$b]} ");
37
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 36
diff changeset
   239
		if ($dta{ENSEMBLE}[$e]->{GOOD_VEL}[$b]) {
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 36
diff changeset
   240
			print(P "@{$dta{ENSEMBLE}[$e]->{PERCENT_GOOD}[$b]} ");
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 36
diff changeset
   241
		} else {
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 36
diff changeset
   242
			print(P "nan nan nan nan ");
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 36
diff changeset
   243
		}
28
7c7da52363c2 transport version
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 24
diff changeset
   244
		if ($beamCoords) {
0
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
   245
			printf(P "%d ",$dta{ENSEMBLE}[$e]->{THREE_BEAM}[$b]);
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
   246
			printf(P "%s ",min(@{$dta{ENSEMBLE}[$e]->{PERCENT_GOOD}[$b]}));
28
7c7da52363c2 transport version
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 24
diff changeset
   247
		} else {
37
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 36
diff changeset
   248
			if ($dta{ENSEMBLE}[$e]->{GOOD_VEL}[$b]) {
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 36
diff changeset
   249
				print(P "$dta{ENSEMBLE}[$e]->{PERCENT_GOOD}[$b][0] ");
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 36
diff changeset
   250
			} else {
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 36
diff changeset
   251
				print(P "nan ");
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 36
diff changeset
   252
			}
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 36
diff changeset
   253
			printf(P "%g ",$dta{ENSEMBLE}[$e]->{PERCENT_GOOD}[$b][0]+$dta{ENSEMBLE}[$e]->{PERCENT_GOOD}[$b][3]);
0
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
   254
		}
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
   255
		printf(P "%g ",$dz[$b]*$ssCorr) if ($variable_ssCorr);
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
   256
		print(P "\n");
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
   257
	}
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
   258
	close(P);
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
   259
}
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
   260
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
   261
#----------------------------------------------------------------------
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
   262
# MAIN
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
   263
#----------------------------------------------------------------------
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
   264
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
   265
$P{RDI_file} = $ifn;
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
   266
$P{mag_decl} = $opt_M if defined($opt_M);
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
   267
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
   268
readData($ifn,\%dta);
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
   269
printf(STDERR "%d complete ensembles...\n",scalar(@{$dta{ENSEMBLE}}));
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
   270
$dta{HEADING_BIAS} = -$opt_M;						# magnetic declination
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
   271
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
   272
if ($dta{BEAM_COORDINATES}) {						# coords
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
   273
	$beamCoords = 1;
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
   274
} else {
28
7c7da52363c2 transport version
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 24
diff changeset
   275
	die("$ifn: only beam and earth coordinates supported\n")
0
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
   276
		if (!$dta{EARTH_COORDINATES});
28
7c7da52363c2 transport version
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 24
diff changeset
   277
	die("$ifn: -p requires beam-coordinate data\n")
7c7da52363c2 transport version
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 24
diff changeset
   278
		if ($opt_p > 0);
7c7da52363c2 transport version
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 24
diff changeset
   279
	die("$ifn: -d requires beam-coordinate data\n")
7c7da52363c2 transport version
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 24
diff changeset
   280
		if defined($opt_d);
7c7da52363c2 transport version
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 24
diff changeset
   281
	die("$ifn: -B requires beam-coordinate data\n")
7c7da52363c2 transport version
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 24
diff changeset
   282
		if defined($opt_B);
0
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
   283
}
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
   284
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
   285
for (my($b)=0; $b<$dta{N_BINS}; $b++) {				# calc dz
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
   286
	$dz[$b] = $dta{DISTANCE_TO_BIN1_CENTER} + $b*$dta{BIN_LENGTH};
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
   287
}
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
   288
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
   289
$lastGoodBin = 0;
1
a3b6a908dec5 after P302 cruise
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents: 0
diff changeset
   290
for ($e=0; $e<=$#{$dta{ENSEMBLE}}; $e++) {				# check/transform velocities
a3b6a908dec5 after P302 cruise
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents: 0
diff changeset
   291
	$dta{ENSEMBLE}[$e]->{NUMBER} = $e+1 if ($opt_R);	# renumber ensembles
0
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
   292
	next if (defined($first_ens) &&
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
   293
			 $dta{ENSEMBLE}[$e]->{NUMBER} < $first_ens);
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
   294
18
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 13
diff changeset
   295
	$dta{ENSEMBLE}[$e]->{PITCH} -= $P{pitch_bias}
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 13
diff changeset
   296
		if defined($dta{ENSEMBLE}[$e]->{PITCH});
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 13
diff changeset
   297
	$dta{ENSEMBLE}[$e]->{ROLL}  -= $P{roll_bias}
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 13
diff changeset
   298
		if defined($dta{ENSEMBLE}[$e]->{ROLL});
0
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
   299
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
   300
	$P{first_ens} = $dta{ENSEMBLE}[$e]->{NUMBER},$fe = $e
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
   301
		unless defined($P{first_ens});
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
   302
	last if (defined($last_ens) &&
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
   303
			 $dta{ENSEMBLE}[$e]->{NUMBER} > $last_ens);
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
   304
	$P{last_ens} = $dta{ENSEMBLE}[$e]->{NUMBER};
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
   305
	$le = $e;
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
   306
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
   307
	die("3-beams used in ensemble #$dta{ENSEMBLE}[$e]->{NUMBER}\n")
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
   308
		if ($dta{ENSEMBLE}[$e]->{N_BEAMS_USED} < 4);
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
   309
	die("BIT error in ensemble $dta{ENSEMBLE}[$e]->{NUMBER}\n")
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
   310
		if defined($dta{ENSEMBLE}[$e]->{BUILT_IN_TEST_ERROR});
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
   311
	die("Low gain in ensemble #$dta{ENSEMBLE}[$e]->{NUMBER}\n")
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
   312
        if ($dta{ENSEMBLE}[$e]->{LOW_GAIN});
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
   313
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
   314
	for (my($b)=0; $b<$dta{N_BINS}; $b++) {
28
7c7da52363c2 transport version
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 24
diff changeset
   315
		if ($beamCoords) {
36
515b06dae59c version at end of ECOGIG EN586 cruise
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 33
diff changeset
   316
			for (my($i)=0; $i<4; $i++) {									# percent-good editing (-p)
28
7c7da52363c2 transport version
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 24
diff changeset
   317
				if ($dta{ENSEMBLE}[$e]->{PERCENT_GOOD}[$b][$i] < $opt_p) {
7c7da52363c2 transport version
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 24
diff changeset
   318
					undef($dta{ENSEMBLE}[$e]->{PERCENT_GOOD}[$b][$i]);
7c7da52363c2 transport version
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 24
diff changeset
   319
					undef($dta{ENSEMBLE}[$e]->{VELOCITY}[$b][$i]);
7c7da52363c2 transport version
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 24
diff changeset
   320
				}
7c7da52363c2 transport version
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 24
diff changeset
   321
	        }
7c7da52363c2 transport version
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 24
diff changeset
   322
7c7da52363c2 transport version
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 24
diff changeset
   323
			$dta{ENSEMBLE}[$e]->{VELOCITY}[$b][0] -= $P{velbias_b1}			# beam-velocity biases (-B)
7c7da52363c2 transport version
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 24
diff changeset
   324
				if defined($dta{ENSEMBLE}[$e]->{VELOCITY}[$b][0]);
7c7da52363c2 transport version
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 24
diff changeset
   325
			$dta{ENSEMBLE}[$e]->{VELOCITY}[$b][1] -= $P{velbias_b2}
7c7da52363c2 transport version
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 24
diff changeset
   326
				if defined($dta{ENSEMBLE}[$e]->{VELOCITY}[$b][1]);
7c7da52363c2 transport version
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 24
diff changeset
   327
			$dta{ENSEMBLE}[$e]->{VELOCITY}[$b][2] -= $P{velbias_b3}
7c7da52363c2 transport version
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 24
diff changeset
   328
				if defined($dta{ENSEMBLE}[$e]->{VELOCITY}[$b][2]);
7c7da52363c2 transport version
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 24
diff changeset
   329
			$dta{ENSEMBLE}[$e]->{VELOCITY}[$b][3] -= $P{velbias_b4}
7c7da52363c2 transport version
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 24
diff changeset
   330
				if defined($dta{ENSEMBLE}[$e]->{VELOCITY}[$b][3]);
7c7da52363c2 transport version
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 24
diff changeset
   331
7c7da52363c2 transport version
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 24
diff changeset
   332
			if (defined($opt_d)) {											# discard data from given beam (-d)
7c7da52363c2 transport version
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 24
diff changeset
   333
				undef($dta{ENSEMBLE}[$e]->{PERCENT_GOOD}[$b][$opt_d-1]);
7c7da52363c2 transport version
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 24
diff changeset
   334
				undef($dta{ENSEMBLE}[$e]->{VELOCITY}[$b][$opt_d-1]);
7c7da52363c2 transport version
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 24
diff changeset
   335
			}
7c7da52363c2 transport version
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 24
diff changeset
   336
7c7da52363c2 transport version
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 24
diff changeset
   337
			@{$dta{ENSEMBLE}[$e]->{BEAM_VELOCITY}[$b]} =					# save beam velocities
7c7da52363c2 transport version
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 24
diff changeset
   338
				@{$dta{ENSEMBLE}[$e]->{VELOCITY}[$b]};
7c7da52363c2 transport version
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 24
diff changeset
   339
7c7da52363c2 transport version
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 24
diff changeset
   340
			@{$dta{ENSEMBLE}[$e]->{BEAMPAIR_VELOCITY}[$b]} =				# calculate w12, w34
7c7da52363c2 transport version
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 24
diff changeset
   341
				velBeamToBPEarth(\%dta,$e,@{$dta{ENSEMBLE}[$e]->{BEAM_VELOCITY}[$b]});
7c7da52363c2 transport version
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 24
diff changeset
   342
7c7da52363c2 transport version
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 24
diff changeset
   343
			@{$dta{ENSEMBLE}[$e]->{VELOCITY}[$b]} = 						# calculate earth velocities
36
515b06dae59c version at end of ECOGIG EN586 cruise
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 33
diff changeset
   344
				velBeamToEarth(\%dta,$e,@{$dta{ENSEMBLE}[$e]->{BEAM_VELOCITY}[$b]});
28
7c7da52363c2 transport version
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 24
diff changeset
   345
			$dta{ENSEMBLE}[$e]->{THREE_BEAM}[$b] = $RDI_Coords::threeBeamFlag;
7c7da52363c2 transport version
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 24
diff changeset
   346
			$three_beam[$b] += $RDI_Coords::threeBeamFlag;
7c7da52363c2 transport version
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 24
diff changeset
   347
36
515b06dae59c version at end of ECOGIG EN586 cruise
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 33
diff changeset
   348
			unless (defined($dta{ENSEMBLE}[$e]->{VELOCITY}[$b][0])) {		# not a valid transformation
515b06dae59c version at end of ECOGIG EN586 cruise
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 33
diff changeset
   349
				undef(@{$dta{ENSEMBLE}[$e]->{PERCENT_GOOD}[$b]});
28
7c7da52363c2 transport version
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 24
diff changeset
   350
				next;
7c7da52363c2 transport version
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 24
diff changeset
   351
			}
7c7da52363c2 transport version
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 24
diff changeset
   352
		} else { 															# Earth coordinates
7c7da52363c2 transport version
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 24
diff changeset
   353
			@{$dta{ENSEMBLE}[$e]->{BEAM_VELOCITY}[$b]} =					# calculate beam velocities
32
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 31
diff changeset
   354
				velEarthToBeam(\%dta,$e,@{$dta{ENSEMBLE}[$e]->{VELOCITY}[$b]});
28
7c7da52363c2 transport version
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 24
diff changeset
   355
				                                            
7c7da52363c2 transport version
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 24
diff changeset
   356
			@{$dta{ENSEMBLE}[$e]->{BEAMPAIR_VELOCITY}[$b]} =				# calculate w12, w34
7c7da52363c2 transport version
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 24
diff changeset
   357
				velBeamToBPEarth(\%dta,$e,@{$dta{ENSEMBLE}[$e]->{BEAM_VELOCITY}[$b]});
7c7da52363c2 transport version
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 24
diff changeset
   358
7c7da52363c2 transport version
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 24
diff changeset
   359
			@{$dta{ENSEMBLE}[$e]->{VELOCITY}[$b]} = 						# correct for heading bias
7c7da52363c2 transport version
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 24
diff changeset
   360
				velApplyHdgBias(\%dta,$e,@{$dta{ENSEMBLE}[$e]->{VELOCITY}[$b]});
7c7da52363c2 transport version
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 24
diff changeset
   361
36
515b06dae59c version at end of ECOGIG EN586 cruise
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 33
diff changeset
   362
			$three_beam[$b] += ($dta{ENSEMBLE}[$e]->{PERCENT_GOOD}[$b][0]/100 * $dta{PINGS_PER_ENSEMBLE});
515b06dae59c version at end of ECOGIG EN586 cruise
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 33
diff changeset
   363
			unless (defined($dta{ENSEMBLE}[$e]->{VELOCITY}[$b][0])) {		# no valid velocity
515b06dae59c version at end of ECOGIG EN586 cruise
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 33
diff changeset
   364
				undef(@{$dta{ENSEMBLE}[$e]->{PERCENT_GOOD}[$b]});
28
7c7da52363c2 transport version
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 24
diff changeset
   365
				next;
7c7da52363c2 transport version
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 24
diff changeset
   366
			}
7c7da52363c2 transport version
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 24
diff changeset
   367
13
b176da8559b3 before implementing WBWens (PD0 writing)
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 12
diff changeset
   368
		}
28
7c7da52363c2 transport version
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 24
diff changeset
   369
0
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
   370
		$dta{ENSEMBLE}[$e]->{GOOD_VEL}[$b] = 1;
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
   371
		$good_vels[$b]++; 
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
   372
		$lastGoodBin = $b if ($b > $lastGoodBin);
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
   373
		$firstGoodEns = $e unless defined($firstGoodEns);
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
   374
		$lastGoodEns = $e;
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
   375
    }
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
   376
}
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
   377
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
   378
unless (defined($opt_r)) {
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
   379
	$fe = $firstGoodEns;
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
   380
	$le = $lastGoodEns;
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
   381
}
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
   382
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
   383
$P{N_ensembles} = $le - $fe + 1;
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
   384
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
   385
$firstBin = 0;
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
   386
$lastBin = $lastGoodBin;
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
   387
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
   388
print( STDERR "Start      : $dta{ENSEMBLE}[$fe]->{DATE} $dta{ENSEMBLE}[$fe]->{TIME}\n");
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
   389
print( STDERR "End        : $dta{ENSEMBLE}[$le]->{DATE} $dta{ENSEMBLE}[$le]->{TIME}\n");
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
   390
printf(STDERR "Bins       : %d-%d\n",$firstBin+1,$lastBin+1);
28
7c7da52363c2 transport version
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 24
diff changeset
   391
if ($beamCoords) {
0
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
   392
	printf(STDERR "3-Beam     : %d %d %d %d\n",$RDI_Coords::threeBeam_1,
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
   393
											   $RDI_Coords::threeBeam_2,
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
   394
											   $RDI_Coords::threeBeam_3,
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
   395
											   $RDI_Coords::threeBeam_4);
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
   396
	
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
   397
}
37
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 36
diff changeset
   398
print(STDERR "Good/3-Beam: ");
0
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
   399
for ($b=$firstBin; $b<=$lastBin; $b++) {				# generate output
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
   400
	dumpBin($b,$fe,$le);
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
   401
}
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
   402
print(STDERR "\n");
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
   403
229a0d72d2ab first hg version
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
   404
exit(0);