Difference between revisions of "Ac9bt.m"
Jump to navigation
Jump to search
(Created page with '<pre> % AC9BT % FEB 98,FEB 99 % Stephen Wolfe % Input: none % Look for: list_ac9 % Output: z*.lcd.?, z*.lcd.strip % Assumptions: fixed for either single casts or yo-yo's. Have t…') |
|||
Line 162: | Line 162: | ||
not_ac9_files | not_ac9_files | ||
</pre> | </pre> | ||
+ | [[ac9bt]] |
Latest revision as of 11:53, 17 March 2011
% AC9BT % FEB 98,FEB 99 % Stephen Wolfe % Input: none % Look for: list_ac9 % Output: z*.lcd.?, z*.lcd.strip % Assumptions: fixed for either single casts or yo-yo's. Have to % pick something for at least 1 profile of each yo-yo % for the profile numbers to work correctly. Can't tell % if you skip a down-up pair. % % Purpose: pick tops and bottoms % % Calls: bt_ac9 % Maintain: {filename, columnarraylist, disp_text} % Uses: perfect for ac9 processing, ref: ac9.ins % Example: ac9bt % Notes: This will run on NT if the call to bbopstrip is % commented out and the files are already stripped % Should label direction in castid table as well as % profile number. Work from left to right. If you % choose not to save points for a profile, you can % repick them and choose save and then go on. % TO DO: The archive scheme does not work due to changes in % naming convention. Doesn't create the log directory % if it's not there either. a=1; clf; list_ac9=[]; ac9_files=[]; not_ac9_files=[]; tmpfile=fullfile(pwd,'goac9bt_tmp') % check for list_ac9 in pwd [s,m]=unix('ls list_ac9'); if isempty(m) msg=sprintf('Check your list_ac9.'); disp(msg) return end clear s m % load list_ac9 fid=fopen('list_ac9','r'); while fid, check=fgetl(fid); if check == -1, break, end list_ac9=[list_ac9; check]; end list_ac9; clear fid check % check presence of ac9 files badfilectr=0; for i=1:size(list_ac9,1) [s,m]=unix(['ls ',list_ac9(i,:)]); if s badfilectr=badfilectr+1; end end clear i if badfilectr if badfilectr==1 msg=sprintf('%i missing ac9 file.',badfilectr); disp(msg) error('Your ac9list includes a file not in pwd.') else msg=sprintf('%i missing ac9 files.',badfilectr); disp(msg) error('Your ac9list includes files not in pwd.') end end clear s m badfilectr msg % loop through for i=1:size(list_ac9,1) ac9_lcd=list_ac9(i,:); %changes directory in and out % strip em ac9_strip=[ac9_lcd '.strip']; % cd .. %eval(['E_BBstrip -sz 1mer_time 1depth', ac9_lcd ' ' ac9_strip]); %modified from BBopstrip to E_BBstrip removed ! -sz E_BBstrip(a,ac9_lcd,'1mer_time','1depth') ac9_strip; %cd .. [fileA,headA]=read_strip(ac9_strip); pwd; %eval(['!rm ''ac9_strip']); %cd .. [bt_pts]=bt_ac9(fileA); if ~isempty(bt_pts), %create header, castid matrix %castid index 1mer_time 1depth %zub11008adt1 7.5000000e+01 2.1710000e+04 2.0443990e+02 %zub11008adb1 1.2810000e+03 3.7655000e+05 1.3007170e+00 %castdir={ 'dt','db','ub','ut' }; %castdir=[castdir castdir castdir castdir]; % good for 4 yoyo's %if size(bt_pts,1)>size(castdir,2), % error('ac9bt: increase size of castdir.'); %end dd=[]; idir=[]; dd=diff(bt_pts(:,3)); dd=[dd; 0]; id=1; %cd('pb218') %------------------------------------------have to change fid=fopen( 'bt.pts', 'w' ); fprintf(fid,'castid index 1mer_time 1depth\n'); for i=1:2:size(bt_pts,1), if dd(i)>0, if idir==1, id=id+1; end idir=1; castdir1(i:i+1,:)=['dt'; 'db']; else, idir=2; castdir1(i:i+1,:)=['ub'; 'ut']; end bt_castname=[ ac9_lcd(1:9),castdir1(i,:),num2str(id) ]; fprintf(fid,'%s %1.7e %1.7e %1.7e \n',bt_castname,bt_pts(i,:)); bt_castname=[ ac9_lcd(1:9),castdir1(i+1,:),num2str(id) ]; fprintf(fid,'%s %1.7e %1.7e %1.7e \n',bt_castname,bt_pts(i+1,:)); if idir==2, id=id+1; end end fclose(fid); % cd .. %-------------------------------------------------------have to change %do this by calling a script that takes care of the awk and archive %changed this eval([ '!awk < ' ac9_lcd ' > ' tmpfile... ' ''$1=="<sampled_parameters>"{system("cat bt.pts")}{print $0}''']); eval([ '!mv ' tmpfile ' ' ac9_lcd ]); %archive %cruisename=eval(['echo ' ac9_lcd ' | cut -b 3-6']) cruisename=ac9_lcd(3:6); % mkdir(strcat(pwd,'/ARCHIVE/')) archive=[ pwd '/ARCHIVE/' ]; %archive=[ '/home/data92/bbop/ARCHIVE/' ]; %cp $lcd_file /home/data92/bbop/ARCHIVE/$cruisename/ac9 %eval(['!cp ' ac9_lcd ' ' archive cruisename '/ac9']); %echo $lcd_file has been archived to /home/data92/bbop/ARCHIVE/$cruisename/ac9 eval(['!echo ' ac9_lcd ' has been archived to ' archive cruisename '/ac9']); ac9_files=[ac9_files; ac9_lcd]; else not_ac9_files=[not_ac9_files; ac9_lcd]; end %cleanup %clear ac9_lcd bt_pts fileA headA ac9_strip; %eval('!rm bt.pts'); end %cd .. ac9_files not_ac9_files