Skip to content

Commit 269ed9e

Browse files
committed
first effort for GNU Octave compatibility (sefran3)
1 parent e23bfa9 commit 269ed9e

File tree

3 files changed

+15
-15
lines changed

3 files changed

+15
-15
lines changed

CODE/matlab/rgb.m

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
%
1616
% Author: Francois Beauducel <[email protected]>
1717
% Created: 2008-11-10 in Paris, France
18-
% Updated: 2022-06-12
18+
% Updated: 2022-07-22
1919

2020
html = [ ...
2121
{'AliceBlue','#F0F8FF'};
@@ -187,7 +187,7 @@
187187
end
188188
htm{i} = s;
189189
if length(s) >= 6
190-
s = regexprep(s,'\','');
190+
s = regexprep(s,'\\','');
191191
if strcmp(s(1),'#')
192192
s = s(2:end);
193193
else
@@ -204,4 +204,3 @@
204204
rgb(i,:) = [hex2dec(rr),hex2dec(gg),hex2dec(bb)]/255;
205205
end
206206
end
207-

CODE/matlab/superprocs/sefran3.m

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ function sefran3(name,fdate)
2020
% Authors: Francois Beauducel, Didier Lafon, Alexis Bosson, Jean-Marie Saurel, WEBOBS/IPGP
2121
% Created: 2012-02-09 in Paris, France
2222
% (based on legacy sefran.m, 2002 and sefran2.m, 2007)
23-
% Updated: 2022-06-12
23+
% Updated: 2022-07-22
2424

2525
WO = readcfg;
2626
wofun = sprintf('WEBOBS{%s}',mfilename);
@@ -137,7 +137,7 @@ function sefran3(name,fdate)
137137

138138
% imports SEFRAN3 channel parameters
139139
fid = fopen(SEFRAN3.CHANNEL_CONF,'rt');
140-
C = textscan(fid,'%q%q%q%q%q%q%q%*[^\n]','CommentStyle','#');
140+
C = textscan(fid,'%q%q%q%q%q%q%q','CommentStyle','#');
141141
fclose(fid);
142142
% C{1} = channel name (alias)
143143
% C{2} = channel stream
@@ -191,7 +191,7 @@ function sefran3(name,fdate)
191191
t1 = t0 + daymn;
192192
tv = datevec(t0);
193193
pdat = sprintf('%s/%4d/%4d%02d%02d',SEFRAN3.ROOT,tv(1),tv(1:3));
194-
f = sprintf('%s/%s/%4d%02d%02d%02d%02d%02d',pdat,SEFRAN3.PATH_IMAGES_MINUTE,tv);
194+
f = sprintf('%s/%s/%4d%02d%02d%02d%02d%02.0f',pdat,SEFRAN3.PATH_IMAGES_MINUTE,tv);
195195
fpng = sprintf('%s.png',f);
196196
fpng_high = sprintf('%s_high.png',f);
197197

@@ -466,7 +466,7 @@ function sefran3(name,fdate)
466466
else
467467
pngq = '';
468468
end
469-
fpng = sprintf('%s/%s/%4d%02d%02d%02d%02d%02ds.png',pdat,sgrampath,tv);
469+
fpng = sprintf('%s/%s/%4d%02d%02d%02d%02d%02.0fs.png',pdat,sgrampath,tv);
470470
fprintf('%s: creating %s ... ',wofun,fpng);
471471
ftmp3 = sprintf('%s/sgram.eps',ptmp);
472472
fsxy = [vits,hip]; % image size (in inches)
@@ -691,7 +691,7 @@ function sefran3(name,fdate)
691691
dt = 0;
692692
end
693693
% makes SeedLink request and save to temporary miniseed file
694-
wosystem(sprintf('%s -d -o %s -S "%s" -tw %d,%d,%d,%d,%d,%d:%g,%d,%d,%d,%d,%g %s', ...
694+
wosystem(sprintf('%s -d -o %s -S "%s" -tw %d,%d,%d,%d,%d,%1.0f:%d,%d,%d,%d,%d,%1.0f %s', ...
695695
slinktool,fmsd,streams,datevec(t0-max(dt)),datevec(t1),datasource),SEFRAN3,'warning');
696696
else
697697
fprintf('%s: ** WARNING ** SEEDLINK server %s at %s has no channel available !\n',wofun,datasource,datestr(t1));
@@ -709,7 +709,7 @@ function sefran3(name,fdate)
709709
fid = fopen(freq,'wt');
710710
for n = 1:length(sfr)
711711
c = textscan(sfr{n},'%s','Delimiter','.:'); % splits Network, Station, Loc and Channel codes
712-
fprintf(fid,'%d,%d,%d,%d,%d,%g %d,%d,%d,%d,%d,%g %s %s %s %s\n',datevec(t0-dt0(n)),datevec(t1),c{1}{1},c{1}{2},c{1}{4},c{1}{3});
712+
fprintf(fid,'%d,%d,%d,%d,%d,%1.0f %d,%d,%d,%d,%d,%1.0f %s %s %s %s\n',datevec(t0-dt0(n)),datevec(t1),c{1}{1},c{1}{2},c{1}{4},c{1}{3});
713713
end
714714
fclose(fid);
715715
% makes ArcLink request and save to temporary miniseed file
@@ -732,6 +732,7 @@ function sefran3(name,fdate)
732732
% builds request line for dataselect WebService POST file
733733
fprintf(fid,'%s %s %s %s %04d-%02d-%02dT%02d:%02d:%02.0f %04d-%02d-%02dT%02d:%02d:%02.0f\n',c{1}{1},c{1}{2},c{1}{3},c{1}{4},datevec(t0-dt0(n)),datevec(t1));
734734
end
735+
fclose(fid);
735736
% request the data
736737
wosystem(sprintf('wget -nv -O %s --post-file %s "%s"',fmsd,fpost,datasource),SEFRAN3);
737738

CODE/matlab/wosystem.m

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
function varargout = wosystem(cmd,varargin)
22
%WOSYSTEM Execute system command and return result.
3-
% [status,result] = WOSYSTEM('command') works exactly like SYSTEM()
3+
% [status,result] = WOSYSTEM('command') works exactly like SYSTEM()
44
% function excepted it displays the result string in case of command
55
% error, i.e., non-null exit status (return code).
66
%
7-
% WOSYSTEM('command') without output argument, or
8-
% [status,result] = WOSYSTEM('command','error') both will produce a
7+
% WOSYSTEM('command') without output argument, or
8+
% [status,result] = WOSYSTEM('command','error') both will produce a
99
% Matlab error if the command is unsuccessful.
1010
%
1111
% WOSYSTEM('command','warning') without output argument forces the
@@ -25,7 +25,7 @@
2525
%
2626
% Author: F. Beauducel, WEBOBS
2727
% Created: 2017-02-02 in Yogyakarta, Indonesia
28-
% Updated: 2017-09-11
28+
% Updated: 2022-07-22
2929

3030
if nargin < 1
3131
error('Not enough input argument.');
@@ -44,12 +44,12 @@
4444
[s,w] = system(cmd);
4545

4646
if s || any(strcmpi(varargin,'debug')) || (nargin > 1 && (isok(varargin{1},'DEBUG')))
47-
display(regexprep(msg,'\','\\'));
47+
display(regexprep(msg,'\\','\\\'));
4848
end
4949

5050
% if unsuccessful, displays the result
5151
if s
52-
% ERROR mode: will stop with error if command unsuccessful
52+
% ERROR mode: will stop with error if command unsuccessful
5353
if (nargout == 0 || any(strcmpi(varargin,'error'))) && ~any(strcmpi(varargin,'warning'))
5454
error('%s command unsuccessful [rc = %d]: %s',wofun,s,w);
5555
else

0 commit comments

Comments
 (0)