Skip to content

Commit 452bc85

Browse files
committed
- updated many functions to make discrete time vectors properly
- probably a bug or two made by making all these changes - added misc/maketime which shows how to do this - added misc/freqcount for occurance counting purposes
1 parent 25912dc commit 452bc85

29 files changed

+165
-124
lines changed

Diff for: docs/seizmo_to_do.txt

+9-18
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,6 @@ way to make movies while you do other things on the screen:
55
## hf = figure(‘visible’, ‘off’)
66
## addframe(aviobj, hf)
77

8-
times from b+npts+delta:
9-
float issues: b+(0:npts-1)*delta (THIS IS WHAT I'VE BEEN USING!)
10-
no float issues: b+(0:delta:delta*(npts-1)) (MERGE OF UNEVEN USES THIS!)
11-
- grep 0:npts */*.m
12-
138
octave_364_fixes in install_seizmo & startup
149
mp_tmerc goes from m_map_fixes to m_map_fixes/private in webinstall_mmap
1510
figure out best way to use scatter in octave
@@ -19,33 +14,31 @@ how about installing the latest octave stable branch instead
1914
taup Sn/Pn no refracted path bug
2015
taup strange extra P phases bug
2116

22-
3. isc_fm
23-
4. sacpz
24-
5. maketimes issue
17+
download_extras.bash
2518

2619
1. install_seizmo improvements
2720
- extras
28-
x webinstall_extras
29-
x uninstall_extras
3021
- iscfmdb
3122
x parse_isc_fm
3223
- clean_isc_fm
3324
- no depth -> out
3425
- no mag -> out
3526
- fill in remaining fields
3627
- update_isc_fm
37-
x readsacpz_rdseed
38-
x writesacpz_rdseed
39-
x issacpz_rdseed
40-
x fix_old_sacpz
41-
- update sacpzdb
28+
- compat w/ findcmt findcmts plotmt mapcmts etc ?
29+
- sacpz
30+
x readsacpz_rdseed
31+
x writesacpz_rdseed
32+
x issacpz_rdseed
33+
x fix_old_sacpz
34+
- update sacpzdb
4235
- makesacpz
4336
- getsacpz (sacpz ws support)
4437
- db2sacpz
4538
- (remove|apply)sacpz
4639
- iris_sacpzdb_build
4740
- iris_sacpzdb_fixes
48-
- station_check (uses new sacpzdb)
41+
- station_check (uses new sacpzdb)
4942
- add new mapping features?
5043
- natural earth: http://www.naturalearthdata.com/downloads/
5144
- gplates stuff
@@ -62,8 +55,6 @@ taup strange extra P phases bug
6255
- add an ani flag of some sort (should indicate type too)
6356
- dependent functions need to handle flag logic and math
6457
- add more models shared via iris emc
65-
- install_seizmo
66-
- uninstall_seizmo
6758
- any function that requires a jar does
6859
a check first and tries to add it to
6960
the dynamic path if not found

Diff for: ftran/omegamultiply.m

+4-2
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,10 @@
4444
% Feb. 11, 2011 - mass nargchk fix
4545
% Feb. 4, 2012 - doc update, multiplyomega to omegamultiply
4646
% Feb. 14, 2013 - use strcmpi for consistency
47+
% Mar. 1, 2014 - maketime fix
4748
%
4849
% Written by Garrett Euler (ggeuler at wustl dot edu)
49-
% Last Updated Feb. 14, 2013 at 15:05 GMT
50+
% Last Updated Mar. 1, 2014 at 15:05 GMT
5051

5152
% todo:
5253

@@ -99,7 +100,8 @@
99100

100101
% differentiate
101102
cols=size(data(i).dep,2)/2;
102-
omega=2*pi*delta(i)*[0:npts2(i) (npts2(i)-1):-1:1].';
103+
omega=2*pi*delta(i);
104+
omega=[0:omega:omega*npts2(i) (npts2(i)-1)*omega:-omega:omega].';
103105
if(strcmpi(iftype(i),'irlim'))
104106
% rlim %%%%%%%%%%%%%%%%%%%%%%%%%%%%%
105107
% 0Hz real/imag == 0 else

Diff for: ftran/omegashift.m

+4-2
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,10 @@
3333
% Mar. 15, 2012 - fix example
3434
% May 31, 2012 - minor doc update
3535
% Feb. 14, 2013 - use strcmpi for consistency
36+
% Mar. 1, 2014 - maketime fix
3637
%
3738
% Written by Garrett Euler (ggeuler at wustl dot edu)
38-
% Last Updated Feb. 14, 2013 at 15:05 GMT
39+
% Last Updated Mar. 1, 2014 at 15:05 GMT
3940

4041
% todo:
4142

@@ -96,7 +97,8 @@
9697

9798
% time shift
9899
cols=size(data(i).dep,2)/2;
99-
wt=shift(i)*2*pi*delta(i)*(0:npts(i)-1).';
100+
wt=shift(i)*2*pi*delta(i);
101+
wt=(0:wt:wt*(npts(i)-1)).';
100102
if(strcmpi(iftype(i),'irlim'))
101103
data(i).dep(:,[1:2:end 2:2:end])=...
102104
[data(i).dep(:,1:2:end).*cos(wt(:,ones(1,cols)))...

Diff for: ftran/splitpad.m

+4-2
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,10 @@
4141
% tolerance to the point at 0 requirement
4242
% Dec. 21, 2011 - doc update
4343
% May 29, 2012 - pow2pad=0 by default
44+
% Mar. 1, 2014 - maketime fix
4445
%
4546
% Written by Garrett Euler (ggeuler at wustl dot edu)
46-
% Last Updated May 29, 2012 at 10:05 GMT
47+
% Last Updated Mar. 1, 2014 at 10:05 GMT
4748

4849
% todo:
4950

@@ -96,7 +97,8 @@
9697
depmen=nan(nrecs,1); depmin=depmen; depmax=depmen;
9798
for i=1:nrecs
9899
% check has point at 0 (within some tolerance)
99-
idx=find(abs(b(i)+(0:npts(i)-1)*delta(i))<delta(i)/10,1);
100+
idx=find(...
101+
abs(b(i)+(0:delta(i):delta(i)*(npts(i)-1)))<delta(i)/10,1);
100102
if(isempty(idx))
101103
error('seizmo:splitpad:noZeroPoint',...
102104
'Record %d does not have a point at zero!',i);

Diff for: hdr/makeuneven.m

+3-2
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,10 @@
3232
% Dec. 30, 2010 - fixed 1-liner description
3333
% Feb. 11, 2011 - mass nargchk fix
3434
% Jan. 30, 2012 - doc update, better checkheader/getheader usage
35+
% Mar. 1, 2014 - maketime fix
3536
%
3637
% Written by Garrett Euler (ggeuler at wustl dot edu)
37-
% Last Updated Jan. 30, 2012 at 15:05 GMT
38+
% Last Updated Mar. 1, 2014 at 15:05 GMT
3839

3940
% todo:
4041

@@ -71,7 +72,7 @@
7172
% loop over even, add .ind
7273
idx=find(even);
7374
for i=1:sum(even)
74-
data(idx(i)).ind=b(i)+(0:npts(i)-1)'*delta(i);
75+
data(idx(i)).ind=b(i)+(0:delta(i):delta(i)*(npts(i)-1)).';
7576
end
7677
end
7778

Diff for: forge/freqcount.m renamed to misc/freqcount.m

File renamed without changes.

Diff for: forge/maketime.m renamed to misc/maketime.m

File renamed without changes.

Diff for: multi/meld.m

+32-32
Original file line numberDiff line numberDiff line change
@@ -308,12 +308,12 @@
308308
% debugging output, unevenoverlap option, uneven &
309309
% multi-rate merging
310310
% Feb. 22, 2014 - overlap blend method, unevenoverlap ignore method
311+
% Mar. 1, 2014 - maketime fix
311312
%
312313
% Written by Garrett Euler (ggeuler at wustl dot edu)
313-
% Last Updated Feb. 22, 2014 at 15:05 GMT
314+
% Last Updated Mar. 1, 2014 at 15:05 GMT
314315

315316
% todo:
316-
% - ignore unevenoverlap method
317317

318318
% check nargin
319319
if(mod(nargin-1,2))
@@ -1320,9 +1320,9 @@
13201320
end
13211321

13221322
% interpolate gap
1323-
lasttimes=ab(last,2)+(0:(npts(last)-1))*delta;
1324-
gaptimes=sae(2)+(1:nsamples)*delta;
1325-
newtimes=sab(2)+(0:(npts(first)-1))*delta;
1323+
lasttimes=ab(last,2)+(0:delta:delta*(npts(last)-1));
1324+
gaptimes=sae(2)+(delta:delta:delta*nsamples);
1325+
newtimes=sab(2)+(0:delta:delta*(npts(first)-1));
13261326
gapdata=interp1([newtimes lasttimes],...
13271327
[data(first).dep; data(last).dep],...
13281328
gaptimes,option.INTERPOLATE,'extrap');
@@ -1365,9 +1365,9 @@
13651365
end
13661366

13671367
% interpolate gap
1368-
firsttimes=ab(first,2)+(0:(npts(first)-1))*delta;
1369-
gaptimes=ae(first,2)+(1:nsamples)*delta;
1370-
newtimes=sab(2)+(0:(npts(last)-1))*delta;
1368+
firsttimes=ab(first,2)+(0:delta:delta*(npts(first)-1));
1369+
gaptimes=ae(first,2)+(delta:delta:delta*nsamples);
1370+
newtimes=sab(2)+(0:delta:delta*(npts(last)-1));
13711371
gapdata=interp1([firsttimes newtimes],...
13721372
[data(first).dep; data(last).dep],...
13731373
gaptimes,option.INTERPOLATE,'extrap');
@@ -1410,10 +1410,10 @@
14101410
end
14111411

14121412
% interpolate first record and gap
1413-
firsttimes=ab(first,2)+(0:(npts(first)-1))*delta;
1414-
lasttimes=ab(last,2)+(0:(npts(last)-1))*delta;
1415-
gaptimes=sae(2)+(1:nsamples)*delta;
1416-
newtimes=sab(2)+(0:(npts(first)-1))*delta;
1413+
firsttimes=ab(first,2)+(0:delta:delta*(npts(first)-1));
1414+
lasttimes=ab(last,2)+(0:delta:delta*(npts(last)-1));
1415+
gaptimes=sae(2)+(delta:delta:delta*nsamples);
1416+
newtimes=sab(2)+(0:delta:delta*(npts(first)-1));
14171417
newdata=interp1([firsttimes lasttimes],...
14181418
[data(first).dep; data(last).dep],...
14191419
[newtimes gaptimes],option.INTERPOLATE,'extrap');
@@ -1456,10 +1456,10 @@
14561456
end
14571457

14581458
% interpolate last record and gap
1459-
firsttimes=ab(first,2)+(0:(npts(first)-1))*delta;
1460-
lasttimes=ab(last,2)+(0:(npts(last)-1))*delta;
1461-
gaptimes=ae(first,2)+(1:nsamples)*delta;
1462-
newtimes=sab(2)+(0:(npts(last)-1))*delta;
1459+
firsttimes=ab(first,2)+(0:delta:delta*(npts(first)-1));
1460+
lasttimes=ab(last,2)+(0:delta:delta*(npts(last)-1));
1461+
gaptimes=ae(first,2)+(delta:delta:delta*nsamples);
1462+
newtimes=sab(2)+(0:delta:delta*(npts(last)-1));
14631463
newdata=interp1([firsttimes lasttimes],...
14641464
[data(first).dep; data(last).dep],...
14651465
[gaptimes newtimes],option.INTERPOLATE,'extrap');
@@ -1570,8 +1570,8 @@
15701570
sae=ae(first,:)+[0 shift];
15711571

15721572
% interpolate first record
1573-
oldtimes=ab(first,2)+(0:(npts(first)-1))*delta;
1574-
newtimes=sab(2)+(0:(npts(first)-1))*delta;
1573+
oldtimes=ab(first,2)+(0:delta:delta*(npts(first)-1));
1574+
newtimes=sab(2)+(0:delta:delta*(npts(first)-1));
15751575
data(first).dep=...
15761576
interp1(oldtimes,data(first).dep,newtimes,option.INTERPOLATE,'extrap');
15771577
data(first).dep=data(first).dep.';
@@ -1615,8 +1615,8 @@
16151615
sae=ae(last,:)-[0 shift];
16161616

16171617
% interpolate last record
1618-
oldtimes=ab(last,2)+(0:(npts(last)-1))*delta;
1619-
newtimes=sab(2)+(0:(npts(last)-1))*delta;
1618+
oldtimes=ab(last,2)+(0:delta:delta*(npts(last)-1));
1619+
newtimes=sab(2)+(0:delta:delta*(npts(last)-1));
16201620
data(last).dep=...
16211621
interp1(oldtimes,data(last).dep,newtimes,option.INTERPOLATE,'extrap');
16221622
data(last).dep=data(last).dep.';
@@ -1735,8 +1735,8 @@
17351735
sae=ae(first,:)+[0 shift];
17361736

17371737
% interpolate first record
1738-
oldtimes=ab(first,2)+(0:(npts(first)-1))*delta;
1739-
newtimes=sab(2)+(0:(npts(first)-1))*delta;
1738+
oldtimes=ab(first,2)+(0:delta:delta*(npts(first)-1));
1739+
newtimes=sab(2)+(0:delta:delta*(npts(first)-1));
17401740
data(first).dep=...
17411741
interp1(oldtimes,data(first).dep,newtimes,option.INTERPOLATE,'extrap');
17421742
data(first).dep=data(first).dep.';
@@ -1780,8 +1780,8 @@
17801780
sae=ae(last,:)-[0 shift];
17811781

17821782
% interpolate last record
1783-
oldtimes=ab(last,2)+(0:(npts(last)-1))*delta;
1784-
newtimes=sab(2)+(0:(npts(last)-1))*delta;
1783+
oldtimes=ab(last,2)+(0:delta:delta*(npts(last)-1));
1784+
newtimes=sab(2)+(0:delta:delta*(npts(last)-1));
17851785
data(last).dep=...
17861786
interp1(oldtimes,data(last).dep,newtimes,option.INTERPOLATE,'extrap');
17871787
data(last).dep=data(last).dep.';
@@ -1908,8 +1908,8 @@
19081908
sae=ae(first,:)+[0 shift];
19091909

19101910
% interpolate first record
1911-
oldtimes=ab(first,2)+(0:(npts(first)-1))*delta;
1912-
newtimes=sab(2)+(0:(npts(first)-1))*delta;
1911+
oldtimes=ab(first,2)+(0:delta:delta*(npts(first)-1));
1912+
newtimes=sab(2)+(0:delta:delta*(npts(first)-1));
19131913
data(first).dep=...
19141914
interp1(oldtimes,data(first).dep,newtimes,option.INTERPOLATE,'extrap');
19151915
data(first).dep=data(first).dep.';
@@ -1957,8 +1957,8 @@
19571957
sae=ae(last,:)-[0 shift];
19581958

19591959
% interpolate last record
1960-
oldtimes=ab(last,2)+(0:(npts(last)-1))*delta;
1961-
newtimes=sab(2)+(0:(npts(last)-1))*delta;
1960+
oldtimes=ab(last,2)+(0:delta:delta*(npts(last)-1));
1961+
newtimes=sab(2)+(0:delta:delta*(npts(last)-1));
19621962
data(last).dep=...
19631963
interp1(oldtimes,data(last).dep,newtimes,option.INTERPOLATE,'extrap');
19641964
data(last).dep=data(last).dep.';
@@ -2092,8 +2092,8 @@
20922092
sae=ae(first,:)+[0 shift];
20932093

20942094
% interpolate first record
2095-
oldtimes=ab(first,2)+(0:(npts(first)-1))*delta;
2096-
newtimes=sab(2)+(0:(npts(first)-1))*delta;
2095+
oldtimes=ab(first,2)+(0:delta:delta*(npts(first)-1));
2096+
newtimes=sab(2)+(0:delta:delta*(npts(first)-1));
20972097
data(first).dep=...
20982098
interp1(oldtimes,data(first).dep,newtimes,option.INTERPOLATE,'extrap');
20992099
data(first).dep=data(first).dep.';
@@ -2142,8 +2142,8 @@
21422142
sae=ae(last,:)-[0 shift];
21432143

21442144
% interpolate last record
2145-
oldtimes=ab(last,2)+(0:(npts(last)-1))*delta;
2146-
newtimes=sab(2)+(0:(npts(last)-1))*delta;
2145+
oldtimes=ab(last,2)+(0:delta:delta*(npts(last)-1));
2146+
newtimes=sab(2)+(0:delta:delta*(npts(last)-1));
21472147
data(last).dep=...
21482148
interp1(oldtimes,data(last).dep,newtimes,option.INTERPOLATE,'extrap');
21492149
data(last).dep=data(last).dep.';

Diff for: multi/rotate.m

+12-9
Original file line numberDiff line numberDiff line change
@@ -185,9 +185,10 @@
185185
% Jan. 30, 2012 - drop SEIZMO global
186186
% Feb. 7, 2012 - fix no horizontals bug
187187
% Mar. 13, 2012 - use getheader improvements
188+
% Mar. 1, 2014 - maketime fix
188189
%
189190
% Written by Garrett Euler (ggeuler at wustl dot edu)
190-
% Last Updated Mar. 13, 2012 at 23:18 GMT
191+
% Last Updated Mar. 1, 2014 at 23:18 GMT
191192

192193
% todo:
193194
% - a 'norotate' would be nice
@@ -607,10 +608,12 @@
607608
% get independent component
608609
t1=cell(n1,1); t2=cell(n2,1);
609610
for j=1:n1
610-
t1{j}=cb1(j)+(0:npts(cidx1(j))-1).'*delta(pidx(1));
611+
t1{j}=cb1(j)+...
612+
(0:delta(pidx(1)):delta(pidx(1))*(npts(cidx1(j))-1)).';
611613
end
612614
for j=1:n2
613-
t2{j}=cb2(j)+(0:npts(cidx2(j))-1).'*delta(pidx(1));
615+
t2{j}=cb2(j)+...
616+
(0:delta(pidx(1)):delta(pidx(1))*(npts(cidx2(j))-1)).';
614617
end
615618

616619
% loop over all possible pairings
@@ -846,25 +849,25 @@
846849

847850
% get new times
848851
if(move1)
849-
t=t2(bidx2+(0:npts-1));
852+
t=t2(bidx2+(0:(npts-1)));
850853
else % move 2
851-
t=t1(bidx1+(0:npts-1));
854+
t=t1(bidx1+(0:(npts-1)));
852855
end
853856

854857
% get x1,x2
855858
if(shift<=shiftmax)
856859
% ok we are just shifting one record to time align
857860
if(option.DEBUG); disp('Adjust Method: SHIFT'); end
858-
x1=x1(bidx1+(0:npts-1));
859-
x2=x2(bidx2+(0:npts-1));
861+
x1=x1(bidx1+(0:(npts-1)));
862+
x2=x2(bidx2+(0:(npts-1)));
860863
else % interpolate
861864
% interpolating one record to time align
862865
if(option.DEBUG); disp('Adjust Method: INTERPOLATE'); end
863866
if(move1)
864867
x1=interp1(t1,x1,t,option.INTERPOLATE,'extrap');
865-
x2=x2(bidx2+(0:npts-1));
868+
x2=x2(bidx2+(0:(npts-1)));
866869
else % interpolate 2
867-
x1=x1(bidx1+(0:npts-1));
870+
x1=x1(bidx1+(0:(npts-1)));
868871
x2=interp1(t2,x2,t,option.INTERPOLATE,'extrap');
869872
end
870873
end

Diff for: noise/noise_psdgram.m

+3-2
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,10 @@
4040
% Apr. 15, 2013 - initial version, no 50% data in subwindow bugfix
4141
% Apr. 17, 2013 - use powerspectraldensity to get psd
4242
% Jan. 26, 2014 - abs path exist fix
43+
% Mar. 1, 2014 - maketime fix
4344
%
4445
% Written by Garrett Euler (ggeuler at wustl dot edu)
45-
% Last Updated Jan. 26, 2014 at 13:30 GMT
46+
% Last Updated Mar. 1, 2014 at 13:30 GMT
4647

4748
% todo:
4849

@@ -204,7 +205,7 @@
204205
% grab frequency once
205206
if(~exist('f','var'))
206207
[npts,delta]=getheader(swdata(1),'npts','delta');
207-
f=(0:npts-1)'*delta;
208+
f=(0:delta:delta*(npts-1)).';
208209
end
209210

210211
% append spectra to storage cells (one per record)

0 commit comments

Comments
 (0)