RDI_Utils.pl
changeset 41 d7ab920c1de6
parent 39 3bddaa514ef5
child 43 b63fa355644c
equal deleted inserted replaced
40:6a46e9d31106 41:d7ab920c1de6
     1 #======================================================================
     1 #======================================================================
     2 #                    R D I _ U T I L S . P L 
     2 #                    R D I _ U T I L S . P L 
     3 #                    doc: Wed Feb 12 10:21:32 2003
     3 #                    doc: Wed Feb 12 10:21:32 2003
     4 #                    dlm: Tue Aug  8 16:25:05 2017
     4 #                    dlm: Mon Nov 27 10:32:50 2017
     5 #                    (c) 2003 A.M. Thurnherr
     5 #                    (c) 2003 A.M. Thurnherr
     6 #                    uE-Info: 58 55 NIL 0 0 72 2 2 4 NIL ofnI
     6 #                    uE-Info: 59 75 NIL 0 0 72 2 2 4 NIL ofnI
     7 #======================================================================
     7 #======================================================================
     8 
     8 
     9 # miscellaneous RDI-specific utilities
     9 # miscellaneous RDI-specific utilities
    10 
    10 
    11 # History:
    11 # History:
    54 #	Jan  9, 2016: - renamed ref_lr_w to mk_prof_ref_lr_w because the old name conflicts
    54 #	Jan  9, 2016: - renamed ref_lr_w to mk_prof_ref_lr_w because the old name conflicts
    55 #				    with a sub in LADCP_w
    55 #				    with a sub in LADCP_w
    56 #   May 19, 2016: - adapted to new velBeamToInstrument() usage
    56 #   May 19, 2016: - adapted to new velBeamToInstrument() usage
    57 #	Aug  7, 2017: - added abmiguity velocity
    57 #	Aug  7, 2017: - added abmiguity velocity
    58 #	Aug  8, 2017: - changed transducer frequency to kHz
    58 #	Aug  8, 2017: - changed transducer frequency to kHz
       
    59 #	Nov 27, 2017: - BUG: profile-restart heuristic did not work with P6#001
    59 
    60 
    60 use strict;
    61 use strict;
    61 
    62 
    62 #======================================================================
    63 #======================================================================
    63 # fake_BT_RANGE(dta ptr)
    64 # fake_BT_RANGE(dta ptr)
   465 	
   466 	
   466 		my($dt) = $dta->{ENSEMBLE}[$e]->{UNIX_TIME} -		# time step since
   467 		my($dt) = $dta->{ENSEMBLE}[$e]->{UNIX_TIME} -		# time step since
   467 				  $dta->{ENSEMBLE}[$lastgood]->{UNIX_TIME}; # ... last good ens
   468 				  $dta->{ENSEMBLE}[$lastgood]->{UNIX_TIME}; # ... last good ens
   468 	
   469 	
   469 		if ($dt > $max_gap) {
   470 		if ($dt > $max_gap) {
   470 #			if ($dta->{ENSEMBLE}[$lastgood]->{UNIX_TIME} -					# heuristic changed Feb 22, 2014
   471 			# 2nd heuristic test added Nov 2017 for P06 profile #001
   471 #			    $dta->{ENSEMBLE}[$firstgood]->{UNIX_TIME} > 15*60) {
   472 			if ((@{$dta->{ENSEMBLE}}-$e < @{$dta->{ENSEMBLE}}/2) &&
   472 			if (@{$dta->{ENSEMBLE}}-$e < @{$dta->{ENSEMBLE}}/2) {
   473 				($maxz > 25 && $z < $maxz/2)) {
   473 					printf(STDERR "WARNING: %.1f-s gap in 2nd half of profile is too long; profile ended at ensemble $lastgood\n",$dt);
   474 					printf(STDERR "WARNING: %.1f-s gap in 2nd half of profile is too long; profile ended at ensemble $lastgood\n",$dt);
       
   475 #					printf(STDERR "\t[#ens = %d, end-of-gap = $e]\n",scalar(@{$dta->{ENSEMBLE}}));
   474 					last;
   476 					last;
   475 			}
   477 			}
   476 			printf(STDERR "WARNING: %.1f-s gap in first half of profile is too long; profile restarted at ensemble $e\n",$dt);
   478 			printf(STDERR "WARNING: %.1f-s gap in first half of profile is too long; profile restarted at ensemble $e\n",$dt);
   477 			$firstgood = $lastgood = $e;
   479 			$firstgood = $lastgood = $e;
   478 			$dta->{ENSEMBLE}[$e]->{ELAPSED_TIME} = 0;
   480 			$dta->{ENSEMBLE}[$e]->{ELAPSED_TIME} = 0;