247 $maxdt1 = $dt1 if ($dt1 > $maxdt1); |
250 $maxdt1 = $dt1 if ($dt1 > $maxdt1); |
248 $maxdt2 = $dt2 if ($dt2 > $maxdt2); |
251 $maxdt2 = $dt2 if ($dt2 > $maxdt2); |
249 $sdt1 += $dt1; $sdt2 += $dt2; |
252 $sdt1 += $dt1; $sdt2 += $dt2; |
250 } |
253 } |
251 |
254 |
252 printf(STDERR "Ping intervals : %.1fs/%.1fs (%.1fs-%.1fs/%.1fs-%.1fs)\n", |
255 printf(STDERR "Ping intervals : %.1fs/%.1fs",$sdt1/$ndt,$sdt2/$ndt); |
253 $sdt1/$ndt,$sdt2/$ndt,$mindt1,$maxdt1,$mindt2,$maxdt2); |
256 if ($maxdt1-$mindt1>=0.1 || $maxdt2-$mindt2>=0.1) { |
|
257 printf(STDERR " (%.1fs-%.1fs/%.1fs-%.1fs)\n",$mindt1,$maxdt1,$mindt2,$maxdt2); |
|
258 } else { |
|
259 print(STDERR "\n"); |
|
260 } |
254 |
261 |
255 #====================================================================== |
262 #====================================================================== |
256 # Step 1: Integrate w & determine water depth |
263 # Step 1: Integrate w & determine water depth |
257 #====================================================================== |
264 #====================================================================== |
258 |
265 |
259 ($firstgood,$lastgood,$atbottom,$w_gap_time,$zErr,$maxz) = |
266 ($firstgood,$lastgood,$atbottom,$w_gap_time,$zErr,$maxz,$rms_heave_accel) = |
260 mk_prof(\%dta,!$opt_s,$opt_F,$minb,$maxb,$opt_c,$opt_e,$opt_m); |
267 mk_prof(\%dta,!$opt_s,$opt_F,$minb,$maxb,$opt_c,$opt_e,$opt_m); |
261 |
268 |
262 unless (($atbottom > $firstgood) && ($lastgood > $atbottom)) { |
269 unless (($atbottom > $firstgood) && ($lastgood > $atbottom)) { |
263 if ($opt_Q) { |
270 if ($opt_Q) { |
264 print(STDERR "$ARGV[0]: no valid cast data found\n"); |
271 print(STDERR "$ARGV[0]: no valid cast data found\n"); |
290 } |
297 } |
291 } |
298 } |
292 |
299 |
293 ($water_depth,$sig_wd) = # sea bed |
300 ($water_depth,$sig_wd) = # sea bed |
294 find_seabed(\%dta,$atbottom,$beamCoords); |
301 find_seabed(\%dta,$atbottom,$beamCoords); |
295 |
|
296 #====================================================================== |
|
297 # Step 1a: determine alternate Z by using mean/sigma of w in gaps |
|
298 #====================================================================== |
|
299 |
|
300 # This does not make much sense for w, because w is always very close |
|
301 # to zero. It might make sense for u and v, though, and it would |
|
302 # be more consistent with the way the displacement uncertainties are |
|
303 # calculated. However, the way the profiles are calculated at the |
|
304 # moment (using the last valid velocity across the gap) is probably |
|
305 # closer to the truth in most cases. |
|
306 |
|
307 #$dta{ENSEMBLE}[$firstgood]->{ALT_Z} = 0; |
|
308 #$dta{ENSEMBLE}[$firstgood]->{ALT_Z_ERR} = 0; |
|
309 #my($sumVar); |
|
310 #for ($e=$firstgood+1; $e<=$lastgood; $e++) { |
|
311 # my($dt) = $dta{ENSEMBLE}[$e]->{UNIX_TIME} - |
|
312 # $dta{ENSEMBLE}[$e-1]->{UNIX_TIME}; |
|
313 # $dta{ENSEMBLE}[$e]->{ALT_Z} = |
|
314 # $dta{ENSEMBLE}[$e-1]->{ALT_Z} + |
|
315 # $dt * (defined($dta{ENSEMBLE}[$e-1]->{W}) ? |
|
316 # $dta{ENSEMBLE}[$e-1]->{W} : $meanW); |
|
317 # $sumVar += defined($dta{ENSEMBLE}[$e-1]->{W}) ? |
|
318 # ($dta{ENSEMBLE}[$e-1]->{W_ERR} * $dt)**2 : ($dt**2)*$varW; |
|
319 # $dta{ENSEMBLE}[$e]->{ALT_Z_ERR} = sqrt($sumVar); |
|
320 #} |
|
321 |
302 |
322 #====================================================================== |
303 #====================================================================== |
323 # Step 2: Integrate u & v |
304 # Step 2: Integrate u & v |
324 #====================================================================== |
305 #====================================================================== |
325 |
306 |
674 |
656 |
675 #====================================================================== |
657 #====================================================================== |
676 # PRODUCE OUTPUT |
658 # PRODUCE OUTPUT |
677 #====================================================================== |
659 #====================================================================== |
678 |
660 |
679 printf(STDERR "Start of cast : %s (#%5d) at %6.1fm\n", |
661 printf(STDERR "Start of cast : %s (#%5d) at %6.1fm\n", |
680 $dta{ENSEMBLE}[$firstgood]->{TIME}, |
662 $dta{ENSEMBLE}[$firstgood]->{TIME}, |
681 $dta{ENSEMBLE}[$firstgood]->{NUMBER}, |
663 $dta{ENSEMBLE}[$firstgood]->{NUMBER}, |
682 $dta{ENSEMBLE}[$firstgood]->{DEPTH}); |
664 $dta{ENSEMBLE}[$firstgood]->{DEPTH}); |
683 printf(STDERR "Bottom of cast (zmax): %s (#%5d) at %6.1fm\n", |
665 printf(STDERR "Bottom of cast (zmax) : %s (#%5d) at %6.1fm\n", |
684 $dta{ENSEMBLE}[$atbottom]->{TIME}, |
666 $dta{ENSEMBLE}[$atbottom]->{TIME}, |
685 $dta{ENSEMBLE}[$atbottom]->{NUMBER}, |
667 $dta{ENSEMBLE}[$atbottom]->{NUMBER}, |
686 $dta{ENSEMBLE}[$atbottom]->{DEPTH}); |
668 $dta{ENSEMBLE}[$atbottom]->{DEPTH}); |
687 if (defined($water_depth)) { |
669 if (defined($water_depth)) { |
688 printf(STDERR "Seabed : at %6.1fm (+-%dm)\n",$water_depth,$sig_wd); |
670 printf(STDERR "Seabed : at %6.1fm (+-%dm)\n",$water_depth,$sig_wd); |
689 } else { |
671 } else { |
690 print(STDERR "Seabed : not found\n"); |
672 print(STDERR "Seabed : not found\n"); |
691 } |
673 } |
692 printf(STDERR "End of cast (zend) : %s (#%5d) at %6.1fm\n", |
674 printf(STDERR "End of cast (zend) : %s (#%5d) at %6.1fm\n", |
693 $dta{ENSEMBLE}[$lastgood]->{TIME}, |
675 $dta{ENSEMBLE}[$lastgood]->{TIME}, |
694 $dta{ENSEMBLE}[$lastgood]->{NUMBER}, |
676 $dta{ENSEMBLE}[$lastgood]->{NUMBER}, |
695 $dta{ENSEMBLE}[$lastgood]->{DEPTH}); |
677 $dta{ENSEMBLE}[$lastgood]->{DEPTH}); |
696 |
678 |
697 printf(STDERR "Rel. Displacement : x = %d(%d)m / y = %d(%d)m\n", |
679 printf(STDERR "Rel. Displacement : x = %d(%d)m / y = %d(%d)m\n", |
698 $dta{ENSEMBLE}[$lastgood]->{X}, $x_err, |
680 $dta{ENSEMBLE}[$lastgood]->{X}, $x_err, |
699 $dta{ENSEMBLE}[$lastgood]->{Y}, $y_err, |
681 $dta{ENSEMBLE}[$lastgood]->{Y}, $y_err, |
700 ) if defined($opt_M); |
682 ) if defined($opt_M); |
701 |
683 |
702 printf(STDERR "Cast Duration : %.1f hours (pinging for %.1f hours)\n", |
684 printf(STDERR "Cast Duration : %.1f hours (pinging for %.1f hours)\n", |
703 $dta{ENSEMBLE}[$lastgood]->{ELAPSED_TIME} / 3600, |
685 $dta{ENSEMBLE}[$lastgood]->{ELAPSED_TIME} / 3600, |
704 ($dta{ENSEMBLE}[$#{$dta{ENSEMBLE}}]->{UNIX_TIME} - |
686 ($dta{ENSEMBLE}[$#{$dta{ENSEMBLE}}]->{UNIX_TIME} - |
705 $dta{ENSEMBLE}[0]->{UNIX_TIME}) / 3600); |
687 $dta{ENSEMBLE}[0]->{UNIX_TIME}) / 3600); |
706 |
688 |
707 printf(STDERR "Minimum range : %dm at ensemble %d, beam %d\n", |
689 printf(STDERR "Minimum range : %dm at ensemble %d, beam %d\n", |
708 $dta{DISTANCE_TO_BIN1_CENTER} + |
690 $dta{DISTANCE_TO_BIN1_CENTER} + |
709 $min_good_bins*$dta{BIN_LENGTH}, |
691 $min_good_bins*$dta{BIN_LENGTH}, |
710 $dta{ENSEMBLE}[$min_good_ens]->{NUMBER}, |
692 $dta{ENSEMBLE}[$min_good_ens]->{NUMBER}, |
711 $worst_beam); |
693 $worst_beam); |
712 printf(STDERR "80%%-valid bins : %.1f\n",$gb+1); |
694 printf(STDERR "80%%-valid bins : %.1f\n",$gb+1); |
713 printf(STDERR "80%%-valid range : %dm\n", |
695 printf(STDERR "80%%-valid range : %dm\n", |
714 $dta{DISTANCE_TO_BIN1_CENTER} + $gb*$dta{BIN_LENGTH}); |
696 $dta{DISTANCE_TO_BIN1_CENTER} + $gb*$dta{BIN_LENGTH}); |
715 printf(STDERR "3-beam solutions : $RDI_Coords::threeBeam_1 " . |
697 printf(STDERR "3-beam solutions : $RDI_Coords::threeBeam_1 " . |
716 "$RDI_Coords::threeBeam_2 " . |
698 "$RDI_Coords::threeBeam_2 " . |
717 "$RDI_Coords::threeBeam_3 " . |
699 "$RDI_Coords::threeBeam_3 " . |
718 "$RDI_Coords::threeBeam_4\n") |
700 "$RDI_Coords::threeBeam_4\n") |
719 unless ($opt_4); |
701 unless ($opt_4); |
720 printf(STDERR "net rotations : [%d]/%d/%d/[%d]\n",$prerot,$dnrot,$uprot,$postrot); |
702 printf(STDERR "net rotations : [%d]/%d/%d/[%d]\n",$prerot,$dnrot,$uprot,$postrot); |
721 printf(STDERR "rms pitch/roll : %.1f/%.1f\n",$dnprrms,$upprrms); |
703 printf(STDERR "rms pitch/roll : %.1fdeg/%.1fdeg\n",$dnprrms,$upprrms); |
|
704 printf(STDERR "rms heave acceleration: %.2fm/s^2\n",$rms_heave_accel); |
722 |
705 |
723 exit(0) if ($opt_Q); |
706 exit(0) if ($opt_Q); |
724 |
707 |
725 #---------------------------------------------------------------------- |
708 #---------------------------------------------------------------------- |
726 # output profile in active ANTS format |
709 # output profile in active ANTS format |
774 $dta{ENSEMBLE}[$firstgood]->{DEPTH}, |
758 $dta{ENSEMBLE}[$firstgood]->{DEPTH}, |
775 $dta{DISTANCE_TO_BIN1_CENTER} + |
759 $dta{DISTANCE_TO_BIN1_CENTER} + |
776 $min_good_bins*$dta{BIN_LENGTH}, |
760 $min_good_bins*$dta{BIN_LENGTH}, |
777 scalar(@{$dta{ENSEMBLE}}), |
761 scalar(@{$dta{ENSEMBLE}}), |
778 $w_gap_time,$wErr,$prrms,$dnprrms,$upprrms,$rotrms, |
762 $w_gap_time,$wErr,$prrms,$dnprrms,$upprrms,$rotrms, |
779 $prerot,$dnrot,$uprot,$postrot, |
763 $prerot,$dnrot,$uprot,$postrot,$rms_heave_accel, |
780 $dta{DISTANCE_TO_BIN1_CENTER}, |
764 $dta{DISTANCE_TO_BIN1_CENTER}, |
781 $dta{BIN_LENGTH}, |
765 $dta{BIN_LENGTH}, |
782 ); |
766 ); |
783 printf("#ANTS#PARAMS# magnetic_declination{$opt_M} " . |
767 printf("#ANTS#PARAMS# magnetic_declination{$opt_M} " . |
784 "uv_gap_time{%d} " . |
768 "uv_gap_time{%d} " . |