818 "usage: sigscale [-v] [-o] [-itype type] [-otype type]" "\n" 819 " outfile infile [t:T] [f:F] [infile [t:T] [f:F] ... ]" "\n" 820 " or: sigscale --help|-h" "\n" 821 " or: sigscale --xhelp" "\n" 827 "outfile name of output file" "\n" 828 "infile name of input file" "\n" 829 " t:T select traces T, where T may be any range" "\n" 830 " specification like \'3-4\' or \'5,6,7-12,20\'" "\n" 831 " f:F specifies an input file format differing from" "\n" 832 " the format selected by \"-type\"" "\n" 834 "-xhelp print detailed information regarding file formats" "\n" 836 "-DEBUG produce debug output" "\n" 837 "-DEBREP report internal scaling values for debugging" "\n" 838 "-o overwrite output" "\n" 839 "-itype type choose input file format (default: sff)" "\n" 840 "-otype type choose output file format (default: sff)" "\n" 842 "This program is designed for auxilliary data from superconduction\n" 843 "gravimeter SG056 at BFO. It uses scling relations provided by GWR\n" 844 "to convert sample values to meaningful physical units." 848 using namespace tfxx::cmdline;
849 static Declare options[]=
858 {
"itype",arg_yes,
"sff"},
860 {
"otype",arg_yes,
"sff"},
862 {
"DEBUG",arg_no,
"-"},
864 {
"xhelp",arg_no,
"-"},
866 {
"DEBREP",arg_no,
"-"},
881 cerr << usage_text << endl;
882 cerr << tfxx::seitosh::repository_reference << endl;
887 Commandline cmdline(iargc, argv, options);
890 if (cmdline.optset(0))
892 cerr << usage_text << endl;
893 cerr << help_text << endl;
894 datrw::supported_data_types(cerr);
895 cerr << endl << tfxx::seitosh::repository_reference << endl;
900 if (cmdline.optset(6))
902 cerr << usage_text << endl;
904 datrw::online_help(cerr);
905 cerr << endl << tfxx::seitosh::repository_reference << endl;
914 opt.
debug=cmdline.optset(5);
916 opt.
debrep=cmdline.optset(7);
936 TFXX_assert(cmdline.extra(),
"missing output file");
937 std::string outfile=cmdline.next();
938 TFXX_assert(cmdline.extra(),
"missing input file");
939 tfxx::cmdline::Tparsed arguments=parse_cmdline(cmdline,
cmdlinekeys);
940 if ((arguments.size()>1) && opt.
verbose)
942 cout <<
"NOTICE: file specific information (SRCE line and file FREE)" <<
944 <<
" will be taken from first file only!" << endl;
952 if (opt.
verbose) { cout <<
"open output file " << outfile << endl; }
956 std::ifstream file(outfile.c_str(),std::ios_base::in);
957 TFXX_assert((!file.good()),
"ERROR: output file exists!");
959 std::ios_base::openmode oopenmode
961 std::ofstream ofs(outfile.c_str(), oopenmode);
968 tfxx::cmdline::Tparsed::const_iterator infile=arguments.begin();
969 while (infile != arguments.end())
972 if (opt.
verbose) { cout <<
"open input file " << infile->name << endl; }
978 std::ios_base::openmode iopenmode
979 =datrw::ianystream::openmode(inputformat);
980 std::ifstream ifs(infile->name.c_str(), iopenmode);
981 datrw::ianystream is(ifs, inputformat);
990 sff::FREE infilefree;
992 filefree.append(
"block read from first input file:");
993 filefree.append(infilefree);
995 if (os.handlesfilefree()) { os << filefree; }
998 sff::SRCE insrceline;
1000 if (os.handlessrce()) { os << insrceline; }
1007 typedef tfxx::RangeList<int> Trangelist;
1008 bool doselect=infile->haskey(
tracekey);
1009 Trangelist traceranges=
1010 tfxx::string::rangelist<Trangelist::Tvalue>(infile->value(
tracekey));
1015 if ((!doselect) || traceranges.contains(itrace))
1017 TFXX_debug(opt.
debug,
"main",
"process trace #" << itrace );
1019 { std::cout <<
" process trace #" << itrace <<
":"; }
1025 TFXX_debug(opt.
debug,
"main",
1026 " series and WID2 are read");
1035 ChannelDescription CD;
1037 sid.station=wid2.station;
1038 sid.channel=wid2.channel;
1039 sid.instrument=wid2.instype;
1040 sid.auxid=wid2.auxid;
1045 aff::Iterator<Tseries> I(series);
1056 TFXX_debug(opt.
debug,
"main",
1057 " series and WID are written");
1060 if (os.handlesinfo()) { os << info; }
1062 if (is.hasfree() ||
true)
1064 sff::FREE tracefree;
1067 tracefree.append(
"read from file " + infile->name);
1068 tracefree.append(
"applied scaling for conversion code \"" 1070 if (os.handlestracefree()) { os << tracefree; }
1072 TFXX_debug(opt.
debug,
"main",
1073 "trace #" << itrace <<
" successfully processed");
1078 TFXX_debug(opt.
debug,
"main",
"skip trace #" << itrace );
1080 { std::cout <<
" skip trace #" << itrace << std::endl; }
static const char * cmdlinekeys[]
static const char formatkey[]
double convert_to_display_units(const Econversion &ConvCode, const double &chanval)
std::string conversion_code(const Econversion &ConvCode)
void report_sidiode_table(int range)
const char *const tracekey
key to select traces
aff::Series< double > Tseries