Commit 71c752be authored by Daniel Armbruster's avatar Daniel Armbruster Committed by thomas.forbriger
Browse files

bug fixing and addaption of docu to new data formats

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/branches/any2matlab0.4
SVN Revision: 3898
SVN UUID:     67feda4a-a26e-11df-9d6e-31afc202ad0c
parent 475c9f76
/*!\file any2matlab.cc
* \brief This es a MEX-file using Thomas Forbriger's datrwxx library importing seismic dataformats
* to MATLAB.
* \brief This es a MEX-file using Thomas Forbriger's datrwxx library importing
* seismic dataformats to MATLAB.
*
* Currently supported formats are:
* \li mseed: MiniSEED (SeisComP, EDL, etc.)
......@@ -10,10 +10,14 @@
* \li gse: raw GSE format
* \li hpmo: HP-MO data format defined by W. Grossmann (BFO)
* \li bonjer: K2 ASCII data format (defined by K. Bonjer?)
* \li tsoft: TSOFT format (\link http://seismologie.oma.be/TSOFT/tsoft.html
* \endlink)
* \li tfascii: output data of T. Forbriger's any2ascii
* \li su: Seismic Unix format
*
*
* \author Daniel Armbruster
* \version V1.1
* \version V1.2
* \date 01/07/2010
*
* ----
......@@ -33,8 +37,10 @@
* ----
*
* REVISIONS and CHANGES
* - 01/07/2010 V1.0 Daniel Armbruster
* - 30/09/2010 V1.1 introduced option 'int'
* - 01/07/2010 V1.0 Daniel Armbruster
* - 30/09/2010 V1.1 introduced option 'int'
* - 30/04/2011 V1.2 bug fixing and addaption of documentation to the new
* package mechanism
*
* \section general General
*
......@@ -86,6 +92,9 @@
* -# \c mseed
* -# \c sac
* -# \c gse
* -# \c tfascii
* -# \c tsoft
* -# \c su
* - \p tfstruct is a MATLAB struct with the following fields:
* -# \c date: date of first sample. format: \c 'YYYY/MM/DD'
* -# \c time: time of the first sample. format: \c 'hh:mm:ss.milsec'
......@@ -146,7 +155,6 @@ void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
int instype_field, trace_field;
std::vector<int> ntraces;
ntraces.reserve(100);
std::string dtype;
// calculate number of fields
number_of_fields = sizeof(field_names) / sizeof(*field_names);
......@@ -175,9 +183,6 @@ void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
}
}
int trace = 0;
bool hot;
std::string infile;
std::string filetype;
......@@ -201,12 +206,17 @@ void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
if (nrhs == 2) {
infile = std::string(mxArrayToString(prhs[0]));
filetype = std::string(mxArrayToString(prhs[1]));
infile += "."+filetype;
}
// set format to default value: double
std::string dtype("double");
// check: 3 arguments
if (nrhs == 3) {
infile = std::string(mxArrayToString(prhs[0]));
filetype = std::string(mxArrayToString(prhs[1]));
infile += "."+filetype;
std::string arg2(mxArrayToString(prhs[2]));
// check: third argument
......@@ -218,16 +228,11 @@ void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
}
}
// set format to default value: double
// if only 2 arguments given
if(nrhs > 0 && nrhs < 3) {
dtype = "double";
}
// set filetype to lower case
transform(filetype.begin(), filetype.end(), filetype.begin(), tolower);
datrw::Eformat format = datrw::anyID(filetype);
int trace = 0;
bool hot = false;
{
std::ifstream ifs(infile.c_str());
......
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