-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwavelet_filtertile_equi.m
74 lines (61 loc) · 2.14 KB
/
wavelet_filtertile_equi.m
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 [A, KT, ANG, SNR] = wavelet_filtertile_equi(dem, d, logkt_max, kt_step,ang_step, nanidx)
%% Applies wavelet filter to DEM, returning best-fit parameters at each grid
%% point using grid search over equal-angle template orientation intervals
%%
%% Robert Sare January 2016
%% Based on 2010 implementation by George Hilley
%%
%% INPUT: dem - dem grid struct
%% d - length of template scarp in out-of-plane direction
%% logkt_max - maximum log10(kt)
%% ang_step - stepsize for equiangular search
%%
%% OUTPUT: bestA - best-fit scarp amplitudes
%% bestKT - best-fit morphologic ages
%% bestANG - best-fit strikes
%% bestSNR - signal-to-noise ration for best-fit A and error
% Scarp-face fraction, noise level, template length
frac = 0.9;
if (nargin < 2)
d = 200;
logkt_max = 3.5;
kt_step = 0.1;
ang_step = 10;
end
% Equiangular search over orientation and ages
ANG = -90:ang_step:90;
LOGKT = 0:kt_step:logkt_max;
de = dem.de;
M = dem.grid;
bestSNR = zeros(size(M));
bestA = zeros(size(M));
bestKT = zeros(size(M));
bestANG = -9999.*ones(size(M));
% Grid search
for(i=1:length(LOGKT))
thiskt = 10.^LOGKT(i);
for(j=1:length(ANG))
thisang = ANG(j);
% Compute wavelet parameters for this orientation and morphologic age
[thisSNR,thisA,thiserr] = calcerror_mat_xcurv(frac,d,thisang,thiskt,de,M);
k = find(isnan(thisSNR));
thisSNR(k) = 0;
thisSNR(nanidx) = 0;
% Retain parameters with maximum SNR
bestA = (bestSNR < thisSNR).*thisA + (bestSNR >= thisSNR).*bestA;
bestKT = (bestSNR < thisSNR).*thiskt + (bestSNR >= thisSNR).*bestKT;
bestANG = (bestSNR < thisSNR).*thisang + (bestSNR >= thisSNR).*bestANG;
bestSNR = (bestSNR < thisSNR).*thisSNR + (bestSNR >= thisSNR).*bestSNR;
% Progress report
fprintf('%6.2f%%\n',(((i-1)*length(ANG) + j)./(prod([length(ANG),length(LOGKT)])))*100);
end
end
A = dem;
KT = dem;
ANG = dem;
SNR = dem;
A.grid = bestA;
KT.grid = bestKT;
ANG.grid = bestANG;
SNR.grid = bestSNR;
end