LAST CHANGED    : Mon Oct 18 16:37:38 HST 2006
CRUISE NAME(S)  : ka0405, gp504_ens
CRUISE DATES    : 2004/09/01  to 2004/10/05 
PORTS           : Honolulu, HI to Honolulu, HI
SHIP NAME       : Ka`imimoana
CHIEF SCIENTIST : Paul Freitag (8/31-9/22) Patrick A'Hearn (9/22-10/7)
DB_NAME         : a504
DATA FILES      : ADCP047_*.ENS - ADCP079_*.ENS
STATUS          : done.  edited, calibrated, ready for JASADCP

INSTRUMENT      : OS75, instrument #1

ACQUISITION
     PROGRAM    : VmDAS
     PING TYPE  : narrowband
      PARAMS    : blank=            8m 
                  pulse =           16 
                  bin length=       16 
                  number of bins=   60 
HEADING
     PRIMARY    : gyro
     CORRECTION : posmv (later)

POSITIONS       : ?? primary gps, whatever that is

CALIBRATION     : phase correction -2.35, 
                : final transducer angle 56.5 - (-2.35) = 58.85 relative to posmv.

COMMENTS        : problems with acquisition:
                       - posmv was flaky; 
                       - choices of heading kept switching: gyro, posmv
                       - data were averaged with 1200s ensembles.
                  had to redo processing from ens files; apply 
                          posmv correction manually.
                  data coverate to about 800m for most of the cruise
                  TIME STAMP PROBLEMS!! see cal/rotate/heading_correction.txt

                  averages have teh wrong depth: use "depthcng" to 
                      decrease depths by 5 m and change transducer
                      depth to 5m

PROCESSED BY    : Jules Hummon University of Hawaii

-------------------------------------------------------
Times:
4 hours to average+edit the data
few minutes for the rest of the codas processing
several minutes for pmv.rbin (from N2R)
1 hour for hdg.rbin (from ens)



  ### q_py.cnt is
   --yearbase 2004                       # for decimal day conversion
   --dbname a504                         # database name; in adcpdb
   --ducer_depth 5                       # ENS needs transducer depth
   --ens_halign 56.5                     ## h_align for gyro
   --use_refsm                           # could use --use_smoothr
   --instclass os                        # instrument type
   --datatype ens                        # datafile type
   --pingtype  nb                        # specify nb or bb
   --datafile_glob *.ENS                 # filename extension
   --datadir /mnt/ulili2/vmdas_data/osdata/kaimi075/gp504
   ### end of q_py.cnt

-----------------------------

now get posmv correction

(1a) identify the data directory:
cd /mnt/ulili2/vmdas_data/osdata/kaimi075/gp504

(1b) set the stage:
cd cal/rotate
mkdir rbin
cd rbin

(2) make the rbin files from N2R 
serasc2bin.py  -m pmv -c last -y 2004 -v -t vmdas \
    /mnt/ulili2/vmdas_data/osdata/kaimi075/gp504/*.N2R

(3) fire up matlab, get the headings

%%%
matlab
datadir = '/mnt/ulili2/vmdas_data/osdata/kaimi075/gp504';
filelist = dirs(fullfile(datadir, '../*.ENS'),'fullfile',1);
for ifile = 1:length(filelist)
  ensfile = filelist(ifile).name
  ensgyro2rbin(os, ensfile);
end
%%%

for fignum = 1:6
  set(0,'defaulttextinterpreter','none')
  figure(fignum)
  printit(sprintf('badtimes_%03d',fignum),'orient','landscape')
end


(4) go back to cal/rotate, in matlab, edit and run mk_ensgyrodh.m

rotate rotate1.tmp

cd ../..

quick_adcp.py   --use_refsm --yearbase 2004 \
  --steps2rerun navsteps:calib:matfiles --auto

cat cal/watertrk/*out


quick_adcp.py --rotate_angle -2.35  --use_refsm --yearbase 2004 \
  --steps2rerun rotate:navsteps:calib:matfiles --auto

-------------
Number of edited points:  80 out of  95
   amp   = 1.0030  + -0.0001 (t - 262.3)
   phase =  -0.01  + -0.0084 (t - 262.3)
            median     mean      std
amplitude   1.0020   1.0030   0.0097
phase      -0.0345  -0.0094   0.4361


(5) edit; apply editing


quick_adcp.py  --use_refsm --yearbase 2004 \
  --steps2rerun apply_edit:navsteps:calib:matfiles --auto


--------------------------------------------
(6) check transducer offset from gps:

best_xducerxy('yearbase',2004,'xoffsets',[0],'yoffsets',[0:5:70],'fixfile','a504.gps')
best_xducerxy('yearbase',2004,'xoffsets',[-10:2:10],'yoffsets',[40],'fixfile','a504.gps')


NOTE:run this to get the correct agt file:
 xducerxy_core('dx',0,'dy',40','yearbase',2004,'fixfile','a504.gps')
THEN edit asetup.m to point to this file.

 quick_adcp.py --use_refsm --yearbase 2004 --instname os75 \
       --steps2rerun navsteps:calib:matfiles --auto \
       --xducer_dx 0 --xducer_dy 40 


Number of edited points:  80 out of  95
   amp   = 1.0011  + -0.0000 (t - 262.3)
   phase =   0.03  + -0.0154 (t - 262.3)
            median     mean      std
amplitude   1.0010   1.0011   0.0053
phase       0.0520   0.0304   0.3822