-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathcombine_sta.m
More file actions
60 lines (54 loc) · 1.98 KB
/
Copy pathcombine_sta.m
File metadata and controls
60 lines (54 loc) · 1.98 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
% for CDpapua project, for station 13 and 32 turns to be the same station, all the xcor from these two stations should be stacked together.
%
clear;
load stainfo_BHZ.mat
load xspinfo.mat
% add station 32's data to station 13
ind = find([xspinfo(:).sta1] == 13 | [xspinfo(:).sta2]==13);
for ixsp = ind
if xspinfo(ixsp).sta1 == 13
sta2 = xspinfo(ixsp).sta2;
data13 = load(xspinfo(ixsp).filename);
cohere_sum = data13.cohere_sum;
coherenum = data13.coherenum;
ind32 = find([xspinfo(:).sta2] == sta2 & [xspinfo(:).sta1] == 32);
if ~isempty(ind32)
data32 = load(xspinfo(ind32).filename);
cohere_sum = cohere_sum + data32.cohere_sum;
coherenum = coherenum + data32.coherenum;
delete(xspinfo(ind32).filename);
delfilename = xspinfo(ind32).filename;
end
ind32 = find([xspinfo(:).sta1] == sta2 & [xspinfo(:).sta2]== 32);
if ~isempty(ind32)
data32 = load(xspinfo(ind32).filename);
cohere_sum = cohere_sum + conj(data32.cohere_sum);
coherenum = coherenum + data32.coherenum;
delete(xspinfo(ind32).filename);
delfilename = xspinfo(ind32).filename;
end
elseif xspinfo(ixsp).sta2 == 13
sta1 = xspinfo(ixsp).sta1;
data13 = load(xspinfo(ixsp).filename);
cohere_sum = data13.cohere_sum;
coherenum = data13.coherenum;
ind32 = find([xspinfo(:).sta1] == sta1 & [xspinfo(:).sta2] == 32);
if ~isempty(ind32)
data32 = load(xspinfo(ind32).filename);
cohere_sum = cohere_sum + data32.cohere_sum;
coherenum = coherenum + data32.coherenum;
delete(xspinfo(ind32).filename);
delfilename = xspinfo(ind32).filename;
end
ind32 = find([xspinfo(:).sta2] == sta1 & [xspinfo(:).sta1] == 32);
if ~isempty(ind32)
data32 = load(xspinfo(ind32).filename);
cohere_sum = cohere_sum + conj(data32.cohere_sum);
coherenum = coherenum + data32.coherenum;
delete(xspinfo(ind32).filename);
delfilename = xspinfo(ind32).filename;
end
end
save(xspinfo(ixsp).filename,'cohere_sum','coherenum')
disp(['Saved: ',xspinfo(ixsp).filename,' Deleted: ',delfilename]);
end