686 "$RDI_Coords::threeBeam_4\n") |
685 "$RDI_Coords::threeBeam_4\n") |
687 unless ($opt_4); |
686 unless ($opt_4); |
688 printf(STDERR "net rotations : [%d]/%d/%d/[%d]\n",$prerot,$dnrot,$uprot,$postrot); |
687 printf(STDERR "net rotations : [%d]/%d/%d/[%d]\n",$prerot,$dnrot,$uprot,$postrot); |
689 printf(STDERR "rms pitch/roll : %.1f/%.1f\n",$dnprrms,$upprrms); |
688 printf(STDERR "rms pitch/roll : %.1f/%.1f\n",$dnprrms,$upprrms); |
690 |
689 |
691 if ($opt_A) { # ANTS format |
690 exit(0) if ($opt_Q); |
692 print("#ANTS# [] $USAGE\n"); |
691 |
693 $uFields = "{u} {u_err} {v} {v_err} {x} {x_err} {y} {y_err}" |
692 #---------------------------------------------------------------------- |
694 if defined($opt_M); |
693 # output profile in active ANTS format |
695 print("#ANTS#FIELDS# {ens} {time} {elapsed} {secno} {downcast} " . |
694 #---------------------------------------------------------------------- |
696 "{w} {w_err} {depth} {depth_err} {depth_BT} " . |
695 |
697 "{pitchroll} {rotation} " . |
696 print("#!/usr/bin/perl -S list\n"); |
698 "$uFields $addFields\n"); |
697 chmod(0777&~umask,*STDOUT); |
699 |
698 |
700 printf("#ANTS#PARAMS# date{$dta{ENSEMBLE}[$firstgood]->{DATE}} " . |
699 print("#ANTS# [] $USAGE\n"); |
701 "start_time{$dta{ENSEMBLE}[$firstgood]->{TIME}} " . |
700 $uFields = "{u} {u_err} {v} {v_err} {x} {x_err} {y} {y_err}" |
702 "bottom_time{$dta{ENSEMBLE}[$atbottom]->{TIME}} " . |
701 if defined($opt_M); |
703 "end_time{$dta{ENSEMBLE}[$lastgood]->{TIME}} " . |
702 print("#ANTS#FIELDS# {ens} {time} {elapsed} {secno} {downcast} " . |
704 "bottom_xmit_voltage{$dta{ENSEMBLE}[$atbottom]->{ADC_XMIT_VOLTAGE}} " . |
703 "{w} {w_err} {depth} {depth_err} {depth_BT} " . |
705 "bottom_xmit_current{$dta{ENSEMBLE}[$atbottom]->{ADC_XMIT_CURRENT}} " . |
704 "{pitchroll} {rotation} " . |
706 "pinging_duration{%.1f} " . |
705 "$uFields $addFields\n"); |
707 "cast_duration{%.1f} " . |
706 |
708 "0.8_valid_bins{%.1f} " . |
707 printf("#ANTS#PARAMS# date{$dta{ENSEMBLE}[$firstgood]->{DATE}} " . |
709 "0.8_valid_range{%.1f} " . |
708 "start_time{$dta{ENSEMBLE}[$firstgood]->{TIME}} " . |
710 "max_depth{%.1f} " . |
709 "bottom_time{$dta{ENSEMBLE}[$atbottom]->{TIME}} " . |
711 "depth_error{%.1f} " . |
710 "end_time{$dta{ENSEMBLE}[$lastgood]->{TIME}} " . |
712 "min_range{%d} " . |
711 "bottom_xmit_voltage{$dta{ENSEMBLE}[$atbottom]->{ADC_XMIT_VOLTAGE}} " . |
713 "n_ensembles{%d} " . |
712 "bottom_xmit_current{$dta{ENSEMBLE}[$atbottom]->{ADC_XMIT_CURRENT}} " . |
714 "w_gap_time{%d} " . |
713 "pinging_duration{%.1f} " . |
715 "stderr_w{%.4f} " . |
714 "cast_duration{%.1f} " . |
716 "rms_pitchroll{%.1f} " . |
715 "0.8_valid_bins{%.1f} " . |
717 "downcast_rms_pitchroll{%.1f} " . |
716 "0.8_valid_range{%.1f} " . |
718 "upcast_rms_pitchroll{%.1f} " . |
717 "max_depth{%.1f} " . |
719 "rms_rotation{%.2f} " . |
718 "depth_error{%.1f} " . |
720 "deployment_rotations{%d} " . |
719 "min_range{%d} " . |
721 "downcast_rotations{%d} " . |
720 "n_ensembles{%d} " . |
722 "upcast_rotations{%d} " . |
721 "w_gap_time{%d} " . |
723 "recovery_rotations{%d} " . |
722 "stderr_w{%.4f} " . |
724 "bin1_dist{%.1f} " . |
723 "rms_pitchroll{%.1f} " . |
725 "bin_length{%.1f} " . |
724 "downcast_rms_pitchroll{%.1f} " . |
726 "\n", |
725 "upcast_rms_pitchroll{%.1f} " . |
727 ($dta{ENSEMBLE}[$#{$dta{ENSEMBLE}}]->{UNIX_TIME} - |
726 "rms_rotation{%.2f} " . |
728 $dta{ENSEMBLE}[0]->{UNIX_TIME}), |
727 "deployment_rotations{%d} " . |
729 $dta{ENSEMBLE}[$lastgood]->{ELAPSED_TIME}, |
728 "downcast_rotations{%d} " . |
730 $gb+1, |
729 "upcast_rotations{%d} " . |
731 $dta{DISTANCE_TO_BIN1_CENTER} + $gb*$dta{BIN_LENGTH}, |
730 "recovery_rotations{%d} " . |
732 $dta{ENSEMBLE}[$atbottom]->{DEPTH}, |
731 "bin1_dist{%.1f} " . |
733 $dta{ENSEMBLE}[$lastgood]->{DEPTH} - |
732 "bin_length{%.1f} " . |
734 $dta{ENSEMBLE}[$firstgood]->{DEPTH}, |
733 "\n", |
735 $dta{DISTANCE_TO_BIN1_CENTER} + |
734 ($dta{ENSEMBLE}[$#{$dta{ENSEMBLE}}]->{UNIX_TIME} - |
736 $min_good_bins*$dta{BIN_LENGTH}, |
735 $dta{ENSEMBLE}[0]->{UNIX_TIME}), |
737 scalar(@{$dta{ENSEMBLE}}), |
|
738 $w_gap_time,$wErr,$prrms,$dnprrms,$upprrms,$rotrms, |
|
739 $prerot,$dnrot,$uprot,$postrot, |
|
740 $dta{DISTANCE_TO_BIN1_CENTER}, |
|
741 $dta{BIN_LENGTH}, |
|
742 ); |
|
743 printf("#ANTS#PARAMS# magnetic_declination{$opt_M} " . |
|
744 "uv_gap_time{%d} " . |
|
745 "mean_u{%.4f} " . |
|
746 "stderr_u{%.4f} " . |
|
747 "dx{%d} " . |
|
748 "dx_err{%d} " . |
|
749 "mean_v{%.4f} " . |
|
750 "stderr_v{%.4f} " . |
|
751 "dy{%d} " . |
|
752 "dy_err{%d}\n", |
|
753 $uv_gap_time, |
|
754 $dta{ENSEMBLE}[$lastgood]->{X} / |
|
755 $dta{ENSEMBLE}[$lastgood]->{ELAPSED_TIME}, |
736 $dta{ENSEMBLE}[$lastgood]->{ELAPSED_TIME}, |
756 $uErr, $dta{ENSEMBLE}[$lastgood]->{X}, $x_err, |
737 $gb+1, |
757 $dta{ENSEMBLE}[$lastgood]->{Y} / |
738 $dta{DISTANCE_TO_BIN1_CENTER} + $gb*$dta{BIN_LENGTH}, |
758 $dta{ENSEMBLE}[$lastgood]->{ELAPSED_TIME}, |
739 $dta{ENSEMBLE}[$atbottom]->{DEPTH}, |
759 $vErr, $dta{ENSEMBLE}[$lastgood]->{Y}, $y_err, |
740 $dta{ENSEMBLE}[$lastgood]->{DEPTH} - |
760 ) if defined ($opt_M); |
741 $dta{ENSEMBLE}[$firstgood]->{DEPTH}, |
761 print("#ANTS#PARAMS# start_lat{$s_lat} start_lon{$s_lon} " . |
742 $dta{DISTANCE_TO_BIN1_CENTER} + |
762 "end_lat{$e_lat} end_lon{$e_lon} " . |
743 $min_good_bins*$dta{BIN_LENGTH}, |
763 "lat{$lat} lon{$lon}\n") |
744 scalar(@{$dta{ENSEMBLE}}), |
764 if defined($lat); |
745 $w_gap_time,$wErr,$prrms,$dnprrms,$upprrms,$rotrms, |
765 if ($dta{TIME_BETWEEN_PINGS} == 0) { |
746 $prerot,$dnrot,$uprot,$postrot, |
766 print("#ANTS#PARAMS# pinging_rate{staggered}\n"); |
747 $dta{DISTANCE_TO_BIN1_CENTER}, |
767 } else { |
748 $dta{BIN_LENGTH}, |
768 printf("#ANTS#PARAMS# pinging_rate{%.2f}\n", |
749 ); |
769 1/$dta{TIME_BETWEEN_PINGS}); |
750 printf("#ANTS#PARAMS# magnetic_declination{$opt_M} " . |
770 } |
751 "uv_gap_time{%d} " . |
771 printf("#ANTS#PARAMS# drift_x{%d} drift_y{%d} " . |
752 "mean_u{%.4f} " . |
772 "drift_u{%.3f} drift_v{%.3f} " . |
753 "stderr_u{%.4f} " . |
773 "\n",$ddx,$ddy,$du,$dv) if defined($ddx); |
754 "dx{%d} " . |
774 if (defined($water_depth)) { |
755 "dx_err{%d} " . |
775 printf("#ANTS#PARAMS# water_depth{%d} sig-water_depth{%d}\n", |
756 "mean_v{%.4f} " . |
776 $water_depth,$sig_wd); |
757 "stderr_v{%.4f} " . |
777 } else { |
758 "dy{%d} " . |
778 print("#ANTS#PARAMS# water_depth{nan} sig-water_depth{nan}\n"); |
759 "dy_err{%d}\n", |
779 } |
760 $uv_gap_time, |
|
761 $dta{ENSEMBLE}[$lastgood]->{X} / |
|
762 $dta{ENSEMBLE}[$lastgood]->{ELAPSED_TIME}, |
|
763 $uErr, $dta{ENSEMBLE}[$lastgood]->{X}, $x_err, |
|
764 $dta{ENSEMBLE}[$lastgood]->{Y} / |
|
765 $dta{ENSEMBLE}[$lastgood]->{ELAPSED_TIME}, |
|
766 $vErr, $dta{ENSEMBLE}[$lastgood]->{Y}, $y_err, |
|
767 ) if defined ($opt_M); |
|
768 print("#ANTS#PARAMS# start_lat{$s_lat} start_lon{$s_lon} " . |
|
769 "end_lat{$e_lat} end_lon{$e_lon} " . |
|
770 "lat{$lat} lon{$lon}\n") |
|
771 if defined($lat); |
|
772 if ($dta{TIME_BETWEEN_PINGS} == 0) { |
|
773 print("#ANTS#PARAMS# pinging_rate{staggered}\n"); |
|
774 } else { |
|
775 printf("#ANTS#PARAMS# pinging_rate{%.2f}\n", |
|
776 1/$dta{TIME_BETWEEN_PINGS}); |
|
777 } |
|
778 printf("#ANTS#PARAMS# drift_x{%d} drift_y{%d} " . |
|
779 "drift_u{%.3f} drift_v{%.3f} " . |
|
780 "\n",$ddx,$ddy,$du,$dv) if defined($ddx); |
|
781 if (defined($water_depth)) { |
|
782 printf("#ANTS#PARAMS# water_depth{%d} sig-water_depth{%d}\n", |
|
783 $water_depth,$sig_wd); |
|
784 } else { |
|
785 print("#ANTS#PARAMS# water_depth{nan} sig-water_depth{nan}\n"); |
780 } |
786 } |
781 |
787 |
782 sub p($) { print(defined($_[0])?"$_[0] ":"nan "); } |
788 sub p($) { print(defined($_[0])?"$_[0] ":"nan "); } |
783 sub pb($) { print($_[0]?"1 ":"0 "); } |
789 sub pb($) { print($_[0]?"1 ":"0 "); } |
784 |
790 |
785 unless ($opt_Q) { # write profile |
791 for ($e=$firstgood; $e<=$lastgood; $e++) { |
786 for ($e=$firstgood; $e<=$lastgood; $e++) { |
792 p($dta{ENSEMBLE}[$e]->{NUMBER}); |
787 p($dta{ENSEMBLE}[$e]->{NUMBER}); |
793 p($dta{ENSEMBLE}[$e]->{UNIX_TIME}); |
788 p($dta{ENSEMBLE}[$e]->{UNIX_TIME}); |
794 p($dta{ENSEMBLE}[$e]->{ELAPSED_TIME}); |
789 p($dta{ENSEMBLE}[$e]->{ELAPSED_TIME}); |
795 p($dta{ENSEMBLE}[$e]->{SECNO}); |
790 p($dta{ENSEMBLE}[$e]->{SECNO}); |
796 pb($dta{ENSEMBLE}[$e]->{UNIX_TIME} < $dta{ENSEMBLE}[$atbottom]->{UNIX_TIME}); |
791 pb($dta{ENSEMBLE}[$e]->{UNIX_TIME} < $dta{ENSEMBLE}[$atbottom]->{UNIX_TIME}); |
797 p($dta{ENSEMBLE}[$e]->{W}); |
792 p($dta{ENSEMBLE}[$e]->{W}); |
798 p($dta{ENSEMBLE}[$e]->{W_ERR}); |
793 p($dta{ENSEMBLE}[$e]->{W_ERR}); |
799 p($dta{ENSEMBLE}[$e]->{DEPTH}); |
794 p($dta{ENSEMBLE}[$e]->{DEPTH}); |
800 p($dta{ENSEMBLE}[$e]->{DEPTH_ERR}); |
795 p($dta{ENSEMBLE}[$e]->{DEPTH_ERR}); |
801 p($dta{ENSEMBLE}[$e]->{DEPTH_BT}); |
796 p($dta{ENSEMBLE}[$e]->{DEPTH_BT}); |
802 p($dta{ENSEMBLE}[$e]->{PITCHROLL}); |
797 p($dta{ENSEMBLE}[$e]->{PITCHROLL}); |
803 p($dta{ENSEMBLE}[$e]->{ROTATION}); |
798 p($dta{ENSEMBLE}[$e]->{ROTATION}); |
804 if (defined($opt_M)) { |
799 if (defined($opt_M)) { |
805 p($dta{ENSEMBLE}[$e]->{U}); p($dta{ENSEMBLE}[$e]->{U_ERR}); |
800 p($dta{ENSEMBLE}[$e]->{U}); p($dta{ENSEMBLE}[$e]->{U_ERR}); |
806 p($dta{ENSEMBLE}[$e]->{V}); p($dta{ENSEMBLE}[$e]->{V_ERR}); |
801 p($dta{ENSEMBLE}[$e]->{V}); p($dta{ENSEMBLE}[$e]->{V_ERR}); |
807 p($dta{ENSEMBLE}[$e]->{X}); p($dta{ENSEMBLE}[$e]->{X_ERR}); |
802 p($dta{ENSEMBLE}[$e]->{X}); p($dta{ENSEMBLE}[$e]->{X_ERR}); |
808 p($dta{ENSEMBLE}[$e]->{Y}); p($dta{ENSEMBLE}[$e]->{Y_ERR}); |
803 p($dta{ENSEMBLE}[$e]->{Y}); p($dta{ENSEMBLE}[$e]->{Y_ERR}); |
809 } |
804 } |
810 if (defined(@f)) { |
805 if (defined(@f)) { |
811 foreach $f (@f) { |
806 foreach $f (@f) { |
812 my($fn,$fi) = ($f =~ m{([^[]*)(\[.*)}); |
807 my($fn,$fi) = ($f =~ m{([^[]*)(\[.*)}); |
813 $fn = $f unless defined($fn); |
808 $fn = $f unless defined($fn); |
814 p(eval("\$dta{ENSEMBLE}[$e]->{$fn}$fi")); |
809 p(eval("\$dta{ENSEMBLE}[$e]->{$fn}$fi")); |
|
810 } |
|
811 } |
815 } |
812 print("\n"); |
816 } |
813 } |
817 print("\n"); |
814 } |
818 } |
815 |
819 |
816 exit(0); |
820 exit(0); |