Commit 3592a908 authored by thomas.forbriger's avatar thomas.forbriger Committed by thomas.forbriger
Browse files

new shell script

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: 2181
SVN UUID:     67feda4a-a26e-11df-9d6e-31afc202ad0c
parent 304e347b
# this is <Makefile>
# ----------------------------------------------------------------------------
# $Id: Makefile,v 1.3 2006-11-20 10:05:59 tforb Exp $
# $Id: Makefile,v 1.4 2006-11-20 10:40:42 tforb Exp $
#
# Copyright (c) 2006 by Thomas Forbriger (BFO Schiltach)
#
......@@ -14,7 +14,7 @@
all:
flist: Makefile $(wildcard *.cc)
flist: Makefile $(wildcard *.cc *.sh)
echo $^ | tr ' ' '\n' | sort > $@
.PHONY: edit
......
#!/bin/sh
# this is <extractmgmtar.sh>
# ----------------------------------------------------------------------------
# $Id: extractmgmtar.sh,v 1.1 2006-11-20 10:40:42 tforb Exp $
#
# Copyright (c) 2006 by Thomas Forbriger (BFO Schiltach)
#
# extract tar file from MGM to local directory
#
# REVISIONS and CHANGES
# 20/11/2006 V1.0 Thomas Forbriger
#
# ============================================================================
#
while test -n $1
do
day=$(basename $1 .tar.bz2)
echo "extract archive " $1 " for day " $day
tar xvfpsj $1
mgm2sff -v -t -o geo $day.sff
shift
done
# ----- END OF extractmgmtar.sh -----
......@@ -3,7 +3,7 @@
*
* ----------------------------------------------------------------------------
*
* $Id: mgm2sff.cc,v 1.4 2006-11-20 10:06:00 tforb Exp $
* $Id: mgm2sff.cc,v 1.5 2006-11-20 10:40:42 tforb Exp $
* \author Thomas Forbriger
* \date 13/11/2006
*
......@@ -115,7 +115,7 @@
#define MGM2SFF_VERSION \
"MGM2SFF V1.0 Convert Monschau data to SFF"
#define MGM2SFF_CVSID \
"$Id: mgm2sff.cc,v 1.4 2006-11-20 10:06:00 tforb Exp $"
"$Id: mgm2sff.cc,v 1.5 2006-11-20 10:40:42 tforb Exp $"
#include <iostream>
#include <fstream>
......@@ -185,7 +185,7 @@ class GeoDatFile {
* =======
*/
struct Options {
bool verbose, readinf, readdat, overwrite, debug;
bool verbose, readinf, readdat, overwrite, debug, usetruenumber;
std::string inffile, datfile;
};
......@@ -293,7 +293,7 @@ Tvalue ByteBlock::v(const int& i) const
break;
default: TFXX_abort("ByteBlock: illegal index!");
}
Tvalue v=float((w << 2)-8192)/8192;
Tvalue v=float((w >> 4)-2048)/2048;
return(v);
} // Tvalue ByteBlock::v(const int& i)
......@@ -314,7 +314,7 @@ int main(int iargc, char* argv[])
char usage_text[]=
{
MGM2SFF_VERSION "\n"
"usage: mgm2sff [-v] [-o] [-inf file] [-dat file] inbase outfile" "\n"
"usage: mgm2sff [-v] [-o] [-t] [-inf file] [-dat file] inbase outfile" "\n"
" or: mgm2sff --help|-h" "\n"
};
......@@ -324,6 +324,8 @@ int main(int iargc, char* argv[])
MGM2SFF_CVSID "\n"
"-v be verbose" "\n"
"-o overwrite existing output file" "\n"
"-t use true number of samples, if expected number" "\n"
" differs from the number of samples read from file" "\n"
"-inf file read inf file and dump" "\n"
"-dat file read dat file and dump" "\n"
"inbase basename for input data" "\n"
......@@ -347,6 +349,8 @@ int main(int iargc, char* argv[])
{"o",arg_no,"-"},
// 5: debug mode
{"D",arg_no,"-"},
// 6: use true number of samples
{"t",arg_no,"-"},
{NULL}
};
......@@ -376,6 +380,7 @@ int main(int iargc, char* argv[])
opt.datfile=cmdline.string_arg(3);
opt.overwrite=cmdline.optset(4);
opt.debug=cmdline.optset(5);
opt.usetruenumber=cmdline.optset(6);
TFXX_assert(cmdline.extra(), "ERROR: missing input basename");
std::string inbase=cmdline.next();
......@@ -487,6 +492,17 @@ int main(int iargc, char* argv[])
<< " seconds."
<< endl;
}
if (opt.usetruenumber)
{
if (gdf.series(1).size() != expectedsamples)
{
cout << "NOTICE: number of samples for channel 1"
<< " differs from expected number" << endl;
cout << " using number of samples in channel 1"
<< " as expected number of samples" << endl;
expectedsamples = gdf.series(1).size();
}
}
TFXX_assert(gdf.series(1).size() == expectedsamples,
"channel 1 size does not meet expectation");
TFXX_assert(gdf.series(2).size() == expectedsamples,
......
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