listBins
changeset 1 a3b6a908dec5
parent 0 229a0d72d2ab
child 12 0f89b1523648
equal deleted inserted replaced
0:229a0d72d2ab 1:a3b6a908dec5
     1 #!/usr/bin/perl
     1 #!/usr/bin/perl
     2 #======================================================================
     2 #======================================================================
     3 #                    L I S T B I N S 
     3 #                    L I S T B I N S 
     4 #                    doc: Fri Aug 25 15:57:05 2006
     4 #                    doc: Fri Aug 25 15:57:05 2006
     5 #                    dlm: Sat May 23 16:34:30 2009
     5 #                    dlm: Sun Aug 22 22:40:32 2010
     6 #                    (c) 2006 A.M. Thurnherr
     6 #                    (c) 2006 A.M. Thurnherr
     7 #                    uE-Info: 269 0 NIL 0 0 72 2 2 4 NIL ofnI
     7 #                    uE-Info: 45 28 NIL 0 0 72 2 2 4 NIL ofnI
     8 #======================================================================
     8 #======================================================================
     9 
     9 
    10 # Split data file into per-bin time series.
    10 # Split data file into per-bin time series.
    11 
    11 
    12 # HISTORY:
    12 # HISTORY:
    40 #					two beam pairs separately
    40 #					two beam pairs separately
    41 #	May 21, 2009: - added horizontal beampair velocities on -w
    41 #	May 21, 2009: - added horizontal beampair velocities on -w
    42 #				  - -P)itchRoll <bias/bias>
    42 #				  - -P)itchRoll <bias/bias>
    43 #	May 22, 2009: - added -B) <bias/bias/bias/bias>
    43 #	May 22, 2009: - added -B) <bias/bias/bias/bias>
    44 #	May 23, 2009: - adapted to changed beampair-velocity fun name
    44 #	May 23, 2009: - adapted to changed beampair-velocity fun name
       
    45 #	Aug 22, 2010: - added -R
    45 
    46 
    46 # General Notes:
    47 # General Notes:
    47 #	- everything (e.g. beams) is numbered from 1
    48 #	- everything (e.g. beams) is numbered from 1
    48 #	- no support for BT data
    49 #	- no support for BT data
    49 
    50 
    66 $0 =~ m{(.*/)[^/]+};
    67 $0 =~ m{(.*/)[^/]+};
    67 require "$1RDI_BB_Read.pl";
    68 require "$1RDI_BB_Read.pl";
    68 require "$1RDI_Coords.pl";
    69 require "$1RDI_Coords.pl";
    69 require "$1RDI_Utils.pl";
    70 require "$1RDI_Utils.pl";
    70 
    71 
    71 die("Usage: $0 [-r)ange <first_ens,last_ens>] " .
    72 die("Usage: $0 [-r)ange <first_ens,last_ens>] [-R)enumber ensembles] " .
    72 			  "[output -f)ile <pat[bin%d.raw]>] " .
    73 			  "[output -f)ile <pat[bin%d.raw]>] " .
    73 			  "[-a)ll ens (not just those with good vels)] " .
    74 			  "[-a)ll ens (not just those with good vels)] " .
    74 			  "[-M)agnetic <declination>] " .
    75 			  "[-M)agnetic <declination>] " .
    75 			  "[-S)oundspeed correction <salin|*,temp|*,depth|*> " .
    76 			  "[-S)oundspeed correction <salin|*,temp|*,depth|*> " .
    76 			  "[-P)itch/Roll <bias/bias>] [-B)eamvel <bias/bias/bias/bias>] " .
    77 			  "[-P)itch/Roll <bias/bias>] [-B)eamvel <bias/bias/bias/bias>] " .
    77 		 	  "[require -4)-beam solutions] [-d)iscard <beam#>] " .
    78 		 	  "[require -4)-beam solutions] [-d)iscard <beam#>] " .
    78 		 	  "[-%)good <min>] " .
    79 		 	  "[-%)good <min>] " .
    79 		 	  "[output -b)eam coordinates] [output two separate -w) estimates] " .
    80 		 	  "[output -b)eam coordinates] [output two separate -w) estimates] " .
    80 			  "<RDI file>\n")
    81 			  "<RDI file>\n")
    81 	unless (&Getopts("4abB:d:f:M:p:r:P:S:w") && @ARGV == 1);
    82 	unless (&Getopts("4abB:d:f:M:p:r:P:RS:w") && @ARGV == 1);
    82 
    83 
    83 ($P{pitch_bias},$P{roll_bias}) = split('[,/]',$opt_P);
    84 ($P{pitch_bias},$P{roll_bias}) = split('[,/]',$opt_P);
    84 ($P{velbias_b1},$P{velbias_b2},$P{velbias_b3},$P{velbias_b4}) = split('[,/]',$opt_B);
    85 ($P{velbias_b1},$P{velbias_b2},$P{velbias_b3},$P{velbias_b4}) = split('[,/]',$opt_B);
    85 
    86 
    86 die("$0: -4 and -d are mutually exclusive\n")
    87 die("$0: -4 and -d are mutually exclusive\n")
   236 for (my($b)=0; $b<$dta{N_BINS}; $b++) {				# calc dz
   237 for (my($b)=0; $b<$dta{N_BINS}; $b++) {				# calc dz
   237 	$dz[$b] = $dta{DISTANCE_TO_BIN1_CENTER} + $b*$dta{BIN_LENGTH};
   238 	$dz[$b] = $dta{DISTANCE_TO_BIN1_CENTER} + $b*$dta{BIN_LENGTH};
   238 }
   239 }
   239 
   240 
   240 $lastGoodBin = 0;
   241 $lastGoodBin = 0;
   241 for ($e=0; $e<=$#{$dta{ENSEMBLE}}; $e++) {			# check/transform velocities
   242 for ($e=0; $e<=$#{$dta{ENSEMBLE}}; $e++) {				# check/transform velocities
       
   243 	$dta{ENSEMBLE}[$e]->{NUMBER} = $e+1 if ($opt_R);	# renumber ensembles
   242 	next if (defined($first_ens) &&
   244 	next if (defined($first_ens) &&
   243 			 $dta{ENSEMBLE}[$e]->{NUMBER} < $first_ens);
   245 			 $dta{ENSEMBLE}[$e]->{NUMBER} < $first_ens);
   244 
   246 
   245 	$dta{ENSEMBLE}[$e]->{PITCH} -= $P{pitch_bias};
   247 	$dta{ENSEMBLE}[$e]->{PITCH} -= $P{pitch_bias};
   246 	$dta{ENSEMBLE}[$e]->{ROLL}  -= $P{roll_bias};
   248 	$dta{ENSEMBLE}[$e]->{ROLL}  -= $P{roll_bias};