LAST CHANGED    : 2017/04/07 12:10:58
CRUISE NAME(S)  : P18_leg2 (rb1606_leg2)
CRUISE DATES    : 2017/01/01 to 2017/02/02 
SHIP NAME       : Ronald H. Brown
PORTS           : Hanga Roa, Chile to Punta Arenas, Chile
CHIEF SCIENTIST : R. Sonnerup
DATABASE NAME   : aship
DATA FILES      : rb2017_000_00000.raw to rb2017_032_57600.raw

STATUS          :  to do                           done
                  ------                       -----------
                  averaged                       [  X  ]
                  loaded                         [  X  ]

                  NOTE: heading correction instrument exists
                        NOTE: time-dependent heading corrections
                        applied IN the ensembles
                        (see   cal/rotate/ens_hcorr.ang)

                  check heading correction       [  X  ]
                  calibration                    [  X  ]
                  edited                         [  X  ]
                  re-check heading correction    [  X  ]
                  check editing                  [  X  ]
                  figures                        [  X  ]

INSTRUMENT      : os75

ACQUISITION     : 
     PROGRAM    : uhdas
     PROCESSING:    : python

LOGGING         : 

     PARAMETERS : BT : bottom track mode (on or off)
                  SI : sampling interval or averaging period for ensemble (sec)
                  NB : number of bins
                  BL : bin length (m)
                  TD : transducer depth (m)
                  BK : blanking length (m)
                  HO : heading offset applied by DAS (deg)
                  HB : heading bias (deg)
                  CRPH : compensation for roll-pitch-heading, 1:on, 0:off)
                  
                  yy/mm/dd  hh:mm:ss   BT   SI  NB  BL  TD BK     HO     HB CRPH
                  2016/01/01 00:04:59  off  300  60  16   5  8  51.40   0.00 0001

HEADING         : 
     PRIMARY    : heading from gyro
     CORRECTION : heading correction from posmv
                        NOTE: time-dependent heading corrections
                        applied IN the ensembles
                        (see   cal/rotate/ens_hcorr.ang)

POSITIONS       : gps positions from posmv

CALIBRATION     : Heading alignment: 51.4
                  additional rotation: -0.133
                  final transducer angle is: 51.533
                       (original transducer angle) - (rotate_angle)
                  applied scale factor:1.0
                  additional scale factor: none

COMMENTS        : reprocessed data in order to clean it up
                  gaps in heading correction
                  few scattering layers
                  transducer offset correction

           # There was a bug (oversight) in our treatment of zmq_publisher.py:
           # (1) zmq_publisher.py is started at boot and its yearbase was determined at boot
           # (2) therefore if zmq rolls over to a new year, the $UNIXD lines would have
           #     dates higher than 365
           # 
           #     eg. ./RB1606_Leg2
           #         ./RB1606_Leg2b
           #         ./RB1606_Leg2c
           #         ./RB1606_Leg2d
           # 
           # And because the cruise was started in the same year, everything should have been OK
           # 
           # (3) But then they rebooted and the UNIXD in gpsnav (zmq_publisher) was reset to the
           #     subsequent year, but the cruise was not, so the base year changed
           # 
           # The original solution is below, but that resulted in the whole cruise
           # having time range 2016/01/01  00:04:59 to 2016/02/02  16:04:59
           # but it should have been 2017/01/01
           # 
           # 
           # solution : add 366*86400 seconds
                  
PROCESSOR       : Dr. Thomas Roc


--- processing parameters ----------


## (determined from "sonar"): model = os
## (determined from "sonar"): frequency = 75
## (determined from "sonar"): instname = os75
## (determined from "sonar"): pingtype = nb
             badbeam   None
           beamangle   30
          configtype   python
          cruisename   RB1606_Leg2
            datatype   uhdas
              dbname   aship
             ens_len   300
             fixfile   aship.gps
          hcorr_inst   posmv
               pgmin   50
            pingpref   None
         proc_engine   python
          ref_method   refsm
     refuv_smoothwin   3
        refuv_source   nav
               sonar   os75nb
            txy_file   aship.gps
           xducer_dx   0
           xducer_dy   0
            yearbase   2016

========================================================================

CRUISE=RB1606_Leg2
sonar=os75nb

- copied config directory from at-sea processing
- edit to point to data source


cd ..


(2) now we can use that file.
    Set up the processing directory by typing:


      adcptree.py  os75nb --datatype uhdas --cruisename RB1606_Leg2
      cd  os75nb


cat << EOF > q_py.cnt

    ####----- begin q_py.cnt------------
    ## all lines after the first "#" sign are ignored

    ## python processing

      --yearbase    2016
      --cruisename  RB1606_Leg2   # used to identify configuration files
                              #  *must* match prefix of files in config dir

      --update_gbin

      --configtype python  ## <=== USE THE NEW FILE WE CREATED

      --sonar       os75nb
      --dbname      aship
      --datatype    uhdas
      --ens_len     300

      --ping_headcorr        ## applies heading correction.
                             ##     settings found in config files

      --max_search_depth -1     ## -1 = "never search for the bottom"

EOF



   (c)  run quick_adcp.py:

        quick_adcp.py --cntfile q_py.cnt --auto

(4) review the data

    (a) check calibration:heading correction device:

             figview.py cal/rotate/*png

     ==> gaps in heading correction; run patch_hcorr.py


 NOW:
    (b) inspect the newhcorr*.png files:
      figview.py *.png
    (c) remove earlier time-dependent heading correction

      rotate unrotate.tmp
    (d) apply new heading correction
      rotate rotate_fixed.tmp
    (e) run navigation steps and inspect calibrations
      cd ../..
      quick_adcp.py --steps2rerun navsteps:calib --auto

(5)  edit "gautoedit"
    cd edit
    gautoedit.py -n6

    # apply editing:
        cd ..
        quick_adcp.py --steps2rerun apply_edit:navsteps:calib  --auto

    # check editing -- looks OK
        dataviewer.py

(6) check calibrations again
    catwt

   **watertrack**   
------------
Number of edited points: 185 out of 186
   amp   = 1.0004  + -0.0000 (t -  12.6)
   phase =  -0.13  + 0.0090 (t -  12.6)
            median     mean      std
amplitude   1.0000   1.0004   0.0040
phase      -0.1420  -0.1258   0.2796
------------

    catxy

   **transducer-gps offset**  
------------
guessing ADCP (dx=starboard, dy=fwd) meters from GPS
positions from aship.agt
calculation done at 2017/04/21 19:48:12
xducer_dx = 0.412187
xducer_dy = 7.065594
signal = 2281.250212
------------

    # applying correction
    quick_adcp.py --steps2rerun rotate:navsteps:calib --rotate_angle -0.1339 --xducer_dx 0 --xducer_dy 7 --auto
    catwt

   **watertrack**   
------------
Number of edited points: 185 out of 186
   amp   = 1.0004  + -0.0000 (t -  12.6)
   phase =   0.01  + 0.0090 (t -  12.6)
            median     mean      std
amplitude   1.0000   1.0004   0.0040
phase      -0.0080   0.0079   0.2798
------------

    # OK, done

(7) make plots:
    quick_web.py --interactive

(8) extract data
    adcp_nc.py adcpdb  contour/os75nb  RB1606_Leg2 os75nb
    quick_adcp.py --steps2rerun matfiles --auto