Process ac9.m

From Pnb
Revision as of 15:57, 5 August 2010 by 128.111.101.185 (talk)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
function process_ac9(pb)
%created by Erik Stassinos 4/27/2010
%this is the main function that calls all the other processing functions in
%order to processes the AC9 data.
%run in processing directory

now = pwd;
sav_pb = pb;
% % % % 
% % % % % % 
location = pwd;
loclength = length(location);
% %length of "processing" is 10 characters
processcheck = location((loclength -9):loclength);
if strncmp(processcheck,'processing',10) ~=1
    warning('Run this function from processing directory only')
    return
end
% 
 conv2lcd(pb)

disp('Enter the CTD file for ctdstrip_E function')
disp('This file should be titled XyymmddD.asc')
disp('The ctd strip function depends on the traditional location of the CTD and for_ac9 folder')
name = input('what is the file name? ','s')
ctdstrip_E(pb,name)

disp('Enter the lcd file name for E_BBstrip function')
disp('The format of this file name should look like ayymmddd.lcd')
bbstripfile = input('what is the file name? ','s')
disp('1mer_time and 1depth will be stripped')
E_BBstrip(pb,bbstripfile,'1mer_time','1depth','i')

disp('Enter the file names for createdepth_ac9_pnb')
disp('These should be the lcd and CTD files you wanted stripped')
disp('Name format should look like XyymmddD.asc.strip and ayymmddd.lcd.strip ')
Xnameis = input('The Xname is ','s')
yorn = input('Are you sure? y or n ','s')
yn = lower(yorn)
if strncmp(yn,'n',1) == 1
Xnameis = input('The Xname is ','s')
end
lcdnameis = input('The aname is ','s')
yorn = input('Are you sure? y or n ','s')
yn = lower(yorn)
if strncmp(yn,'n',1) == 1
lcdnameis = input('the aname is ','s')
end


[out]= createdepth_ac9_pnb(Xnameis,lcdnameis,pb);

disp('Createdepth done, now doing zcorrection with scale and offset')
scale = .9763;
offset = -1.7880;
% nd = 'new_depthoffset.txt';
% do = fopen(nd,'w');
% fprintf(do,'%s\n',pb);
% fprintf(do,'%s\n',out.scale);
% fprintf(do,'%s\n',out.offset);
% fclose(do);
zcorr(scale,offset);

%zcorr(out.scale,out.offset)

ac9bt
% 

disp('Now running dspike')
pause(2)
dspike
dspike

disp('Now running indmovavg')
pause(2)
indmovavg()


 disp('Now running binner')
 pause(2)
 binner
% %=========================================
disp('retriveing .asc files from CTD dir.')
pause(3)
 cd ..%/..
 outer = pwd;
 cd('CTD');
 cd(pb);
 cd('asc');
 %clear all
  pattern = fullfile(pwd,'*.asc')
  list = dir(pattern);
 
%
   for i = 1:size(list)
       list_ctd(i,:) = list(i).name
   end
    list_load('list_ctd',[1],{'list_ctd'});
    for j=1:size(list_ctd,1),
      ctdsplit(list_ctd(j,:));
    end

cd(now);
dlmwrite('list_ctd',list_ctd,'')
disp('now making upused.txt')
pause(2)


makeup(pb)

disp('Copy goac9.par and qcal.txt from a previous processing example')
disp('Press return to continue')
pause
 cd(now);

disp('Now calling merge_ctdac9_v2')
pause(2)

merge_ctdac9_v2(sav_pb)
cd(now);

 disp('Now calling goac9_tiho')
 pause(2)
goac9_tiho
pause(2)
disp('Now copying files to "final" folder')
eval('!mv *.cal ../final/')
eval('!mv *.mat ../final/')
eval('!mv *.ts ../final/')

disp('Now running cleanup')
 cleanup()

disp('AC9 processing complete')

process_ac9