Repository navigation
Expand file tree
/
Copy pathupdateFC.m
More file actions
74 lines (66 loc) · 2.11 KB
/
Copy pathupdateFC.m
File metadata and controls
74 lines (66 loc) · 2.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
function [] = updateFC(SurveyName,DataFiles,DataFileSuffix)
% Usage: [] = updateFC(SurveyName,DataFiles,DataFileSuffix);
% Runs dnff for all data files *.bin in Survey/data for which there are
% binary data (*.bin) and system parameter files (*.sp)
% in Survey/data and Survey/SP respectively. Uses the list of available
% run files stored in cell array DataFiles. Optional argument DataFileSuffix
% can be used to change data file names from default *.bin to some other
% suffix (e.g., *.dbn, to run dnff on decimated files). If second argument
% (DataFiles) is missing this generates the file list (i.e., DataFiles)
% by calling listFromXML
%
% WARNINGS:
%
% --> IT WILL TAKE A FEW MINUTES FOR dnff to RUN,
% ESPECIALLY FOR A LARGE NUMBER OF FILES
%
if nargin == 0
Survey = startUpSurvey;
else
Survey = startUpSurvey(SurveyName);
end
binDir = getenv('MTbin');
getOS;
if nargin < 2
XMLdir = Survey.metadata;
DataFiles = listFromXML(XMLdir);
DataFileSuffix = 'bin';
elseif nargin == 2
DataFileSuffix = 'bin';
end
currentDir = pwd;
eval(['cd ''' Survey.home ''''])
nProc = 0;
dnffRunFile = ['tmp' filesep 'dnff.cfg'];
logFile = ['tmp' filesep 'dnff_' date '.log'];
nFiles = length(DataFiles);
for k = 1:nFiles
[pathstr,runID] = fileparts(DataFiles{k}.fileName);
%runID = DataFiles{k}.Name;
FCfile = [Survey.FC runID '.f5' ];
FC = (exist(FCfile,'file')==2);
dataFile = [Survey.data runID '.' DataFileSuffix ];
DATA = (exist(dataFile,'file')==2);
spFileRun = [Survey.SP runID '.sp'];
spFileSite = [Survey.SP runID(1:end-1) '.sp'];
SP = (exist(spFileSite,'file') > 0 | exist(spFileRun,'file') > 0);
if ~FC & (SP & DATA)
nProc = nProc+1;
if nProc == 1
fid = fopen(dnffRunFile,'w');
else
fprintf(fid,'%s\n','y');
end
binFile = [ runID '.' DataFileSuffix ];
fprintf(fid,'%s\n',binFile);
end
end
if nProc > 0
disp('Updating FC files...');
fprintf(fid,'%s\n','n');
fclose(fid);
[status,output] = system([cmd binDir 'dnff -B < ' dnffRunFile '> ' logFile ' &']);
disp(output);
else
display('No FC files to compute')
end