--- a/editPD0
+++ b/editPD0
@@ -2,9 +2,9 @@
#======================================================================
# E D I T P D 0
# doc: Mon Nov 25 20:24:31 2013
-# dlm: Fri Feb 26 17:24:55 2016
+# dlm: Tue Apr 12 21:45:31 2016
# (c) 2013 A.M. Thurnherr
-# uE-Info: 26 98 NIL 0 0 72 2 2 4 NIL ofnI
+# uE-Info: 235 46 NIL 0 0 72 2 2 4 NIL ofnI
#======================================================================
# edit RDI PD0 file, e.g. to replace pitch/roll/heading with external values
@@ -29,6 +29,10 @@
# does not handle bin-remapping
# input in beam coords required
#
+# instrument2beam() transform instrument to earth coordinates
+# does not handle bin-remapping
+# input in instrument coords required
+#
# ensure_UL() overwrite transducer-orientation flag in data file
# ensure_DL()
#
@@ -54,6 +58,8 @@
# Feb 15, 2016: - added ensure_UL() ensure_DL()
# Feb 23, 2016: - added -k
# Feb 26, 2016: - added basic BT data to swap_beams()
+# - added earth2beam()
+# Apr 12, 2016: - added instrument2beam()
use Getopt::Std;
@@ -186,6 +192,54 @@
}
+#
+# transform instrument to beam coordinates
+#
+{ my($checked);
+
+ sub instrument2beam()
+ {
+ unless ($checked) {
+ die("$ARGV[0]: instrument-coordinate data required\n")
+ unless ($dta{INSTRUMENT_COORDINATES});
+ $dta{BEAM_COORDINATES} = 1; undef($dta{INSTRUMENT_COORDINATES});
+ $checked = 1;
+ }
+
+ for (my($bin)=0; $bin<$dta{N_BINS}; $bin++) {
+ @{$dta{ENSEMBLE}[$e]->{VELOCITY}[$bin]} =
+ velInstrumentToBeam(\%dta,@{$dta{ENSEMBLE}[$e]->{VELOCITY}[$bin]});
+ }
+
+ return 1;
+ }
+
+}
+
+#
+# transform instrument to earth coordinates
+#
+{ my($checked);
+
+ sub instrument2earth()
+ {
+ unless ($checked) {
+ die("$ARGV[0]: instrument-coordinate data required\n")
+ unless ($dta{INSTRUMENT_COORDINATES});
+ $dta{BEAM_COORDINATES} = 1; undef($dta{INSTRUMENT_COORDINATES});
+ $checked = 1;
+ }
+
+ for (my($bin)=0; $bin<$dta{N_BINS}; $bin++) {
+ @{$dta{ENSEMBLE}[$e]->{VELOCITY}[$bin]} =
+ velInstrumentToEarth(\%dta,$e,@{$dta{ENSEMBLE}[$e]->{VELOCITY}[$bin]});
+ }
+
+ return 1;
+ }
+
+}
+
#--------------------------------------------------
# Main Routine
#--------------------------------------------------