time_series.pl
author A.M. Thurnherr <athurnherr@yahoo.com>
Sat, 24 Jul 2021 10:35:41 -0400
changeset 56 8f120b9f795a
parent 51 0f6d9e64cc4f
child 60 74fecc295d85
permissions -rw-r--r--
V2.0 - lots of bug fixes - major new features: - dropped CTD scans handled correctly (no more apparent clock drifts) - support for data files collected with Nortek Signature instruments - much improved data editing - significant changes: - no minimum limit for eps_VKE - updated for GMT6 - much better data quality information in summary plots
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
3365828b1004 after DIMES UK2
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
     1
#======================================================================
2
a077ea2a9f36 post 2011_IWISE
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents: 0
diff changeset
     2
#                    T I M E _ S E R I E S . P L 
0
3365828b1004 after DIMES UK2
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
     3
#                    doc: Sun May 23 16:40:53 2010
56
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 51
diff changeset
     4
#                    dlm: Sat Apr 24 11:19:07 2021
0
3365828b1004 after DIMES UK2
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
     5
#                    (c) 2010 A.M. Thurnherr
56
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 51
diff changeset
     6
#                    uE-Info: 26 27 NIL 0 0 72 2 2 4 NIL ofnI
0
3365828b1004 after DIMES UK2
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
     7
#======================================================================
3365828b1004 after DIMES UK2
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
     8
3365828b1004 after DIMES UK2
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
     9
# HISTORY:
3365828b1004 after DIMES UK2
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
    10
#	May 23, 2010: - created from [perl-tools/RDI_Utils.pl]
3365828b1004 after DIMES UK2
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
    11
#	Oct 20, 2010: - disabled max_gap profile-restarting code
3365828b1004 after DIMES UK2
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
    12
#	Dec 17, 2010: - re-added {DEPTH} field to ensembles
3365828b1004 after DIMES UK2
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
    13
#	Dec 18, 2010: - max gap re-enabled
3365828b1004 after DIMES UK2
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
    14
#	Dec 20, 2010: - cosmetics
2
a077ea2a9f36 post 2011_IWISE
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents: 0
diff changeset
    15
#	Jul  2, 2011: - tightened gap-detection code
a077ea2a9f36 post 2011_IWISE
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents: 0
diff changeset
    16
#	Jul  4, 2011: - added support for $skip_ens
3
9c021fdea1ff Before replacing command-line options by default variables.
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 2
diff changeset
    17
#	Oct 11, 2011: - BUG: {DEPTH} had not been set at start of profile
4
e681262d0fd7 yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 3
diff changeset
    18
#	Oct 12, 2011: - re-worked ref_lr_w()
e681262d0fd7 yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 3
diff changeset
    19
#				  - stopped depth integration across gaps >= 5s
13
2788bf1bf1de after DIMES US5
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents: 4
diff changeset
    20
#	Apr 17, 2013: - improved gap message (added ensemble range)
49
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 13
diff changeset
    21
#	Nov 27, 2017: - BUG: gap heuristic could not deal with P06#001
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 13
diff changeset
    22
#				  - BUG: gap heuristic could not deal with P06#025
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 13
diff changeset
    23
#	May  1, 2018: - added reflr u and v calculations
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 13
diff changeset
    24
#				  - BUG: reflr u and v calcs did not work
51
0f6d9e64cc4f before adding dropped-scan correction to LADCP_w_CTD
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 49
diff changeset
    25
#	Apr 21, 2019: - improved surface gap warning message
56
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 51
diff changeset
    26
#	Apr 24, 2021: - output cosmetics
0
3365828b1004 after DIMES UK2
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
    27
3365828b1004 after DIMES UK2
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
    28
# NOTES:
3365828b1004 after DIMES UK2
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
    29
#	- resulting DEPTH field based on integrated w without any sound speed correction
3365828b1004 after DIMES UK2
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
    30
#	- single-ping ensembles assumed, i.e. no percent-good tests applied
3365828b1004 after DIMES UK2
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
    31
#	- specified bin numbers are 1-relative
3365828b1004 after DIMES UK2
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
    32
49
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 13
diff changeset
    33
#----------------------------------------------------------------------
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 13
diff changeset
    34
# Reference-Layer Velocities
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 13
diff changeset
    35
#----------------------------------------------------------------------
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 13
diff changeset
    36
0
3365828b1004 after DIMES UK2
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
    37
sub ref_lr_w($$$$)										# calc ref-layer vert vels
3365828b1004 after DIMES UK2
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
    38
{
3365828b1004 after DIMES UK2
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
    39
	my($dta,$ens,$rl_b0,$rl_b1) = @_;
4
e681262d0fd7 yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 3
diff changeset
    40
	my(@w);
0
3365828b1004 after DIMES UK2
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
    41
4
e681262d0fd7 yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 3
diff changeset
    42
	for (my($bin)=$rl_b0-1; $bin<=$rl_b1-1; $bin++) {
e681262d0fd7 yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 3
diff changeset
    43
		push(@w,$dta->{ENSEMBLE}[$ens]->{W}[$bin])
e681262d0fd7 yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 3
diff changeset
    44
			if defined($dta->{ENSEMBLE}[$ens]->{W}[$bin]);
0
3365828b1004 after DIMES UK2
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
    45
	}
4
e681262d0fd7 yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 3
diff changeset
    46
	return unless (@w);
e681262d0fd7 yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 3
diff changeset
    47
	$dta->{ENSEMBLE}[$ens]->{REFLR_W} = avg(@w);
e681262d0fd7 yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 3
diff changeset
    48
	$dta->{ENSEMBLE}[$ens]->{REFLR_W_STDDEV} = stddev2($dta->{ENSEMBLE}[$ens]->{REFLR_W},@w);
e681262d0fd7 yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 3
diff changeset
    49
	$dta->{ENSEMBLE}[$ens]->{REFLR_W_NSAMP} = @w;
0
3365828b1004 after DIMES UK2
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
    50
}
3365828b1004 after DIMES UK2
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
    51
49
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 13
diff changeset
    52
sub ref_lr_uv($$$$)										# calc ref-layer horiz vels
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 13
diff changeset
    53
{
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 13
diff changeset
    54
	my($dta,$ens,$rl_b0,$rl_b1) = @_;
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 13
diff changeset
    55
	my(@u,@v);
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 13
diff changeset
    56
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 13
diff changeset
    57
	for (my($bin)=$rl_b0-1; $bin<=$rl_b1-1; $bin++) {
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 13
diff changeset
    58
		next unless defined($dta->{ENSEMBLE}[$ens]->{U}[$bin]);
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 13
diff changeset
    59
		die unless numbersp($dta->{ENSEMBLE}[$ens]->{U}[$bin],$dta->{ENSEMBLE}[$ens]->{V}[$bin]);
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 13
diff changeset
    60
		push(@u,$dta->{ENSEMBLE}[$ens]->{U}[$bin]);
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 13
diff changeset
    61
		push(@v,$dta->{ENSEMBLE}[$ens]->{V}[$bin]);
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 13
diff changeset
    62
	}
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 13
diff changeset
    63
	return unless (@u);
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 13
diff changeset
    64
	$dta->{ENSEMBLE}[$ens]->{REFLR_U} = avg(@u); $dta->{ENSEMBLE}[$ens]->{REFLR_V} = avg(@v);
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 13
diff changeset
    65
	$dta->{ENSEMBLE}[$ens]->{REFLR_UV_NSAMP} = @u;
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 13
diff changeset
    66
}
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 13
diff changeset
    67
0
3365828b1004 after DIMES UK2
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
    68
#======================================================================
3365828b1004 after DIMES UK2
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
    69
# ($firstgood,$lastgood,$atbottom,$w_gap_time) =
2
a077ea2a9f36 post 2011_IWISE
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents: 0
diff changeset
    70
#	calcLADCPts($dta,$skip_ens,$lr_b0,$lr_b1,$min_corr,$max_e,$max_gap);
0
3365828b1004 after DIMES UK2
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
    71
#======================================================================
3365828b1004 after DIMES UK2
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
    72
3365828b1004 after DIMES UK2
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
    73
sub calcLADCPts($$$$)
3365828b1004 after DIMES UK2
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
    74
{
2
a077ea2a9f36 post 2011_IWISE
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents: 0
diff changeset
    75
	my($dta,$skip_ens,$rl_b0,$rl_b1,$max_gap) = @_;
0
3365828b1004 after DIMES UK2
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
    76
	my($firstgood,$lastgood,$atbottom,$w_gap_time,$max_depth);
3365828b1004 after DIMES UK2
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
    77
2
a077ea2a9f36 post 2011_IWISE
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents: 0
diff changeset
    78
	for (my($depth)=0,my($e)=$skip_ens; $e<=$#{$dta->{ENSEMBLE}}; $e++) {
0
3365828b1004 after DIMES UK2
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
    79
3365828b1004 after DIMES UK2
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
    80
		ref_lr_w($dta,$e,$rl_b0,$rl_b1);
3365828b1004 after DIMES UK2
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
    81
	
3365828b1004 after DIMES UK2
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
    82
		if (defined($firstgood)) {
3365828b1004 after DIMES UK2
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
    83
			$dta->{ENSEMBLE}[$e]->{ELAPSED} =				# time since start
3365828b1004 after DIMES UK2
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
    84
				$dta->{ENSEMBLE}[$e]->{UNIX_TIME} -
3365828b1004 after DIMES UK2
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
    85
				$dta->{ENSEMBLE}[$firstgood]->{UNIX_TIME};
3365828b1004 after DIMES UK2
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
    86
		} else {
3365828b1004 after DIMES UK2
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
    87
			if (defined($dta->{ENSEMBLE}[$e]->{REFLR_W})) {		# start of prof.
3365828b1004 after DIMES UK2
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
    88
				$firstgood = $lastgood = $e;		    
3365828b1004 after DIMES UK2
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
    89
				$dta->{ENSEMBLE}[$e]->{ELAPSED} = 0;
3
9c021fdea1ff Before replacing command-line options by default variables.
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 2
diff changeset
    90
				$dta->{ENSEMBLE}[$e]->{DEPTH} = $depth;
0
3365828b1004 after DIMES UK2
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
    91
			}
3365828b1004 after DIMES UK2
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
    92
			next;
3365828b1004 after DIMES UK2
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
    93
		}
3365828b1004 after DIMES UK2
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
    94
	
3365828b1004 after DIMES UK2
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
    95
		unless (defined($dta->{ENSEMBLE}[$e]->{REFLR_W})) {				# gap
3365828b1004 after DIMES UK2
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
    96
			$w_gap_time += $dta->{ENSEMBLE}[$e]->{UNIX_TIME} -
3365828b1004 after DIMES UK2
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
    97
						   $dta->{ENSEMBLE}[$e-1]->{UNIX_TIME};
3365828b1004 after DIMES UK2
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
    98
			next;
3365828b1004 after DIMES UK2
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
    99
		}
3365828b1004 after DIMES UK2
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
   100
	
3365828b1004 after DIMES UK2
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
   101
		my($dt) = $dta->{ENSEMBLE}[$e]->{UNIX_TIME} -		# time step since
3365828b1004 after DIMES UK2
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
   102
				  $dta->{ENSEMBLE}[$lastgood]->{UNIX_TIME}; # ... last good ens
3365828b1004 after DIMES UK2
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
   103
	
3365828b1004 after DIMES UK2
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
   104
		if ($dt > $max_gap) {
49
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 13
diff changeset
   105
			if (($max_depth>50 && abs($depth)<0.1*$max_depth) &&					# looks like a profile
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 13
diff changeset
   106
				(@{$dta->{ENSEMBLE}}-$e < 0.25*@{$dta->{ENSEMBLE}})) {				# in the final quartile of the data
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 13
diff changeset
   107
					warning(1,"long gap (%ds) after likely profile (0->%d->%dm) --- finishing at ens#$dta->{ENSEMBLE}[$e]->{NUMBER}\n",
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 13
diff changeset
   108
						$dt,$max_depth,$depth);
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 13
diff changeset
   109
					last;				
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 13
diff changeset
   110
            } elsif ((abs($depth) < 10) ||											# shallow gap at the beginning
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 13
diff changeset
   111
            		 ($depth == $max_depth)) {										# biased in-air data
51
0f6d9e64cc4f before adding dropped-scan correction to LADCP_w_CTD
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 49
diff changeset
   112
            		 	my($md) = defined($max_depth) ? sprintf('%d',$max_depth) : 'undefined';
0f6d9e64cc4f before adding dropped-scan correction to LADCP_w_CTD
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 49
diff changeset
   113
						warning(1,"long surface gap (%ds) --- restarting at ens#$dta->{ENSEMBLE}[$e]->{NUMBER} " .
56
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 51
diff changeset
   114
								  "[depth = %d m; max_depth = $md m]\n",$dt,$depth);
49
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 13
diff changeset
   115
						$firstgood = $lastgood = $e;
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 13
diff changeset
   116
						undef($atbottom); undef($max_depth);
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 13
diff changeset
   117
						$depth = 0;
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 13
diff changeset
   118
						$dta->{ENSEMBLE}[$e]->{ELAPSED} = 0;
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 13
diff changeset
   119
						$dta->{ENSEMBLE}[$e]->{DEPTH} = $depth;
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 13
diff changeset
   120
						$w_gap_time = 0;
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 13
diff changeset
   121
						next;
2
a077ea2a9f36 post 2011_IWISE
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents: 0
diff changeset
   122
			}
a077ea2a9f36 post 2011_IWISE
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents: 0
diff changeset
   123
			if ($dta->{ENSEMBLE}[$e]->{ELAPSED} < 200) {
13
2788bf1bf1de after DIMES US5
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents: 4
diff changeset
   124
				warning(1,"long gap (%ds) at ensembles #$dta->{ENSEMBLE}[$lastgood]->{NUMBER}-$dta->{ENSEMBLE}[$e]->{NUMBER}, %ds into the profile\n",
2
a077ea2a9f36 post 2011_IWISE
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents: 0
diff changeset
   125
					$dt,$dta->{ENSEMBLE}[$e]->{ELAPSED});
a077ea2a9f36 post 2011_IWISE
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents: 0
diff changeset
   126
			} else {
13
2788bf1bf1de after DIMES US5
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents: 4
diff changeset
   127
				warning(1,"long gap (%ds) at ensembles #$dta->{ENSEMBLE}[$lastgood]->{NUMBER}-$dta->{ENSEMBLE}[$e]->{NUMBER}, %.1fmin into the profile\n",
2
a077ea2a9f36 post 2011_IWISE
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents: 0
diff changeset
   128
					$dt,$dta->{ENSEMBLE}[$e]->{ELAPSED}/60);
a077ea2a9f36 post 2011_IWISE
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents: 0
diff changeset
   129
			}
0
3365828b1004 after DIMES UK2
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
   130
		}
3365828b1004 after DIMES UK2
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
   131
	
4
e681262d0fd7 yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 3
diff changeset
   132
		$depth += $dta->{ENSEMBLE}[$lastgood]->{REFLR_W} * $dt			# integrate
e681262d0fd7 yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 3
diff changeset
   133
			if ($dt < 5);
0
3365828b1004 after DIMES UK2
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
   134
		$dta->{ENSEMBLE}[$e]->{DEPTH} = $depth;
3365828b1004 after DIMES UK2
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
   135
	
3365828b1004 after DIMES UK2
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
   136
		$atbottom = $e, $max_depth = $depth if ($depth > $max_depth); 
3365828b1004 after DIMES UK2
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
   137
		$lastgood = $e;
3365828b1004 after DIMES UK2
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
   138
	}
4
e681262d0fd7 yay! first version I am really happy with. With plots 'n all.
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 3
diff changeset
   139
49
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 13
diff changeset
   140
	for (my($e)=$firstgood; $e<=$lastgood; $e++) {						# calculate u and v
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 13
diff changeset
   141
		ref_lr_uv($dta,$e,$rl_b0,$rl_b1);
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 13
diff changeset
   142
	}
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 13
diff changeset
   143
0
3365828b1004 after DIMES UK2
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
   144
	return ($firstgood,$lastgood,$atbottom,$w_gap_time);
3365828b1004 after DIMES UK2
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
   145
}
3365828b1004 after DIMES UK2
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
   146
49
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 13
diff changeset
   147
#----------------------------------------------------------------------
A.M. Thurnherr <athurnherr@yahoo.com>
parents: 13
diff changeset
   148
0
3365828b1004 after DIMES UK2
A.M. Thurnherr <ant@ldeo.columbia.edu>
parents:
diff changeset
   149
1;