listBins
changeset 48 cdc74ebada81
parent 45 5767cbe470a0
child 50 6bfec705d25e
equal deleted inserted replaced
46:777cd0f2456a 48:cdc74ebada81
     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: Wed Aug 29 07:23:21 2018
     5 #                    dlm: Thu Jun 13 22:17:02 2019
     6 #                    (c) 2006 A.M. Thurnherr
     6 #                    (c) 2006 A.M. Thurnherr
     7 #                    uE-Info: 136 20 NIL 0 0 72 0 2 4 NIL ofnI
     7 #                    uE-Info: 75 58 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:
    69 #	Feb  6, 2018: - added support for PD0_IO first_ens, last_ens
    69 #	Feb  6, 2018: - added support for PD0_IO first_ens, last_ens
    70 #	Apr 10, 2018: - added day number to output
    70 #	Apr 10, 2018: - added day number to output
    71 #				  - added -l)ast bin
    71 #				  - added -l)ast bin
    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)
       
    75 #				  - BUG: dn did not have sufficient digits
    74 
    76 
    75 # General Notes:
    77 # General Notes:
    76 #	- everything (e.g. beams) is numbered from 1
    78 #	- everything (e.g. beams) is numbered from 1
    77 #	- no support for BT data
    79 #	- no support for BT data
    78 
    80 
   219 		
   221 		
   220 		print(P "$dta{ENSEMBLE}[$e]->{NUMBER} ");
   222 		print(P "$dta{ENSEMBLE}[$e]->{NUMBER} ");
   221 		print(P "$dta{ENSEMBLE}[$e]->{DATE} ");
   223 		print(P "$dta{ENSEMBLE}[$e]->{DATE} ");
   222 		print(P "$dta{ENSEMBLE}[$e]->{TIME} ");
   224 		print(P "$dta{ENSEMBLE}[$e]->{TIME} ");
   223 		printf(P "%d ",$dta{ENSEMBLE}[$e]->{UNIX_TIME}-$t0);												# elapsed time
   225 		printf(P "%d ",$dta{ENSEMBLE}[$e]->{UNIX_TIME}-$t0);												# elapsed time
   224 		printf(P "%g ",str2dec_time($dta{ENSEMBLE}[$e]->{DATE},$dta{ENSEMBLE}[$e]->{TIME}));				# decimal day 
   226 		printf(P "%.5f ",str2dec_time($dta{ENSEMBLE}[$e]->{DATE},$dta{ENSEMBLE}[$e]->{TIME}));				# decimal day 
   225 		print(P defined($dta{ENSEMBLE}[$e]->{HEADING}) ? "$dta{ENSEMBLE}[$e]->{HEADING} " : 'nan ');
   227 		print(P defined($dta{ENSEMBLE}[$e]->{HEADING}) ? "$dta{ENSEMBLE}[$e]->{HEADING} " : 'nan ');
   226 		print(P defined($dta{ENSEMBLE}[$e]->{PITCH}) ? "$dta{ENSEMBLE}[$e]->{PITCH} " : 'nan ');
   228 		print(P defined($dta{ENSEMBLE}[$e]->{PITCH}) ? "$dta{ENSEMBLE}[$e]->{PITCH} " : 'nan ');
   227 		print(P defined($dta{ENSEMBLE}[$e]->{ROLL}) ? "$dta{ENSEMBLE}[$e]->{ROLL} " : 'nan ');
   229 		print(P defined($dta{ENSEMBLE}[$e]->{ROLL}) ? "$dta{ENSEMBLE}[$e]->{ROLL} " : 'nan ');
   228 		print(P "$dta{ENSEMBLE}[$e]->{HEADING_STDDEV} ");
   230 		print(P "$dta{ENSEMBLE}[$e]->{HEADING_STDDEV} ");
   229 		print(P "$dta{ENSEMBLE}[$e]->{PITCH_STDDEV} ");
   231 		print(P "$dta{ENSEMBLE}[$e]->{PITCH_STDDEV} ");
   324 	$P{last_ens} = $dta{ENSEMBLE}[$e]->{NUMBER};
   326 	$P{last_ens} = $dta{ENSEMBLE}[$e]->{NUMBER};
   325 	$le = $e;
   327 	$le = $e;
   326 
   328 
   327 	die("3-beams used in ensemble #$dta{ENSEMBLE}[$e]->{NUMBER}\n")
   329 	die("3-beams used in ensemble #$dta{ENSEMBLE}[$e]->{NUMBER}\n")
   328 		if ($dta{ENSEMBLE}[$e]->{N_BEAMS_USED} < 4);
   330 		if ($dta{ENSEMBLE}[$e]->{N_BEAMS_USED} < 4);
   329 	die("BIT error in ensemble $dta{ENSEMBLE}[$e]->{NUMBER}\n")
   331 #	die("BIT error in ensemble $dta{ENSEMBLE}[$e]->{NUMBER}\n")
   330 		if defined($dta{ENSEMBLE}[$e]->{BUILT_IN_TEST_ERROR});
   332 #		if defined($dta{ENSEMBLE}[$e]->{BUILT_IN_TEST_ERROR});
   331 	die("Low gain in ensemble #$dta{ENSEMBLE}[$e]->{NUMBER}\n")
   333 	die("Low gain in ensemble #$dta{ENSEMBLE}[$e]->{NUMBER}\n")
   332         if ($dta{ENSEMBLE}[$e]->{LOW_GAIN});
   334         if ($dta{ENSEMBLE}[$e]->{LOW_GAIN});
   333 
   335 
   334 	for (my($b)=0; $b<$dta{N_BINS}; $b++) {
   336 	for (my($b)=0; $b<$dta{N_BINS}; $b++) {
   335 		if ($beamCoords) {
   337 		if ($beamCoords) {