equal
deleted
inserted
replaced
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: Fri Dec 10 14:51:41 2010 |
4 # dlm: Thu Dec 16 05:36:27 2010 |
5 # (c) 2003 A.M. Thurnherr |
5 # (c) 2003 A.M. Thurnherr |
6 # uE-Info: 349 0 NIL 0 0 72 2 2 4 NIL ofnI |
6 # uE-Info: 333 65 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: |
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 |
36 # Dec 8, 2010: - changed missing w warning to happen only if gap is longer than 15s |
37 # Dec 10, 2010: - beautified gap warning |
37 # Dec 10, 2010: - beautified gap warning |
|
38 # Dec 16, 2010: - BUG: gaps at end caused mk_prof to throw away profile |
38 |
39 |
39 use strict; |
40 use strict; |
40 |
41 |
41 #====================================================================== |
42 #====================================================================== |
42 # fake_BT_RANGE(dta ptr) |
43 # fake_BT_RANGE(dta ptr) |
326 |
327 |
327 my($dt) = $dta->{ENSEMBLE}[$e]->{UNIX_TIME} - # time step since |
328 my($dt) = $dta->{ENSEMBLE}[$e]->{UNIX_TIME} - # time step since |
328 $dta->{ENSEMBLE}[$lastgood]->{UNIX_TIME}; # ... last good ens |
329 $dta->{ENSEMBLE}[$lastgood]->{UNIX_TIME}; # ... last good ens |
329 |
330 |
330 if ($dt > $max_gap) { |
331 if ($dt > $max_gap) { |
331 printf(STDERR "WARNING: %d-s gap too long, profile restarted at ensemble $e\n",$dt); |
332 if ($dta->{ENSEMBLE}[$lastgood]->{UNIX_TIME} - |
|
333 $dta->{ENSEMBLE}[$firstgood]->{UNIX_TIME} > 15*60) { |
|
334 printf(STDERR "WARNING: %.1f-s gap too long, profile ended at ensemble $lastgood\n",$dt); |
|
335 last; |
|
336 } |
|
337 printf(STDERR "WARNING: %.1f-s gap too long, profile restarted at ensemble $e\n",$dt); |
332 $firstgood = $lastgood = $e; |
338 $firstgood = $lastgood = $e; |
333 $dta->{ENSEMBLE}[$e]->{ELAPSED_TIME} = 0; |
339 $dta->{ENSEMBLE}[$e]->{ELAPSED_TIME} = 0; |
334 $z = $zErr = $maxz = 0; |
340 $z = $zErr = $maxz = 0; |
335 $dta->{ENSEMBLE}[$e]->{DEPTH} = $dta->{ENSEMBLE}[$e]->{DEPTH_ERR} = 0; |
341 $dta->{ENSEMBLE}[$e]->{DEPTH} = $dta->{ENSEMBLE}[$e]->{DEPTH_ERR} = 0; |
336 $w_gap_time = 0; |
342 $w_gap_time = 0; |
343 |
349 |
344 if ($dt < 5) { |
350 if ($dt < 5) { |
345 $z += $dta->{ENSEMBLE}[$lastgood]->{W} * $dt; # integrate |
351 $z += $dta->{ENSEMBLE}[$lastgood]->{W} * $dt; # integrate |
346 $zErr += ($dta->{ENSEMBLE}[$lastgood]->{W_ERR} * $dt)**2; |
352 $zErr += ($dta->{ENSEMBLE}[$lastgood]->{W_ERR} * $dt)**2; |
347 } elsif ($dt > 15) { |
353 } elsif ($dt > 15) { |
348 printf(STDERR "WARNING: long-ish w gap (dt=%ds)\n",$dt); |
354 printf(STDERR "WARNING: long-ish w gap (dt=%.1fs)\n",$dt); |
349 } |
355 } |
350 |
356 |
351 $dta->{ENSEMBLE}[$e]->{DEPTH} = $z; |
357 $dta->{ENSEMBLE}[$e]->{DEPTH} = $z; |
352 $dta->{ENSEMBLE}[$e]->{DEPTH_ERR} = sqrt($zErr); |
358 $dta->{ENSEMBLE}[$e]->{DEPTH_ERR} = sqrt($zErr); |
353 |
359 |