Difference between revisions of "CPSbt E"
Jump to navigation
Jump to search
| Line 1: | Line 1: | ||
| − | < | + | <pre> |
% AC9BT | % AC9BT | ||
% FEB 98,FEB 99 | % FEB 98,FEB 99 | ||
Latest revision as of 14:51, 13 February 2014
% AC9BT
% FEB 98,FEB 99
% Stephen Wolfe
% Input: none
% Look for: list_prr
% 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 prr processing, ref: prr.ins
% Example: prrbt
% 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.
%Erik Stassinos Apr 2013
clf;
list_prr=[];
prr_files=[];
not_prr_files=[];
tmpfile=fullfile(pwd,'goprrbt_tmp');
% check for list_prr in pwd
[s,m]=unix('ls list_prr');
if isempty(m)
msg=sprintf('Check your list_prr.');
disp(msg)
return
end
clear s m
% load list_prr
fid=fopen('list_prr.txt','r');
while fid,
check=fgetl(fid);
if check == -1, break, end
list_prr=[list_prr; check];
end
list_prr;
clear fid check
% check presence of prr files
badfilectr=0;
for i=1:size(list_prr,1)
[s,m]=unix(['ls ',list_prr(i,:)]);
if s
badfilectr=badfilectr+1;
end
end
clear i
if badfilectr
if badfilectr==1
msg=sprintf('%i missing prr file.',badfilectr);
disp(msg)
error('Your prrlist includes a file not in pwd.')
else
msg=sprintf('%i missing prr files.',badfilectr);
disp(msg)
error('Your prrlist includes files not in pwd.')
end
end
clear s m badfilectr msg
% loop through
for i=1:size(list_prr,1)
prr_lcd=list_prr(i,:);
% strip em
prr_strip=[prr_lcd '.strip'];
%eval(['!sbtprr_mob ',prr_lcd])
%eval(['!bbopstrip -sz 1mer_time 1depth ' prr_lcd ' 'prr_strip]);
%prrstrip(1,prr_lcd,'1mer_time','depth_ed') %changed 9-18-2012
%prrstrip(1,prr_lcd,'1mer_time','1Depth') %need to change to accomodate screwed up LCD conversion 12-3-12
% prrstrip(1,prr_lcd,'1mer_time','1Depth')
prrstrip(1,prr_lcd,'FrameCount','LuZDepth')
[fileA,headA]=read_strip(prr_strip);
%eval(['!rm ''prr_strip']);
[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('prrbt: increase size of castdir.');
%end
dd=[];
idir=[];
dd=diff(bt_pts(:,3));
dd=[dd; 0];
id=1;
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=[ prr_lcd(1:9),castdir1(i,:),num2str(id) ];
fprintf(fid,'%s %1.7e %1.7e %1.7e \n',bt_castname,bt_pts(i,:));
bt_castname=[ prr_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);
%do this by calling a script that takes care of the awk and archive
eval([ '!awk < ' prr_lcd ' > ' tmpfile...
' ''$1=="<sampled_parameters>"{system("cat bt.pts")}{print $0}'''])
eval([ '!mv ' tmpfile ' ' prr_lcd ]);
%archive
%cruisename=eval(['echo ' prr_lcd ' | cut -b 3-6'])
%cruisename=prr_lcd(3:6);
%%cruisename=prr_lcd(11:17); commented 9-18-2012
%archive=[ pwd '/ARCHIVE/' ];
%=>archive=[ '/home/data92/bbop/ARCHIVE/' ];
%cp $lcd_file /home/data92/bbop/ARCHIVE/$cruisename/prr
% eval(['!cp ' prr_lcd ' ' archive cruisename '/prr']);
%echo $lcd_file has been archived to /home/data92/bbop/ARCHIVE/$cruisename/prr
%=>eval(['!echo ' prr_lcd ' has been archived to 'archive cruisename '/prr']);
prr_files=[prr_files; prr_lcd];
else
not_prr_files=[not_prr_files; prr_lcd];
end
%cleanup
%clear prr_lcd bt_pts fileA headA prr_strip;
%eval('!rm bt.pts');
end
prr_files
not_prr_files
back to C-OPS/CERBERUS Mfiles