

         %% no diary written %% 
         %% no change to display %% 

        
            % begin "matcfgstr" string, created by run_lastensq.py
            instclass = os;
            instname  = 'os150';
            pingtype  = 'bb';
            proc_yearbase  = 2008;
            yearbase  = 2008;
            cfg =get_uhdascfg('cfgbase'  , 'MGLN44MV',...
                              'cfgpath'  , '/home/data/MGLN44MV/proc/os150bb/config',...
                              'instclass', instclass,...
                              'instname' , instname,...
                              'pingtype' , pingtype);
            gbindirbase = cfg.gbindirbase;
            allparams = cfg.allparams;
             

        


        % heading correction instrument comes from config/cruise_cfg.m
        % NEW: override with hcorr_args, not hcorr_inst
        % (1) if there isn't one bomb out.
           if ~isfield(cfg, 'hcorr_args'),
               error('load_uhblk_tmp.m: no heading correction setting: check config/cruise_cfg.m -- version mismatch??')
           end

        % (3)  override from quick_adcp.py if desired
        %      eg. hcorr_args = {'posmv', 'pmv', 'acc_heading_cutoff', .018};
           cfg.hcorr_inst = 'ashtech';              % this should be obsolete, but here for constistency
        % this is what is used. see get_rbinheading.m :
           %%====> quick_adcp.py overrriding:
 cfg.hcorr_args = {'ashtech', 'adu'};

        % matlab does not know about post_headcorr at this point; only
        % "ping_headcorr = 0" or "ping_headcorr = 1"
        % matlab initializing ping_headcorr = 0
        ping_headcorr = 0;

        % quick_adcp.py overrides follow:
        %====> quick_adcp.py overrriding:
 ping_headcorr = 1;
        %====> quick_adcp.py overrriding:
 num_persistence = 24;


        params = get_params(allparams, instname, pingtype);

        params.showverbose = 0;
        params.pingedit = 'all';
        params.proc_yearbase = proc_yearbase;
        params.yearbase = yearbase;


        % params comes from ../config/cruiseid_proc.m
        % this matlab file is written by python: override some things here
        params.interval = 300;

        %%====> quick_adcp.py overrriding:
 params.bottom = 'xy2z';

        % can override single ping editing either manually ...
        % see get_pedefaults
        % ... or in an m-file
        if exist('override_editcfg.m','file')
                override_editcfg
        else
            fprintf('Using pingedit defaults (no editcfg override file: override_editcfg)\n')
        end



        % This list MUST start at the beginning if the list of all
        % possible files.  DO NOT delete any files from the raw
        % directory after processing (averaging) has begun or it will
        % throw off total ensemble count used by write_ensblk.m


        % all files:
        files = {'/home/data/MGLN44MV/raw/os150/mv2008_225_04094.raw',...
'/home/data/MGLN44MV/raw/os150/mv2008_225_07200.raw',...
'/home/data/MGLN44MV/raw/os150/mv2008_225_14400.raw',...
'/home/data/MGLN44MV/raw/os150/mv2008_225_21600.raw',...
'/home/data/MGLN44MV/raw/os150/mv2008_225_28800.raw',...
'/home/data/MGLN44MV/raw/os150/mv2008_225_36000.raw',...
'/home/data/MGLN44MV/raw/os150/mv2008_225_43200.raw',...
'/home/data/MGLN44MV/raw/os150/mv2008_225_50400.raw',...
'/home/data/MGLN44MV/raw/os150/mv2008_225_57600.raw',...
'/home/data/MGLN44MV/raw/os150/mv2008_225_64800.raw',...
'/home/data/MGLN44MV/raw/os150/mv2008_225_72000.raw',...
'/home/data/MGLN44MV/raw/os150/mv2008_225_79200.raw',...
'/home/data/MGLN44MV/raw/os150/mv2008_226_00000.raw',...
'/home/data/MGLN44MV/raw/os150/mv2008_226_07200.raw',...
'/home/data/MGLN44MV/raw/os150/mv2008_226_14400.raw',...
'/home/data/MGLN44MV/raw/os150/mv2008_226_21600.raw',...
'/home/data/MGLN44MV/raw/os150/mv2008_226_28800.raw',...
'/home/data/MGLN44MV/raw/os150/mv2008_226_36000.raw',...
'/home/data/MGLN44MV/raw/os150/mv2008_226_43200.raw',...
'/home/data/MGLN44MV/raw/os150/mv2008_226_50400.raw',...
'/home/data/MGLN44MV/raw/os150/mv2008_226_57600.raw',...
'/home/data/MGLN44MV/raw/os150/mv2008_226_64800.raw',...
'/home/data/MGLN44MV/raw/os150/mv2008_226_72000.raw',...
'/home/data/MGLN44MV/raw/os150/mv2008_226_79200.raw',...
'/home/data/MGLN44MV/raw/os150/mv2008_227_00000.raw',...
'/home/data/MGLN44MV/raw/os150/mv2008_227_07200.raw',...
'/home/data/MGLN44MV/raw/os150/mv2008_227_14400.raw',...
'/home/data/MGLN44MV/raw/os150/mv2008_227_21600.raw',...
'/home/data/MGLN44MV/raw/os150/mv2008_227_28800.raw',...
'/home/data/MGLN44MV/raw/os150/mv2008_227_36000.raw',...
'/home/data/MGLN44MV/raw/os150/mv2008_227_43200.raw',...
'/home/data/MGLN44MV/raw/os150/mv2008_227_50400.raw',...
'/home/data/MGLN44MV/raw/os150/mv2008_227_57600.raw',...
'/home/data/MGLN44MV/raw/os150/mv2008_227_64800.raw',...
'/home/data/MGLN44MV/raw/os150/mv2008_227_72000.raw',...
'/home/data/MGLN44MV/raw/os150/mv2008_227_79200.raw',...
'/home/data/MGLN44MV/raw/os150/mv2008_228_00000.raw',...
'/home/data/MGLN44MV/raw/os150/mv2008_228_07200.raw',...
'/home/data/MGLN44MV/raw/os150/mv2008_228_14400.raw',...
'/home/data/MGLN44MV/raw/os150/mv2008_228_21600.raw',...
'/home/data/MGLN44MV/raw/os150/mv2008_228_28800.raw',...
'/home/data/MGLN44MV/raw/os150/mv2008_228_36000.raw',...
'/home/data/MGLN44MV/raw/os150/mv2008_228_43200.raw',...
'/home/data/MGLN44MV/raw/os150/mv2008_228_50400.raw',...
'/home/data/MGLN44MV/raw/os150/mv2008_228_57600.raw',...
'/home/data/MGLN44MV/raw/os150/mv2008_228_64800.raw',...
'/home/data/MGLN44MV/raw/os150/mv2008_228_72000.raw',...
'/home/data/MGLN44MV/raw/os150/mv2008_228_73734.raw',...
'/home/data/MGLN44MV/raw/os150/mv2008_228_77317.raw',...
'/home/data/MGLN44MV/raw/os150/mv2008_228_79200.raw',...
'/home/data/MGLN44MV/raw/os150/mv2008_229_00000.raw',...
'/home/data/MGLN44MV/raw/os150/mv2008_229_07200.raw',...
'/home/data/MGLN44MV/raw/os150/mv2008_229_14400.raw',...
'/home/data/MGLN44MV/raw/os150/mv2008_229_21600.raw',...
'/home/data/MGLN44MV/raw/os150/mv2008_229_28800.raw',...
'/home/data/MGLN44MV/raw/os150/mv2008_229_36000.raw',...
'/home/data/MGLN44MV/raw/os150/mv2008_229_43200.raw',...
'/home/data/MGLN44MV/raw/os150/mv2008_229_50400.raw',...
'/home/data/MGLN44MV/raw/os150/mv2008_229_57600.raw',...
'/home/data/MGLN44MV/raw/os150/mv2008_229_64800.raw',...
'/home/data/MGLN44MV/raw/os150/mv2008_229_72000.raw',...
'/home/data/MGLN44MV/raw/os150/mv2008_229_79200.raw',...
'/home/data/MGLN44MV/raw/os150/mv2008_230_00000.raw',...
'/home/data/MGLN44MV/raw/os150/mv2008_230_07200.raw',...
'/home/data/MGLN44MV/raw/os150/mv2008_230_14400.raw',...
'/home/data/MGLN44MV/raw/os150/mv2008_230_21600.raw',...
'/home/data/MGLN44MV/raw/os150/mv2008_230_28800.raw',...
'/home/data/MGLN44MV/raw/os150/mv2008_230_36000.raw',...
'/home/data/MGLN44MV/raw/os150/mv2008_230_43200.raw',...
'/home/data/MGLN44MV/raw/os150/mv2008_230_50400.raw',...
'/home/data/MGLN44MV/raw/os150/mv2008_230_57600.raw',...
'/home/data/MGLN44MV/raw/os150/mv2008_230_64800.raw',...
'/home/data/MGLN44MV/raw/os150/mv2008_230_72000.raw',...
'/home/data/MGLN44MV/raw/os150/mv2008_230_79200.raw',...
'/home/data/MGLN44MV/raw/os150/mv2008_231_00000.raw',...
'/home/data/MGLN44MV/raw/os150/mv2008_231_07200.raw',...
'/home/data/MGLN44MV/raw/os150/mv2008_231_14400.raw',...
'/home/data/MGLN44MV/raw/os150/mv2008_231_21600.raw',...
'/home/data/MGLN44MV/raw/os150/mv2008_231_28800.raw',...
'/home/data/MGLN44MV/raw/os150/mv2008_231_36000.raw',...
'/home/data/MGLN44MV/raw/os150/mv2008_231_43200.raw',...
'/home/data/MGLN44MV/raw/os150/mv2008_231_50400.raw',...
'/home/data/MGLN44MV/raw/os150/mv2008_231_57600.raw',...
'/home/data/MGLN44MV/raw/os150/mv2008_231_64800.raw',...
'/home/data/MGLN44MV/raw/os150/mv2008_231_72000.raw',...
'/home/data/MGLN44MV/raw/os150/mv2008_231_79200.raw',...
'/home/data/MGLN44MV/raw/os150/mv2008_232_00000.raw',...
'/home/data/MGLN44MV/raw/os150/mv2008_232_07200.raw',...
'/home/data/MGLN44MV/raw/os150/mv2008_232_14400.raw',...
'/home/data/MGLN44MV/raw/os150/mv2008_232_21600.raw',...
'/home/data/MGLN44MV/raw/os150/mv2008_232_28800.raw',...
'/home/data/MGLN44MV/raw/os150/mv2008_232_36000.raw',...
'/home/data/MGLN44MV/raw/os150/mv2008_232_43200.raw',...
'/home/data/MGLN44MV/raw/os150/mv2008_232_50400.raw',...
'/home/data/MGLN44MV/raw/os150/mv2008_232_57600.raw',...
'/home/data/MGLN44MV/raw/os150/mv2008_232_64800.raw',...
'/home/data/MGLN44MV/raw/os150/mv2008_232_72000.raw',...
'/home/data/MGLN44MV/raw/os150/mv2008_232_79200.raw',...
'/home/data/MGLN44MV/raw/os150/mv2008_233_00000.raw',...
'/home/data/MGLN44MV/raw/os150/mv2008_233_07200.raw',...
'/home/data/MGLN44MV/raw/os150/mv2008_233_14400.raw',...
'/home/data/MGLN44MV/raw/os150/mv2008_233_21600.raw',...
'/home/data/MGLN44MV/raw/os150/mv2008_233_28800.raw',...
'/home/data/MGLN44MV/raw/os150/mv2008_233_36000.raw',...
'/home/data/MGLN44MV/raw/os150/mv2008_233_43200.raw',...
'/home/data/MGLN44MV/raw/os150/mv2008_233_50400.raw',...
'/home/data/MGLN44MV/raw/os150/mv2008_233_57600.raw',...
'/home/data/MGLN44MV/raw/os150/mv2008_233_64800.raw',...
'/home/data/MGLN44MV/raw/os150/mv2008_233_72000.raw',...
'/home/data/MGLN44MV/raw/os150/mv2008_233_79200.raw',...
'/home/data/MGLN44MV/raw/os150/mv2008_234_00000.raw',...
'/home/data/MGLN44MV/raw/os150/mv2008_234_07200.raw',...
'/home/data/MGLN44MV/raw/os150/mv2008_234_14400.raw',...
'/home/data/MGLN44MV/raw/os150/mv2008_234_21600.raw',...
'/home/data/MGLN44MV/raw/os150/mv2008_234_28800.raw',...
'/home/data/MGLN44MV/raw/os150/mv2008_234_36000.raw',...
'/home/data/MGLN44MV/raw/os150/mv2008_234_43200.raw',...
'/home/data/MGLN44MV/raw/os150/mv2008_234_50400.raw'};


        % this should start with the most recent profile (from ens_blk*.log)
        % and start there. no need to fiddle with filelists.
        % It is automatically in incremental mode.

        write_ensblk(instclass, files, params,...
            'gbindir', fullfile(gbindirbase, instname),...
            'save_lastens', 1,...
            'hcorr_args', cfg.hcorr_args, ...
            'gyro_msginfo', cfg.best.heading_rule,...
            'ping_headcorr', ping_headcorr, ...
            'num_persistence', num_persistence, ...
            'pingtype', pingtype,  'max_BLKprofiles', 144,   'maxrunsecs', 300,...
            'save_editcfg', 0,...
            'verbose', 0);


     