RDI_Utils.pl
changeset 31 b6ca27a1d19c
parent 23 fb0c269b1eaa
child 34 3b4bcd55e1ea
equal deleted inserted replaced
30:184133e916be 31:b6ca27a1d19c
     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: Sun Mar 22 10:19:08 2015
     4 #                    dlm: Sat Jan  9 16:36:52 2016
     5 #                    (c) 2003 A.M. Thurnherr
     5 #                    (c) 2003 A.M. Thurnherr
     6 #                    uE-Info: 494 98 NIL 0 0 72 0 2 4 NIL ofnI
     6 #                    uE-Info: 55 41 NIL 0 0 72 0 2 4 NIL ofnI
     7 #======================================================================
     7 #======================================================================
     8 
     8 
     9 # miscellaneous RDI-specific utilities
     9 # miscellaneous RDI-specific utilities
    10 
    10 
    11 # History:
    11 # History:
    49 #				  - added set_range_lim()
    49 #				  - added set_range_lim()
    50 #	Feb 22, 2014: - changed gap heuristic
    50 #	Feb 22, 2014: - changed gap heuristic
    51 #			      - Earth coord beam-pair warning removed
    51 #			      - Earth coord beam-pair warning removed
    52 #	May 29, 2014: - removed unused code (disabled warning) from ref_lr_w
    52 #	May 29, 2014: - removed unused code (disabled warning) from ref_lr_w
    53 #	Mar 22, 2015: - BUG: mk_prof could bomb because of division-by-zero in return statement
    53 #	Mar 22, 2015: - BUG: mk_prof could bomb because of division-by-zero in return statement
       
    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
    54 
    56 
    55 use strict;
    57 use strict;
    56 
    58 
    57 #======================================================================
    59 #======================================================================
    58 # fake_BT_RANGE(dta ptr)
    60 # fake_BT_RANGE(dta ptr)
   261 #	mk_prof($dta,$check,$filter,$lr_b0,$lr_b1,$min_corr,$max_e,$max_gap);
   263 #	mk_prof($dta,$check,$filter,$lr_b0,$lr_b1,$min_corr,$max_e,$max_gap);
   262 #======================================================================
   264 #======================================================================
   263 
   265 
   264 # calculate reference-layer vertical and incident velocities
   266 # calculate reference-layer vertical and incident velocities
   265 
   267 
   266 sub ref_lr_w($$$$$$$)
   268 sub mk_prof_ref_lr_w($$$$$$$)
   267 {
   269 {
   268 	my($dta,$ens,$rl_b0,$rl_b1,$min_corr,$max_e,$min_pctg) = @_;
   270 	my($dta,$ens,$rl_b0,$rl_b1,$min_corr,$max_e,$min_pctg) = @_;
   269 	my($i,@n,@bn,@v,@vi,@vel,@veli,@bv,@w);
   271 	my($i,@n,@bn,@v,@vi,@vel,@veli,@bv,@w);
   270 	my($w,$e,$nvi,$vi12,$vi43,@vbp,@velbp,@nbp,$w12,$w34,@w12,@w34);
   272 	my($w,$e,$nvi,$vi12,$vi43,@vbp,@velbp,@nbp,$w12,$w34,@w12,@w34);
   271 
   273 
   420 ###		next if ($dta->{ENSEMBLE}[$e]->{BUILT_IN_TEST_ERROR});
   422 ###		next if ($dta->{ENSEMBLE}[$e]->{BUILT_IN_TEST_ERROR});
   421 	
   423 	
   422 		filterEnsemble($dta,$e)
   424 		filterEnsemble($dta,$e)
   423 			if (defined($filter) &&
   425 			if (defined($filter) &&
   424 				$dta->{ENSEMBLE}[$e]->{PERCENT_GOOD}[0][0] > 0);
   426 				$dta->{ENSEMBLE}[$e]->{PERCENT_GOOD}[0][0] > 0);
   425 		ref_lr_w($dta,$e,$lr_b0,$lr_b1,$min_corr,$max_e,$min_pctg);	# ref. layer w
   427 		mk_prof_ref_lr_w($dta,$e,$lr_b0,$lr_b1,$min_corr,$max_e,$min_pctg);	# ref. layer w
   426 	
   428 	
   427 		if (defined($firstgood)) {
   429 		if (defined($firstgood)) {
   428 			$dta->{ENSEMBLE}[$e]->{ELAPSED_TIME} =			# time since start
   430 			$dta->{ENSEMBLE}[$e]->{ELAPSED_TIME} =			# time since start
   429 				$dta->{ENSEMBLE}[$e]->{UNIX_TIME} -
   431 				$dta->{ENSEMBLE}[$e]->{UNIX_TIME} -
   430 				$dta->{ENSEMBLE}[$firstgood]->{UNIX_TIME};
   432 				$dta->{ENSEMBLE}[$firstgood]->{UNIX_TIME};