RDI_Utils.pl
changeset 3 f3c9dcbbdd68
parent 2 065ea9ce12fc
child 4 7e43b24080af
equal deleted inserted replaced
2:065ea9ce12fc 3:f3c9dcbbdd68
     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: Wed Oct 20 14:41:17 2010
     4 #                    dlm: Fri Dec 10 14:39:58 2010
     5 #                    (c) 2003 A.M. Thurnherr
     5 #                    (c) 2003 A.M. Thurnherr
     6 #                    uE-Info: 35 84 NIL 0 0 72 2 2 4 NIL ofnI
     6 #                    uE-Info: 37 42 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:
    30 #	May 23, 2010: - renamed Z to DEPTH
    30 #	May 23, 2010: - renamed Z to DEPTH
    31 #	Sep 27, 2010: - made sure coord flags are changed correctly when data
    31 #	Sep 27, 2010: - made sure coord flags are changed correctly when data
    32 #					are transferred to earth coords in mk_prof
    32 #					are transferred to earth coords in mk_prof
    33 #	Sep 29, 2010: - BUG: previous change was wrong, as ref_lr_w does
    33 #	Sep 29, 2010: - BUG: previous change was wrong, as ref_lr_w does
    34 #						 not overwrite velocities
    34 #						 not overwrite velocities
    35 #	Oct 20, 2010: - BUG: w is now not integrated any more across gaps longer than 5s 
    35 #	Oct 20, 2010: - BUG: w is now not integrated any more across gaps longer than 5s
       
    36 #	Dec  8, 2010: - changed missing w warning to happen only if gap is longer than 15s
       
    37 #	Dec 10, 2010: - beautified gap warning
    36 
    38 
    37 use strict;
    39 use strict;
    38 
    40 
    39 #======================================================================
    41 #======================================================================
    40 # fake_BT_RANGE(dta ptr)
    42 # fake_BT_RANGE(dta ptr)
   340 		#-----------------------------------
   342 		#-----------------------------------
   341 	
   343 	
   342 		if ($dt < 5) {
   344 		if ($dt < 5) {
   343 			$z += $dta->{ENSEMBLE}[$lastgood]->{W} * $dt;			# integrate
   345 			$z += $dta->{ENSEMBLE}[$lastgood]->{W} * $dt;			# integrate
   344 			$zErr += ($dta->{ENSEMBLE}[$lastgood]->{W_ERR} * $dt)**2;
   346 			$zErr += ($dta->{ENSEMBLE}[$lastgood]->{W_ERR} * $dt)**2;
   345 		} else {
   347 		} elsif ($dt > 15) {
   346 	       	print(STDERR "WARNING: gap (dt=$dt) --- w discarded\n");
   348 	       	printf(STDERR "WARNING: long-ish w gap (dt=%ds)\n",$dt);
   347 		}
   349 		}
   348 	
   350 	
   349 		$dta->{ENSEMBLE}[$e]->{DEPTH} = $z;
   351 		$dta->{ENSEMBLE}[$e]->{DEPTH} = $z;
   350 		$dta->{ENSEMBLE}[$e]->{DEPTH_ERR} = sqrt($zErr);
   352 		$dta->{ENSEMBLE}[$e]->{DEPTH_ERR} = sqrt($zErr);
   351 	
   353