edit_data.pl
changeset 49 5006e9158207
parent 47 2ccb81b7cea5
child 55 2d8e1139acd5
equal deleted inserted replaced
48:d9309804b6cf 49:5006e9158207
     1 #======================================================================
     1 #======================================================================
     2 #                    E D I T _ D A T A . P L 
     2 #                    / D A T A / S R C / O C E A N O G R A P H Y / L A D C P _ V E R T I C A L _ V E L O C I T Y / E D I T _ D A T A . P L 
     3 #                    doc: Sat May 22 21:35:55 2010
     3 #                    doc: Sat May 22 21:35:55 2010
     4 #                    dlm: Mon Jun  6 21:13:28 2016
     4 #                    dlm: Tue Nov 27 11:07:33 2018
     5 #                    (c) 2010 A.M. Thurnherr
     5 #                    (c) 2010 A.M. Thurnherr
     6 #                    uE-Info: 543 0 NIL 0 0 72 2 2 4 NIL ofnI
     6 #                    uE-Info: 46 71 NIL 0 0 72 0 2 4 NIL ofnI
     7 #======================================================================
     7 #======================================================================
     8 
     8 
     9 # HISTORY:
     9 # HISTORY:
    10 #	May 22, 2010: - created
    10 #	May 22, 2010: - created
    11 #	May 24, 2010: - added editSideLobesFromSeabed()
    11 #	May 24, 2010: - added editSideLobesFromSeabed()
    39 #	Jun  2, 2016: - added applyTiltCorrection()
    39 #	Jun  2, 2016: - added applyTiltCorrection()
    40 #				  - maded editCorr_Earthcoords() less conservative
    40 #				  - maded editCorr_Earthcoords() less conservative
    41 #				  - verified that removed velocities are counted correctly
    41 #				  - verified that removed velocities are counted correctly
    42 #	Jun  3, 2016: - BUG: applyTiltCorrection() did not use gimbal_pitch
    42 #	Jun  3, 2016: - BUG: applyTiltCorrection() did not use gimbal_pitch
    43 #	Jun  6, 2016: - removed applyTiltCorrection()
    43 #	Jun  6, 2016: - removed applyTiltCorrection()
       
    44 #	Oct 13, 2017: - BUG: editPPI() only allowed for nominal transducer frequencies
       
    45 #	May  1, 2018: - added editLargeHSpeeds()
       
    46 #	Nov 17, 2018: - BUG: spurious letter "z" had crept in at some stage
    44 
    47 
    45 # NOTES:
    48 # NOTES:
    46 #	- all bins must be edited (not just the ones between $LADCP_firstBin
    49 #	- all bins must be edited (not just the ones between $LADCP_firstBin
    47 #	  and $LADCP_lastBin to allow reflr calculations to use bins outside
    50 #	  and $LADCP_lastBin to allow reflr calculations to use bins outside
    48 #	  this range (ONLY FOR BEAM-COORD EDITS)
    51 #	  this range (ONLY FOR BEAM-COORD EDITS)
    51 #	  report their stats wrt $nvw (for those which use $nvv,
    54 #	  report their stats wrt $nvw (for those which use $nvv,
    52 #	  all velocities must be counted)
    55 #	  all velocities must be counted)
    53 
    56 
    54 #======================================================================
    57 #======================================================================
    55 # correctAttitude($ens,$pitch_bias,$roll_bias,$heading_bias)
    58 # correctAttitude($ens,$pitch_bias,$roll_bias,$heading_bias)
       
    59 #	- attitude bias correction
    56 #	- this is called before gimbal_pitch is calculated
    60 #	- this is called before gimbal_pitch is calculated
    57 #======================================================================
    61 #======================================================================
    58 
    62 
    59 sub correctAttitude($$$$)
    63 sub correctAttitude($$$$)
    60 {
    64 {
   369 	my($fe,$te,$wd) = @_;	# first & last ens to process, water depth for downlooker
   373 	my($fe,$te,$wd) = @_;	# first & last ens to process, water depth for downlooker
   370 	my($nvrm) = 0;			# of velocities removed
   374 	my($nvrm) = 0;			# of velocities removed
   371 	my($nerm) = 0;			# of ensembles affected
   375 	my($nerm) = 0;			# of ensembles affected
   372 
   376 
   373 	unless (defined($bha)) {
   377 	unless (defined($bha)) {
   374 		if    ($LADCP{BEAM_FREQUENCY} == 1200) { $bha = 2.4; }
   378 		if    (abs($LADCP{BEAM_FREQUENCY}-1200)/1200 <= 0.1) { $bha = 2.4; }
   375 		elsif ($LADCP{BEAM_FREQUENCY} ==  600) { $bha = 2.5; }
   379 		elsif (abs($LADCP{BEAM_FREQUENCY}-600) / 600 <= 0.1) { $bha = 2.5; }
   376 		elsif ($LADCP{BEAM_FREQUENCY} ==  300) { $bha = 3.7; }
   380 		elsif (abs($LADCP{BEAM_FREQUENCY}-300) / 300 <= 0.1) { $bha = 3.7; }
   377 		elsif ($LADCP{BEAM_FREQUENCY} ==  150) { $bha = 6.7; }
   381 		elsif (abs($LADCP{BEAM_FREQUENCY}-150) / 150 <= 0.1) { $bha = 6.7; }
   378 		elsif ($LADCP{BEAM_FREQUENCY} ==   75) { $bha = 8.4; }
   382 		elsif (abs($LADCP{BEAM_FREQUENCY}-75)  /  75 <= 0.1) { $bha = 8.4; }
   379 		else { error("$0: unexpected transducer frequency $LADCP{BEAM_FREQUENCY}\n"); }
   383 		else { error("$0: unexpected transducer frequency $LADCP{BEAM_FREQUENCY}\n"); }
   380 	}
   384 	}
   381 	
   385 	
   382 	for (my($e)=$fe; $e<=$te; $e++) {
   386 	for (my($e)=$fe; $e<=$te; $e++) {
   383 		next unless numberp($LADCP{ENSEMBLE}[$e]->{CTD_DEPTH});
   387 		next unless numberp($LADCP{ENSEMBLE}[$e]->{CTD_DEPTH});
   540     }
   544     }
   541     return $nvrm;
   545     return $nvrm;
   542 }
   546 }
   543 
   547 
   544 #======================================================================
   548 #======================================================================
       
   549 # $nerm = editLargeHSpeeds($fe,$te,$max_hspeed)
       
   550 #	- filter based on 2018 GO-SHIP LADCP profile #106, where UL 
       
   551 #	  velocities become bad when ship starts dragging rosette
       
   552 #	- only valid bin range is edited/counted
       
   553 #======================================================================
       
   554 
       
   555 sub editLargeHSpeeds($$$)
       
   556 {
       
   557 	my($fe,$te,$limit) = @_;
       
   558 	my($nerm) = 0;
       
   559 	for (my($ens)=$fe; $ens<=$te; $ens++) {
       
   560 		next unless numberp($LADCP{ENSEMBLE}[$ens]->{CTD_DEPTH});
       
   561 		next unless (vel_speed($LADCP{ENSEMBLE}[$ens]->{REFLR_U},
       
   562 							   $LADCP{ENSEMBLE}[$ens]->{REFLR_U}) > $limit);
       
   563 		undef($LADCP{ENSEMBLE}[$ens]->{CTD_DEPTH});
       
   564 		$nerm++;
       
   565 	}
       
   566     return $nerm;
       
   567 }
       
   568 
       
   569 #======================================================================
   545 
   570 
   546 1;
   571 1;