Commit 152ef8fb authored by thomas.forbriger's avatar thomas.forbriger Committed by thomas.forbriger
Browse files

moved file FREE block assembling such that this code appears only once

This is a legacy commit from before 2015-03-01.
It may be incomplete as well as inconsistent.
See COPYING.legacy and README.history for details.
started with additional comments


SVN Path:     http://gpitrsvn.gpi.uni-karlsruhe.de/repos/TFSoftware/trunk
SVN Revision: 4675
SVN UUID:     67feda4a-a26e-11df-9d6e-31afc202ad0c
parent ae46a8ec
......@@ -1422,12 +1422,67 @@ int main(int iargc, char* argv[])
/* stage 4
*
* distinguishes between data extraction mode (default) and gap finding
*
* First a file FREE block is set up reporting the parameters of data
* selection. This block is also used to report to the user (not only to the
* output data file).
*
* The code for stage is then divided into two large section by the very
* first conditional. If doGAPanalysis is true several tasks for analyzing
* the completeness of the input data as represented by the index entries
* can be executed. The program finished then immediately without extracting
* data. If not, data samples are actually extracted.
*/
// prepare file free block and write
sff::FREE filefree;
filefree.append(ANYEXTRACT_VERSION);
filefree.append(ANYEXTRACT_CVSID);
filefree.append("selection:");
if (opt.firstset)
{
filefree.append(std::string("* first sample: ")+opt.first.timestring());
}
else
{
filefree.append(std::string("* first sample: any"));
}
if (opt.lastset)
{
filefree.append(std::string("* last sample: ")+opt.last.timestring());
}
else
{
filefree.append(std::string("* last sample: any"));
}
filefree.append(std::string("* station: ")+opt.selstation);
filefree.append(std::string("* channel: ")+opt.selchannel);
filefree.append(std::string("* instrument: ")+opt.selinstrument);
filefree.append(std::string("* auxid: ")+opt.selauxid);
if (opt.allowduplicatesamples)
filefree.append("* duplicate input samples are tolerated");
if (opt.breakonduplicatesamples)
filefree.append("* duplicate input samples are a break condition");
if (opt.allowtolerance)
{
std::ostringstream oss;
oss << "* sampling raster tolerance is "
<< opt.relativetolerance
<< " of sampling interval";
filefree.append(oss.str());
}
/* Conditional
*
* distinguish between gap analysis and data extraction
*/
if (doGAPanalysis)
{
/*======================================================================*/
/* 4. report contiguous data blocks
/* 4. gap analysis
*
* This block contains several tasks to analyse the completeness of the
* data as being represented by the index entries previously read.
*/
if (opt.verbose || opt.findgapsonly)
{
......@@ -1435,35 +1490,12 @@ int main(int iargc, char* argv[])
cout << "step 4: report contiguous data" << endl;
}
// prepare file free block and write
sff::FREE filefree;
filefree.append(ANYEXTRACT_VERSION);
filefree.append(ANYEXTRACT_CVSID);
filefree.append("selection:");
if (opt.firstset)
{
filefree.append(std::string("* first sample: ")+opt.first.timestring());
}
else
{
filefree.append(std::string("* first sample: any"));
}
if (opt.lastset)
{
filefree.append(std::string("* last sample: ")+opt.last.timestring());
}
else
// report selection in verbose mode
// --------------------------------
if (opt.verbose)
{
filefree.append(std::string("* last sample: any"));
}
filefree.append(std::string("* station: ")+opt.selstation);
filefree.append(std::string("* channel: ")+opt.selchannel);
filefree.append(std::string("* instrument: ")+opt.selinstrument);
filefree.append(std::string("* auxid: ")+opt.selauxid);
filefree.append("index file(s):");
infile=infiles.begin();
while( infile!=infiles.end()) { filefree.append(*infile); ++infile; }
if (opt.verbose) cout << filefree;
cout << filefree;
} // if (opt.verbose)
// prepare collection of statistics
libtime::TAbsoluteTime earliesttime=opt.first;
......@@ -1706,43 +1738,6 @@ int main(int iargc, char* argv[])
datrw::oanystream::openmode(opt.outputformat));
datrw::oanystream os(ofs, opt.outputformat, opt.debug);
// prepare file free block and write
sff::FREE filefree;
filefree.append(ANYEXTRACT_VERSION);
filefree.append(ANYEXTRACT_CVSID);
filefree.append("selection:");
if (opt.firstset)
{
filefree.append(std::string("* first sample: ")+opt.first.timestring());
}
else
{
filefree.append(std::string("* first sample: any"));
}
if (opt.lastset)
{
filefree.append(std::string("* last sample: ")+opt.last.timestring());
}
else
{
filefree.append(std::string("* last sample: any"));
}
filefree.append(std::string("* station: ")+opt.selstation);
filefree.append(std::string("* channel: ")+opt.selchannel);
filefree.append(std::string("* instrument: ")+opt.selinstrument);
filefree.append(std::string("* auxid: ")+opt.selauxid);
if (opt.allowduplicatesamples)
filefree.append("* duplicate input samples are tolerated");
if (opt.breakonduplicatesamples)
filefree.append("* duplicate input samples are a break condition");
if (opt.allowtolerance)
{
std::ostringstream oss;
oss << "* sampling raster tolerance is "
<< opt.relativetolerance
<< " of sampling interval";
filefree.append(oss.str());
}
filefree.append("index file(s):");
infile=infiles.begin();
while( infile!=infiles.end()) { filefree.append(*infile); ++infile; }
......@@ -1898,7 +1893,7 @@ int main(int iargc, char* argv[])
os << tracedata.ds();
}
}
}
} // if not (doGAPanalysis)
}
/* ----- END OF anyextract.cc ----- */
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment