Commit 10255cd9 authored by thomas.forbriger's avatar thomas.forbriger Committed by thomas.forbriger
Browse files

new WIDX functions

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.


SVN Path:     http://gpitrsvn.gpi.uni-karlsruhe.de/repos/TFSoftware/trunk
SVN Revision: 3033
SVN UUID:     67feda4a-a26e-11df-9d6e-31afc202ad0c
parent 23714018
# this is <Makefile>
# ----------------------------------------------------------------------------
# $Id: Makefile,v 1.21 2007-12-13 10:11:15 tforb Exp $
# $Id: Makefile,v 1.22 2010-04-13 16:14:20 tforb Exp $
#
# Copyright (c) 2003 by Thomas Forbriger (BFO Schiltach)
#
......@@ -27,6 +27,7 @@
# REVISIONS and CHANGES
# 18/12/2003 V1.0 Thomas Forbriger
# 28/03/2006 V1.1 provide a package
# 13/04/2010 V1.2 start implementing WIDX
#
# ============================================================================
#
......@@ -69,7 +70,8 @@ clean: ;
# ------------
LIBSRC=sffxx.cc wid2compare.cc wid2inrange.cc wid2isample.cc \
wid2lastsample.cc sffostream.cc srcesynref.cc offset.cc sffverbose.cc
wid2lastsample.cc sffostream.cc srcesynref.cc offset.cc sffverbose.cc \
widXio.cc
INCSRC=sffxx.h sffostream.h
-include $(patsubst %.cc,%.d,$(LIBSRC))
......
......@@ -3,7 +3,7 @@
*
* ----------------------------------------------------------------------------
*
* $Id: README,v 1.4 2007-09-29 17:45:01 tforb Exp $
* $Id: README,v 1.5 2010-04-13 16:14:20 tforb Exp $
* \author Thomas Forbriger
* \date 25/12/2003
*
......@@ -118,6 +118,9 @@ synthetic (non-integer) data.
The \ref page_sff_definition from file \c sff.doc in package \c libsff is
provided on a separate page: \ref page_sff_definition
The functions sff::WIDXline provide an extended WID format which breaks the
SFF format standard.
<HR>
\section sec_main_structure Structure of the library modules
......
......@@ -3,7 +3,7 @@
*
* ----------------------------------------------------------------------------
*
* $Id: sfftest.cc,v 1.9 2007-06-26 17:02:29 tforb Exp $
* $Id: sfftest.cc,v 1.10 2010-04-13 16:14:20 tforb Exp $
* \author Thomas Forbriger
* \date 21/12/2003
*
......@@ -29,13 +29,14 @@
*
* REVISIONS and CHANGES
* - 21/12/2003 V1.0 Thomas Forbriger
* - 13/04/2010 V1.1 start implementing WIDX
*
* ============================================================================
*/
#define SFFTEST_VERSION \
"SFFTEST V1.0 test library modules"
#define SFFTEST_CVSID \
"$Id: sfftest.cc,v 1.9 2007-06-26 17:02:29 tforb Exp $"
"$Id: sfftest.cc,v 1.10 2010-04-13 16:14:20 tforb Exp $"
#include <fstream>
#include <iostream>
......@@ -46,6 +47,32 @@ using std::cout;
using std::cerr;
using std::endl;
/*----------------------------------------------------------------------*/
void test_extended_functions()
{
cout << "test WIDX functions" << endl
<< "-------------------" << endl;
sff::WID2 mywid2;
sff::verbose(cout, mywid2);
mywid2.station="BFO";
mywid2.channel="UGZ";
mywid2.instype="ET-19";
mywid2.nsamples=2048;
mywid2.dt=10.;
sff::verbose(cout, mywid2);
std::string Xline=sff::WIDXline(mywid2);
cout << Xline << std::endl;
sff::WID2 readwid2=sff::WIDXline(Xline);
sff::verbose(cout, readwid2);
} // test_extended_functions()
/*----------------------------------------------------------------------*/
void test_line_functions()
{
cout << "test line functions" << endl
......@@ -376,7 +403,7 @@ void test_skip_trace()
/*----------------------------------------------------------------------*/
struct Options {
bool debug, verbose;
bool debug, verbose, extended;
}; // struct Options
int main(int iargc, char* argv[])
......@@ -385,7 +412,7 @@ int main(int iargc, char* argv[])
// define usage information
char usage_text[]=
{
"usage: sfftest [-D] [-v]" "\n"
"usage: sfftest [-D] [-v] [-x]" "\n"
" or: sfftest --help|-h" "\n"
};
......@@ -396,6 +423,7 @@ int main(int iargc, char* argv[])
"notice: you have to pass at least one dummy argument to make" "\n"
"the program run" "\n"
"-v test verbose output" "\n"
"-x test extended WIDX format" "\n"
};
// define commandline options
......@@ -406,8 +434,10 @@ int main(int iargc, char* argv[])
{"help",arg_no,"-"},
// 1: debug mode
{"D",arg_no,"-"},
// 2: debug mode
// 2: test verbose functions
{"v",arg_no,"-"},
// 3: debug mode
{"x",arg_no,"-"},
{NULL}
};
......@@ -432,11 +462,16 @@ int main(int iargc, char* argv[])
Options opt;
opt.debug=cmdline.optset(1);
opt.verbose=cmdline.optset(2);
opt.extended=cmdline.optset(3);
if (opt.verbose)
{
test_verbose_functions(); cout << endl;
}
else if (opt.extended)
{
test_extended_functions(); cout << endl;
}
else
{
test_line_functions(); cout << endl;
......
......@@ -3,7 +3,7 @@
*
* ----------------------------------------------------------------------------
*
* $Id: sffxx.h,v 1.34 2007-06-26 17:02:29 tforb Exp $
* $Id: sffxx.h,v 1.35 2010-04-13 16:14:20 tforb Exp $
* \author Thomas Forbriger
* \date 21/12/2003
*
......@@ -40,6 +40,7 @@
* - 27/06/2006 V1.5 added INFO comparison
* - 02/03/2007 V1.6 added offset calculation
* - 26/06/2007 V1.7 added verbose output
* - 13/04/2010 V1.8 start implementing WIDX
*
* ============================================================================
*/
......@@ -48,9 +49,9 @@
#ifndef TF_SFFXX_H_VERSION
#define TF_SFFXX_H_VERSION \
"TF_SFFXX_H V1.7"
"TF_SFFXX_H V1.8"
#define TF_SFFXX_H_CVSID \
"$Id: sffxx.h,v 1.34 2007-06-26 17:02:29 tforb Exp $"
"$Id: sffxx.h,v 1.35 2010-04-13 16:14:20 tforb Exp $"
#include<string>
#include<cmath>
......@@ -96,6 +97,20 @@ namespace sff {
NM_ifneeded //!< scale if largest amplitude larger than limit
}; // enum Enormmode
/*======================================================================*/
// constants
// ---------
/*! \brief ID for extended WID2 format.
*
* This WID format is an extension with respect to SFF and breaks the SFF
* format definition.
*
* \sa WIDXline(std::istream& is)
* \sa WIDXline(const sff::WID2& wid2)
*/
const char *const WIDX = "WIDX";
/*======================================================================*/
// SFF structs
// -----------
......@@ -541,6 +556,13 @@ namespace sff {
//! return offset in degrees
double offsetdeg(const SRCE& srce, const INFO& info,
const double& radius=6371.);
//! write WID2 information in extended format
std::string WIDXline(const sff::WID2& wid2);
//! read WID2 information with extended format
sff::WID2 WIDXline(const std::string& line);
/*======================================================================*/
// verbose output
// --------------
......
/*! \file widXio.cc
* \brief provide WID2 reading/writing with extended format (implementation)
*
* ----------------------------------------------------------------------------
*
* $Id: widXio.cc,v 1.1 2010-04-13 16:14:20 tforb Exp $
* \author Thomas Forbriger
* \date 13/04/2010
*
* provide WID2 reading/writing with extended format (implementation)
*
* Copyright (c) 2010 by Thomas Forbriger (BFO Schiltach)
*
* ----
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
* ----
*
* REVISIONS and CHANGES
* - 13/04/2010 V1.0 Thomas Forbriger
*
* ============================================================================
*/
#define TF_WIDXIO_CC_VERSION \
"TF_WIDXIO_CC V1.0"
#define TF_WIDXIO_CC_CVSID \
"$Id: widXio.cc,v 1.1 2010-04-13 16:14:20 tforb Exp $"
#include <sffxx.h>
namespace sff {
/*! \brief write WID information in extended format.
*
* This function breaks the SFF format definition.
* It writes the WID2 class data to a line with identifier WIDX rather than
* WID2. The function is implemented within this library to provide
* transparent reading of WID-data. Writing will be used outside of the
* library only.
*
* Reasons to implement this function are:
* -# The GSE WID2 format does not use microseconds for the time of the
* first sample. The information present in sff::WID2 however is precise
* to the level of microseconds and is also used in this way when
* processing e.g. MiniSEED data. It is thus desirable to read and write
* this information with the full available content.
* -# The GSE WID2 format restricts the sampling to be defined in terms of a
* sampling rate. This is inappropriate to extremely long period data
* with e.g. 1 Minute sampling interval (i.e. 60s). Round-off errors will
* lead to time residuals in these cases of more than a second within one
* day.
*
* \sa WIDXline(const std::string& line)
*/
std::string WIDXline(const sff::WID2& wid2)
{
std::string retval;
return(retval);
} // std::string WIDXline(const sff::WID2& wid2)
/*----------------------------------------------------------------------*/
/*! \brief read WID information from extended format.
*
* \sa WIDXline(const sff::WID2& wid2)
*/
sff::WID2 WIDXline(const std::string& line)
{
sff::WID2 retval;
return(retval);
} // sff::WID2 WIDXline(const std::string& line)
} // namespace sff
/* ----- END OF widXio.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