RDI_Coords.pl
changeset 39 3bddaa514ef5
parent 36 515b06dae59c
child 41 d7ab920c1de6
equal deleted inserted replaced
38:b1b1ef3f4a9a 39:3bddaa514ef5
     1 #======================================================================
     1 #======================================================================
     2 #                    R D I _ C O O R D S . P L 
     2 #                    R D I _ C O O R D S . P L 
     3 #                    doc: Sun Jan 19 17:57:53 2003
     3 #                    doc: Sun Jan 19 17:57:53 2003
     4 #                    dlm: Sun Jul 31 13:54:26 2016
     4 #                    dlm: Thu Oct 12 21:01:19 2017
     5 #                    (c) 2003 A.M. Thurnherr
     5 #                    (c) 2003 A.M. Thurnherr
     6 #                    uE-Info: 568 0 NIL 0 0 72 10 2 4 NIL ofnI
     6 #                    uE-Info: 260 20 NIL 0 0 72 10 2 4 NIL ofnI
     7 #======================================================================
     7 #======================================================================
     8 
     8 
     9 # RDI Workhorse Coordinate Transformations
     9 # RDI Workhorse Coordinate Transformations
    10 
    10 
    11 # HISTORY:
    11 # HISTORY:
    51 #					updated with transformation taken from Lohrman et al. (JAOT 1990)
    51 #					updated with transformation taken from Lohrman et al. (JAOT 1990)
    52 #				  - BUG: v34 sign was inconsistent with RDI coord manual
    52 #				  - BUG: v34 sign was inconsistent with RDI coord manual
    53 #	Jun  8, 2016: - added $ens as arg to velInstrumentToBeam() for consistency
    53 #	Jun  8, 2016: - added $ens as arg to velInstrumentToBeam() for consistency
    54 #	Jul  7, 2016: - added velEarthToBPw() with algorithm debugged and verified
    54 #	Jul  7, 2016: - added velEarthToBPw() with algorithm debugged and verified
    55 #					by Paul Wanis from TRDI
    55 #					by Paul Wanis from TRDI
       
    56 #	Oct 12, 2017: - documentation
    56 
    57 
    57 use strict;
    58 use strict;
    58 use POSIX;
    59 use POSIX;
    59 
    60 
    60 my($PI) = 3.14159265358979;
    61 my($PI) = 3.14159265358979;
   254 
   255 
   255 #----------------------------------------------------------------------
   256 #----------------------------------------------------------------------
   256 # velInstrumentToBeam() transforms instrument to beam coordinates
   257 # velInstrumentToBeam() transforms instrument to beam coordinates
   257 #	- based on manually solved eq system in sec 5.3 of coord manual
   258 #	- based on manually solved eq system in sec 5.3 of coord manual
   258 #	- does not implement bin-remapping
   259 #	- does not implement bin-remapping
   259 #	- does not work for 3-beam solutions, as it is not known which
   260 #	- returns undef for 3-beam solutions, as it is not known which
   260 #	  beam was bad
   261 #	  beam was bad
   261 #----------------------------------------------------------------------
   262 #----------------------------------------------------------------------
   262 
   263 
   263 { # STATIC SCOPE
   264 { # STATIC SCOPE
   264 	my($a,$b,$c,$d);
   265 	my($a,$b,$c,$d);
   306 #		2) w12 = w + e*tan(beam_angle)/sqrt(2)
   307 #		2) w12 = w + e*tan(beam_angle)/sqrt(2)
   307 #		   w34 = w - e*tan(beam_angle)/sqrt(2)
   308 #		   w34 = w - e*tan(beam_angle)/sqrt(2)
   308 #		3) rotate into horizontal coords (earth coords w/o
   309 #		3) rotate into horizontal coords (earth coords w/o
   309 #		   considering heading, i.e. same as earth coords
   310 #		   considering heading, i.e. same as earth coords
   310 #		   in case of w
   311 #		   in case of w
   311 #----------------------------------------------------------------------
   312 #	- the commented-out version above is a "brute-force"
       
   313 #	  implementation which should give the same result
       
   314 #----------------------------------------------------------------------
       
   315 
       
   316 #sub velEarthToBPw(@)
       
   317 #{
       
   318 #   my(@bpv) = velBeamToBPEarth(&velEarthToBeam(@_));
       
   319 #   return ($bpv[1],$bpv[3]);
       
   320 #}
   312 
   321 
   313 sub velEarthToBPw(@)
   322 sub velEarthToBPw(@)
   314 {
   323 {
   315 	my($ADCP,$ens,$u,$v,$w,$ev) = @_;
   324 	my($ADCP,$ens,$u,$v,$w,$ev) = @_;
   316 	my(@iv) = velEarthToInstrument(@_);
   325 	my(@iv) = velEarthToInstrument(@_);