Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Seitosh
Seitosh
Commits
6ee035e4
Commit
6ee035e4
authored
Jan 01, 2019
by
thomas.forbriger
Browse files
croposp [WF]: add debug option and reporting of collection after trimming
parent
aa464c4f
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/ts/wf/croposp.cc
View file @
6ee035e4
...
...
@@ -29,11 +29,34 @@ using std::cerr;
using
std
::
endl
;
struct
Options
{
bool
verbose
,
trim
;
bool
verbose
,
trim
,
debug
;
std
::
string
inputformat
;
double
datetolerance
;
};
// struct Options
typedef
ts
::
TimeSeriesCollection
<
double
>
TCollection
;
/* ====================================================================== */
void
report_collection
(
const
TCollection
&
collection
)
{
TCollection
::
const_iterator
i_series
=
collection
.
begin
();
while
(
i_series
!=
collection
.
end
())
{
cout
<<
" "
<<
i_series
->
header
.
station
<<
" "
<<
i_series
->
header
.
channel
<<
" "
<<
i_series
->
header
.
auxid
<<
" "
<<
"dt="
<<
i_series
->
header
.
dt
<<
"s "
<<
"begin: "
<<
i_series
->
header
.
date
.
timestring
()
<<
" "
<<
"n: "
<<
i_series
->
header
.
nsamples
<<
endl
;
++
i_series
;
}
}
// void report_collection(const Tcollection& collection)
/* ====================================================================== */
int
main
(
int
iargc
,
char
*
argv
[])
{
...
...
@@ -49,6 +72,7 @@ int main(int iargc, char* argv[])
char
help_text
[]
=
{
"-verbose be verbose
\n
"
"-DEBUG produce debugging output
\n
"
"-itype f set default input file format (this value can
\n
"
" be overwritten by the format key at a file name)
\n
"
"-trim trim time series to identical begin and length
\n
"
...
...
@@ -74,6 +98,8 @@ int main(int iargc, char* argv[])
{
"trim"
,
arg_no
,
"-"
},
// 4: default input file format
{
"datetolerance"
,
arg_yes
,
"0."
},
// 5: debug mode
{
"DEBUG"
,
arg_no
,
"-"
},
{
NULL
}
};
...
...
@@ -107,6 +133,7 @@ int main(int iargc, char* argv[])
opt
.
inputformat
=
cmdline
.
string_arg
(
2
);
opt
.
trim
=
cmdline
.
optset
(
3
);
opt
.
datetolerance
=
cmdline
.
double_arg
(
4
);
opt
.
debug
=
cmdline
.
optset
(
5
);
TFXX_assert
(((
opt
.
datetolerance
>=
0.
)
&&
(
opt
.
datetolerance
<=
1.
)),
"datetolerance is out of accepted range"
);
...
...
@@ -135,7 +162,6 @@ int main(int iargc, char* argv[])
}
// collect traces
typedef
ts
::
TimeSeriesCollection
<
double
>
TCollection
;
TCollection
collection_of_series
;
typedef
ts
::
sff
::
DFile
::
Tfile
Tfile
;
typedef
Tfile
::
Ttracevector
Ttracevector
;
...
...
@@ -155,19 +181,7 @@ int main(int iargc, char* argv[])
if
(
opt
.
verbose
)
{
cout
<<
"Time series to be analyzed:"
<<
endl
;
TCollection
::
const_iterator
i_series
=
collection_of_series
.
begin
();
while
(
i_series
!=
collection_of_series
.
end
())
{
cout
<<
" "
<<
i_series
->
header
.
station
<<
" "
<<
i_series
->
header
.
channel
<<
" "
<<
i_series
->
header
.
auxid
<<
" "
<<
"dt="
<<
i_series
->
header
.
dt
<<
"s "
<<
"begin: "
<<
i_series
->
header
.
date
.
timestring
()
<<
" "
<<
"n: "
<<
i_series
->
header
.
nsamples
<<
endl
;
++
i_series
;
}
report_collection
(
collection_of_series
);
}
// trim time series
...
...
@@ -177,6 +191,13 @@ int main(int iargc, char* argv[])
"time series do not overlap"
);
collection_of_series
.
trim_to_date
();
collection_of_series
.
trim_to_nsamples
();
// report traces
if
(
opt
.
verbose
)
{
cout
<<
"Time series after trimming:"
<<
endl
;
report_collection
(
collection_of_series
);
}
}
// check consistency
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment