-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFun_SetGreenModel3.m
More file actions
38 lines (37 loc) · 1.38 KB
/
Copy pathFun_SetGreenModel3.m
File metadata and controls
38 lines (37 loc) · 1.38 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
function g=Fun_SetGreenModel3(g0, nsta, grid, srate, nTime)
% =========================================================================
% Convert raw Green's functions into displacement Green's functions
% Input:
% g0 : Raw Green's functions [NtRaw, 3, Nsta*Nsub]
% nsta : Number of retained stations
% grid : [Ndip, Nstrike]
% srate : Sampling rate (Hz)
% nTime : Required number of time samples
%
% Output:
% g : Displacement Green's functions [Nt, 3*Nsta, Nsub]
%
% Component order:
% [E1...EN, N1...NN, U1...UN]
% =========================================================================
nsub = prod(grid);
if size(g0,1) < nTime
error(['The raw Green''s functions are shorter than the selected ', ...
'observation time window.']);
end
if size(g0,3) ~= nsta*nsub
error(['The number of raw Green''s-function traces does not match ', ...
'Nsta * Nsub.']);
end
% Match Green's-function length to the fixed observation time window.
g0 = g0(1:nTime,:,:);
% Extract East, North, and Up Green's functions.
gE = reshape(g0(:,1,:), [nTime, nsta, nsub]);
gN = reshape(g0(:,2,:), [nTime, nsta, nsub]);
gU = reshape(g0(:,3,:), [nTime, nsta, nsub]);
% Rearrange components as:
% [E1...EN, N1...NN, U1...UN]
g = cat(2, gE, gN, gU);
% Convert velocity Green's functions to displacement Green's functions.
g = cumsum(g, 1) ./ srate;
end