RDI_Utils.pl
changeset 19 e23a5fd2923a
parent 17 591779f6df30
child 23 fb0c269b1eaa
equal deleted inserted replaced
18:bb7bb9f83db9 19:e23a5fd2923a
     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: Sat Feb 22 16:57:30 2014
     4 #                    dlm: Thu May 29 09:23:46 2014
     5 #                    (c) 2003 A.M. Thurnherr
     5 #                    (c) 2003 A.M. Thurnherr
     6 #                    uE-Info: 463 0 NIL 0 0 72 10 2 4 NIL ofnI
     6 #                    uE-Info: 302 0 NIL 0 0 72 10 2 4 NIL ofnI
     7 #======================================================================
     7 #======================================================================
     8 
     8 
     9 # miscellaneous RDI-specific utilities
     9 # miscellaneous RDI-specific utilities
    10 
    10 
    11 # History:
    11 # History:
    47 #	Jun 20, 2013: - BUG: warning had used &antsInfo()
    47 #	Jun 20, 2013: - BUG: warning had used &antsInfo()
    48 #	Feb 13, 2014: - replaced {DEPTH_BT} by {seabed}
    48 #	Feb 13, 2014: - replaced {DEPTH_BT} by {seabed}
    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 
    53 
    53 use strict;
    54 use strict;
    54 
    55 
    55 #======================================================================
    56 #======================================================================
    56 # fake_BT_RANGE(dta ptr)
    57 # fake_BT_RANGE(dta ptr)
   259 #	mk_prof($dta,$check,$filter,$lr_b0,$lr_b1,$min_corr,$max_e,$max_gap);
   260 #	mk_prof($dta,$check,$filter,$lr_b0,$lr_b1,$min_corr,$max_e,$max_gap);
   260 #======================================================================
   261 #======================================================================
   261 
   262 
   262 # calculate reference-layer vertical and incident velocities
   263 # calculate reference-layer vertical and incident velocities
   263 
   264 
   264 { my($warned);	# static scope
       
   265 
       
   266 sub ref_lr_w($$$$$$$)
   265 sub ref_lr_w($$$$$$$)
   267 {
   266 {
   268 	my($dta,$ens,$rl_b0,$rl_b1,$min_corr,$max_e,$min_pctg) = @_;
   267 	my($dta,$ens,$rl_b0,$rl_b1,$min_corr,$max_e,$min_pctg) = @_;
   269 	my($i,@n,@bn,@v,@vi,@vel,@veli,@bv,@w);
   268 	my($i,@n,@bn,@v,@vi,@vel,@veli,@bv,@w);
   270 	my($w,$e,$nvi,$vi12,$vi43,@vbp,@velbp,@nbp,$w12,$w34,@w12,@w34);
   269 	my($w,$e,$nvi,$vi12,$vi43,@vbp,@velbp,@nbp,$w12,$w34,@w12,@w34);
   294 			next if ($dta->{ENSEMBLE}[$ens]->{PERCENT_GOOD}[$i][0] > 0 ||
   293 			next if ($dta->{ENSEMBLE}[$ens]->{PERCENT_GOOD}[$i][0] > 0 ||
   295 					 $dta->{ENSEMBLE}[$ens]->{PERCENT_GOOD}[$i][1] > 0 ||
   294 					 $dta->{ENSEMBLE}[$ens]->{PERCENT_GOOD}[$i][1] > 0 ||
   296 					 $dta->{ENSEMBLE}[$ens]->{PERCENT_GOOD}[$i][2] > 0 ||
   295 					 $dta->{ENSEMBLE}[$ens]->{PERCENT_GOOD}[$i][2] > 0 ||
   297 					 $dta->{ENSEMBLE}[$ens]->{PERCENT_GOOD}[$i][3] < $min_pctg);
   296 					 $dta->{ENSEMBLE}[$ens]->{PERCENT_GOOD}[$i][3] < $min_pctg);
   298 			@v = @{$dta->{ENSEMBLE}[$ens]->{VELOCITY}[$i]};
   297 			@v = @{$dta->{ENSEMBLE}[$ens]->{VELOCITY}[$i]};
   299 			unless ($warned) {
       
   300 ###				print(STDERR "WARNING: incident-flow & beam-pair velocities not yet implemented for earth coordinates");
       
   301 				$warned = 1;
       
   302 			}
       
   303 		}
   298 		}
   304 ###		next if (!defined($v[3]) || abs($v[3]) > $max_e);		# disallow 3-beam solutions
   299 ###		next if (!defined($v[3]) || abs($v[3]) > $max_e);		# disallow 3-beam solutions
   305 		next if (defined($v[3]) && abs($v[3]) > $max_e);		# allow 3-beam solutions
   300 		next if (defined($v[3]) && abs($v[3]) > $max_e);		# allow 3-beam solutions
   306 
   301 
   307 		if (defined($v[2])) {									# valid velocity
   302 		if (defined($v[2])) {									# valid vertical velocity
   308 			$vel[2] += $v[2]; $n[2]++;							# vertical velocity
   303 			$vel[2] += $v[2]; $n[2]++;							# vertical velocity
   309 			$vel[3] += $v[3], $n[3]++ if defined($v[3]);		# error velocity
   304 			$vel[3] += $v[3], $n[3]++ if defined($v[3]);		# error velocity
   310 			push(@w,$v[2]); 									# save for stderr calculation
   305 			push(@w,$v[2]); 									# save for stderr calculation
   311 		}
   306 		}
   312 
   307 
   404 #		$dta->{ENSEMBLE}[$ens]->{V3} = $bn[2]>=2 ? $bv[2]/$bn[2] : undef;
   399 #		$dta->{ENSEMBLE}[$ens]->{V3} = $bn[2]>=2 ? $bv[2]/$bn[2] : undef;
   405 #	    $dta->{ENSEMBLE}[$ens]->{V4} = $bn[3]>=2 ? $bv[3]/$bn[3] : undef;
   400 #	    $dta->{ENSEMBLE}[$ens]->{V4} = $bn[3]>=2 ? $bv[3]/$bn[3] : undef;
   406 #	}
   401 #	}
   407 
   402 
   408 }
   403 }
   409 
       
   410 } # static scope
       
   411 
   404 
   412 
   405 
   413 sub mk_prof(...)											# make profile
   406 sub mk_prof(...)											# make profile
   414 {
   407 {
   415 	my($dta,$check,$filter,$lr_b0,$lr_b1,$min_corr,$max_e,$max_gap,$min_pctg) = @_;
   408 	my($dta,$check,$filter,$lr_b0,$lr_b1,$min_corr,$max_e,$max_gap,$min_pctg) = @_;