lkilcher / dolfyn

A library for oceanographic doppler instruments such as Acoustic Doppler Profilers (ADPs, ADCPs) and Acoustic Doppler Velocimeters (ADVs).
BSD 3-Clause "New" or "Revised" License
42 stars 25 forks source link

ADV heading range -180 to +180, ADCP heading range 0-360 #40

Closed mcfogarty closed 5 years ago

mcfogarty commented 5 years ago

RDI ADCP heading range is 0-360 degrees, but the Nortek ADV heading range is -180 to +180 degrees. It would be convenient if all headings were reported in the range 0-360.

I think the ADV heading range of -180 to +180 will only occur when _check_declination is executed and 'declination' is found. This is because nortek_orient2euler will be called on line 108 of rotate/base.py and it uses np.rad2deg where rad2deg(x) is 180 * x / pi. nortek_orient2euler is defined on line 180 of rotate/base.py.

But, the ADV heading should have the range 0-360 degrees if the 'if' statement on line 120 of rotate/base.py is executed: if 'heading' in odata and \ not advo.props.get('declination_in_heading', False):

    if cs == 'earth' and not rotation_done_flag:
        # Rotate to instrument coordinate-system before adjusting
        # for declination.
        advo.rotate2('inst', inplace=True)

    odata['heading'] += advo.props['declination']
    odata['heading'] %= 360

advo.props['declination_in_heading'] = True

lkilcher commented 5 years ago

This is resolved in #50. All headings are reported 0-360, and are clockwise from north.