listBins
changeset 54 21cf468fa8e0
parent 50 6bfec705d25e
equal deleted inserted replaced
53:51c5988a7f1f 54:21cf468fa8e0
     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: Thu Feb 13 10:36:24 2020
     5 #                    dlm: Fri Jun  5 13:45:23 2020
     6 #                    (c) 2006 A.M. Thurnherr
     6 #                    (c) 2006 A.M. Thurnherr
     7 #                    uE-Info: 133 33 NIL 0 0 72 0 2 4 NIL ofnI
     7 #                    uE-Info: 367 103 NIL 0 0 72 0 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:
    72 #				  - activate output files
    72 #				  - activate output files
    73 #	Aug 29, 2018: - added error message on -r decoding failures
    73 #	Aug 29, 2018: - added error message on -r decoding failures
    74 #	Jun 13, 2018: - adpated to RTI files (disabled BIT error check)
    74 #	Jun 13, 2018: - adpated to RTI files (disabled BIT error check)
    75 #				  - BUG: dn did not have sufficient digits
    75 #				  - BUG: dn did not have sufficient digits
    76 #	Feb 13, 2020: - added -z
    76 #	Feb 13, 2020: - added -z
       
    77 #	May 11, 2020: - removed -z, added -t -m
    77 
    78 
    78 # General Notes:
    79 # General Notes:
    79 #	- everything (e.g. beams) is numbered from 1
    80 #	- everything (e.g. beams) is numbered from 1
    80 #	- no support for BT data
    81 #	- no support for BT data
    81 
    82 
   116 $antsMinLibVersion = 7.0;
   117 $antsMinLibVersion = 7.0;
   117 ($ANTS) = (`which ANTSlib` =~ m{^(.*)/[^/]*$});
   118 ($ANTS) = (`which ANTSlib` =~ m{^(.*)/[^/]*$});
   118 require "$ANTS/ants.pl";
   119 require "$ANTS/ants.pl";
   119 require "$ANTS/libconv.pl";
   120 require "$ANTS/libconv.pl";
   120 
   121 
   121 die("Usage: $0 [-z) progress dots] [-r)ange <first_ens,last_ens>] [-l)ast <bin>] [-R)enumber ensembles from 1] " .
   122 die("Usage: $0 [-r)ange <first_ens,last_ens>] [-l)ast <bin>] [-R)enumber ensembles from 1] " .
   122 			  "[-o)utput <redirection[>bin%d.raw]>] " .
   123 			  "[-o)utput <redirection[>bin%d.raw]>] " .
   123 			  "[output -a)ll ens (not just those with good vels)] " .
   124 			  "[output -a)ll ens (not just those with good vels)] " .
   124 			  "[-M)agnetic <declination>] " .
   125 			  "[-M)agnetic <declination>] " .
   125 			  "[-S)oundspeed correction <salin|*,temp|*,depth|*> " .
   126 			  "[-S)oundspeed correction <salin|*,temp|*,depth|*> " .
   126 			  "[Instrument -T)ransformation Matrix <file>] " .
   127 			  "[Instrument -T)ransformation Matrix <file>] " .
       
   128 			  '[disable bin -m)apping] [use TRDI beam-to-earth -t)ransformation] ' .
   127 			  "[-P)itch/Roll <bias/bias>] [-B)eamvel <bias/bias/bias/bias>] " .
   129 			  "[-P)itch/Roll <bias/bias>] [-B)eamvel <bias/bias/bias/bias>] " .
   128 		 	  "[require -4)-beam solutions] [-d)iscard <beam#>] " .
   130 		 	  "[require -4)-beam solutions] [-d)iscard <beam#>] " .
   129 		 	  "[-p)ct-good <min>] " .
   131 		 	  "[-p)ct-good <min>] " .
   130 			  "<RDI file>\n")
   132 			  "<RDI file>\n")
   131 	unless (&getopts("4aB:d:l:M:o:p:r:P:RS:T:z") && @ARGV == 1);
   133 	unless (&getopts("4aB:d:l:mM:o:p:r:P:RS:tT:") && @ARGV == 1);
   132 
       
   133 $global::readDataProgress = 10000 if defined($opt_z);
       
   134 
   134 
   135 ($P{pitch_bias},$P{roll_bias}) = split('[,/]',$opt_P);
   135 ($P{pitch_bias},$P{roll_bias}) = split('[,/]',$opt_P);
   136 ($P{velbias_b1},$P{velbias_b2},$P{velbias_b3},$P{velbias_b4}) = split('[,/]',$opt_B);
   136 ($P{velbias_b1},$P{velbias_b2},$P{velbias_b3},$P{velbias_b4}) = split('[,/]',$opt_B);
   137 
   137 
   138 die("$0: -4 and -d are mutually exclusive\n")
   138 die("$0: -4 and -d are mutually exclusive\n")
   139 	if ($opt_4 && defined($opt_d));
   139 	if ($opt_4 && defined($opt_d));
   140 
   140 
   141 $opt_p = 0 unless defined($opt_p);
   141 $opt_p = 0 unless defined($opt_p);
   142 
   142 
   143 $RDI_Coords::minValidVels = 4 if ($opt_4);			# no 3-beam solutions
   143 $RDI_Coords::minValidVels 		= 4 if ($opt_4);			# no 3-beam solutions
       
   144 $RDI_Coords::binMapping 		= 'none' if ($opt_m);  		# 'linterp' is default
       
   145 $RDI_Coords::beamTransformation = 'RDI'  if ($opt_t);		# 'LHR90' is default
   144 
   146 
   145 print(STDERR "WARNING: magnetic declination not set!\n")
   147 print(STDERR "WARNING: magnetic declination not set!\n")
   146 	unless defined($opt_M);
   148 	unless defined($opt_M);
   147 
   149 
   148 $opt_o = '>bin%d.raw' unless defined($opt_o);
   150 $opt_o = '>bin%d.raw' unless defined($opt_o);
   360 			}
   362 			}
   361 
   363 
   362 			@{$dta{ENSEMBLE}[$e]->{BEAM_VELOCITY}[$b]} =					# save beam velocities
   364 			@{$dta{ENSEMBLE}[$e]->{BEAM_VELOCITY}[$b]} =					# save beam velocities
   363 				@{$dta{ENSEMBLE}[$e]->{VELOCITY}[$b]};
   365 				@{$dta{ENSEMBLE}[$e]->{VELOCITY}[$b]};
   364 
   366 
   365 			@{$dta{ENSEMBLE}[$e]->{BEAMPAIR_VELOCITY}[$b]} =				# calculate w12, w34
   367 			@{$dta{ENSEMBLE}[$e]->{BEAMPAIR_VELOCITY}[$b]} =				# calculate v12, w12, v34, w34
   366 				velBeamToBPEarth(\%dta,$e,@{$dta{ENSEMBLE}[$e]->{BEAM_VELOCITY}[$b]});
   368 				velBeamToBPEarth(\%dta,$e,@{$dta{ENSEMBLE}[$e]->{BEAM_VELOCITY}[$b]});
   367 
   369 
   368 			@{$dta{ENSEMBLE}[$e]->{VELOCITY}[$b]} = 						# calculate earth velocities
   370 			@{$dta{ENSEMBLE}[$e]->{VELOCITY}[$b]} = 						# calculate earth velocities
   369 				velBeamToEarth(\%dta,$e,@{$dta{ENSEMBLE}[$e]->{BEAM_VELOCITY}[$b]});
   371 				velBeamToEarth(\%dta,$e,@{$dta{ENSEMBLE}[$e]->{BEAM_VELOCITY}[$b]});
   370 			$dta{ENSEMBLE}[$e]->{THREE_BEAM}[$b] = $RDI_Coords::threeBeamFlag;
   372 			$dta{ENSEMBLE}[$e]->{THREE_BEAM}[$b] = $RDI_Coords::threeBeamFlag;