Commit 35cbe0b3 authored by thomas.forbriger's avatar thomas.forbriger Committed by thomas.forbriger
Browse files

this directory hosts (m)any type tools only

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: 4552
SVN UUID:     67feda4a-a26e-11df-9d6e-31afc202ad0c
parent 95f5eaad
......@@ -4,7 +4,7 @@
#
# Copyright (c) 2003 by Thomas Forbriger (BFO Schiltach)
#
# convert from SFF and convert GSE to SFF
# convert from and to various seismic formats
#
# ----
# This program is free software; you can redistribute it and/or modify
......@@ -24,14 +24,9 @@
#
# The targets in this package require some libraries.
#
# Fortran Code:
# gse2sff listsff sff2ascii
# require: libtf.a libsff.a libsffu.a libts.a libtime.a
#
# C++ code:
# sffextract
# require: libsffxx.a libtime++.a libgsexx.a libaff.a libtfxx.a
# anyextract any2sff anyindex
# require: libsffxx.a libtime++.a libgsexx.a libaff.a libtfxx.a
# additionally require: libdatrwxx.a
# anyextract
# additionally requires: libregexx.a
......@@ -51,11 +46,11 @@
# - libboost_regex is hardwired now
# 19/03/2011 V1.5 added libseife to snapshot package and reordered
# libraries in package
# 13/02/2012 V1.6 any-type-tools now live in subdirectory many
#
# ============================================================================
#
PROGRAMS=any2sff anyindex anyextract any2ascii gse2sff listsff \
sffextract sff2ascii sff2refra sff2seife codeco any2any
PROGRAMS=any2sff anyindex anyextract any2ascii any2any
.PHONY: all
all: install doc
......@@ -72,7 +67,7 @@ doc: doxydoc
.PHONY: allstatic
allstatic:
$(MAKE) install \
PROGRAMS="any2sffstat anyindexstat anyextractstat any2asciistat"
PROGRAMS="any2anystat anyindexstat anyextractstat any2asciistat"
flist: README Makefile $(wildcard *.f *.cc) doxydoc.cfg \
$(wildcard sub/*.cc sub/*.h)
......@@ -133,17 +128,6 @@ include $(patsubst %.cc,%.d,$(SRCFILES))
%.o: %.f
$(FC) $(FFLAGS) -c $< -o $@
codeco: codecoLinux.o
$(FC) $(FFLAGS) $< -o $@
gse2sff listsff sff2ascii sff2refra sff2seife: %: %.o
$(FC) -o $@ $< $(FFLAGS) -ltf -lts -lsffu -lsff -ltime -lm -lc \
-L${LOCLIBDIR} $(LDFLAGS)
sffextract: %: %.o
$(CXX) -o $@ $^ -I$(LOCINCLUDEDIR) -lsffxx -ltime++ -lgsexx -laff \
-ltfxx -L$(LOCLIBDIR) $(CXXFLAGS) $(FLAGS) $(LDFLAGS)
GAPANALYSISOBS=sub/completenessbins.o \
sub/fncompleteness.o \
sub/fngaps.o \
......@@ -151,6 +135,7 @@ GAPANALYSISOBS=sub/completenessbins.o \
sub/fnseriesofmissingsamples.o \
sub/structgapanalysis.o \
sub/structgapseries.o
anyextract: %: %.o $(GAPANALYSISOBS)
$(CXX) -o $@ $^ -I$(LOCINCLUDEDIR) -ldatrwxx \
-lsffxx -ltime++ -lgsexx -laff -ltfxx -lboost_regex \
......@@ -164,6 +149,10 @@ any2any: %: %.o
$(CXX) -o $@ $^ -I$(LOCINCLUDEDIR) -ldatrwxx \
-lsffxx -ltime++ -lgsexx -laff -ltfxx \
-L$(LOCLIBDIR) $(CXXFLAGS) $(FLAGS) $(STATIC) $(LDFLAGS)
any2anystat: %stat: %.o
$(CXX) -o $@ $^ -I$(LOCINCLUDEDIR) -ldatrwxx \
-lsffxx -ltime++ -lgsexx -laff -ltfxx -static \
-L$(LOCLIBDIR) $(CXXFLAGS) $(FLAGS) $(STATIC) $(LDFLAGS)
anyindex any2ascii any2sff: %: %.o
$(CXX) -o $@ $^ -I$(LOCINCLUDEDIR) -ldatrwxx \
......@@ -202,7 +191,7 @@ any2asciistat any2sffstat anyindexstat: %stat: %.o
$(call CHECKVARS,TF_WWWBASEDIR TF_BROWSER)
DOXYWWWPATH=$(TF_WWWBASEDIR)/convsff
DOXYWWWPATH=$(TF_WWWBASEDIR)/convmany
.PHONY: doxyclean doxyview doxydoc doxyconf
......@@ -236,17 +225,17 @@ ifdef TF_MAKEPKG
.PHONY: package
package: $(TF_MAKEPKG)
$(MAKE) -f $< \
PACKAGE=convsff \
PACKAGEEXPORT="trunk/src/conv/sff:src" \
PACKAGE=convmany \
PACKAGEEXPORT="trunk/src/conv/many:src" \
PACKAGETARGETS="src:all" \
PACKAGELIBS="-"
.PHONY: fullpackage
fullpackage: $(TF_MAKEPKG)
$(MAKE) -f $< \
PACKAGE=convsffwithlibs \
PACKAGEEXPORT="trunk/src/conv/sff:src" \
PACKAGE=convmanywithlibs \
PACKAGEEXPORT="trunk/src/conv/many:src" \
PACKAGETARGETS="src:all" \
PACKAGELIBS="libsff:libseife:libtime:libaff:libsffu:libts:libgsexx:libsffxx:libdatrwxx:libtsxx:libtfxx:libtf"
PACKAGELIBS="libtime:libaff:libgsexx:libsffxx:libdatrwxx:libtsxx:libtfxx"
endif
# ----- END OF Makefile -----
/*! \file README
\mainpage SFF conversion tools and friends
\mainpage (m)any seismic format conversion tools and friends
- \ref any2any.cc
- \ref any2ascii.cc
- \ref any2sff.cc
- \ref anyextract.cc
- \ref anyindex.cc
- \ref codecoLinux.f
- \ref gse2sff.f
- \ref listsff.f
- \ref Makefile
- \ref sff2ascii.f
- \ref sff2refra.f
- \ref sff2seife.f
- \ref sffextract.cc
\verbatim
this is <README>
============================================================================
SFF conversion tools and friends
--------------------------------
Seismic format conversion tools
-------------------------------
$Id$
============================================================================
General format conversion
-------------------------
The programs in this subdirectory make use of libdatrwxx and support reading
and writing of various seismic formats.
any2any
Converts files for any input format supported by lindatrwxx reading modules
......@@ -56,50 +51,6 @@ anyextract
is provided to produce a liast of contiguous data time windows as listed in
the input index file.
SFF specific format conversion
------------------------------
sffextract
Extracts a specific time window from an SFF data file.
gse2sff
This program converts any GSE formatted CM6 encoded waveform data file to
SFF (the Stuttgart File Format). SFF adds some IDs to GSE format.
You may provide any waveform data in the form of the text file received
directly from an AutoDRM via e-mail. All text surrounding the data traces
will be enclosed within FREE-blocks.
codeco
If you can't receive GSE format data in CM6 compression you may use this
program to convert the data sample representation. Agein you may feed full
e-mail text messages to this programm.
codeco.f was written by Urs Kradolfer and Karl Koch and is distributed
together with the sources of the Swiss AutoDRM.
sff2ascii
You may convert any SFF data file to a set of pure ASCII one- or two-column
data files.
listsff
This program helps reading the SFF trace headers. It will output the whole
data file except the DAT2-blocks (i.e. encoded data samples).
sff2seife
This program converts SFF data to seife format (Erhard Wielandt's seismic
analysis and filter tools).
sff2refra
This program converts SFF data to refra format (refraction seismics
data inversion, K.J. Sandmeier).
Most programs support an online help options. Just call the
program without any option to get a hint.
......@@ -112,13 +63,6 @@ are required. See the comments in the Makefile for details.
============================================================================
Contents of subdirectories:
gseC: GSE reading and writing functions from Stefan Stange
res: codeco conversion program distributed together with SwissDRM
============================================================================
Please send bug reports and suggestions to
Thomas.Forbriger@kit.edu
......
......@@ -4,7 +4,7 @@
# Project related configuration options
#---------------------------------------------------------------------------
DOXYFILE_ENCODING = UTF-8
PROJECT_NAME = "SFF conversion tools and friends"
PROJECT_NAME = "(m)any seismic format conversion tools and friends"
PROJECT_NUMBER =
OUTPUT_DIRECTORY = <OUTPUTDIRECTORY>
CREATE_SUBDIRS = NO
......
c this is <gse2sff.f>
c------------------------------------------------------------------------------
c
c 27/05/98 by Thomas Forbriger (IfG Stuttgart)
c
c Convert GSE2.0 CM6 data to SFF files format
c
c ----
c This program is free software; you can redistribute it and/or modify
c it under the terms of the GNU General Public License as published by
c the Free Software Foundation; either version 2 of the License, or
c (at your option) any later version.
c
c This program is distributed in the hope that it will be useful,
c but WITHOUT ANY WARRANTY; without even the implied warranty of
c MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
c GNU General Public License for more details.
c
c You should have received a copy of the GNU General Public License
c along with this program; if not, write to the Free Software
c Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
c ----
c
c REVISIONS and CHANGES
c 27/05/98 V1.0 Thomas Forbriger
c 18/08/98 V1.1 program did shuffle WID2 lines
c 15/08/00 V1.2 replace option
c 25/10/00 V1.3 - allow SZGRF STA2-line in RData
c V1.4 - optionally create dummy SRCE line
c 28/10/05 V1.5 - debugging output
c - check for 'CHK2 ' rather than 'CHK2'
c 12/06/97 V1.6 - provide complete STA2 reading
c
c==============================================================================
c
program gse2sff
c
character*79 version
parameter(version=
& 'GSE2SFF V1.6 Convert GSE2.0 CM6 data to SFF files format')
c
integer maxsamp, maxchar, maxfree
parameter(maxsamp=200000,maxchar=maxsamp*8,maxfree=500)
character*1 cbuf(maxchar)
integer idata(maxsamp)
real ampfac
real lat,long,height
logical foundcoord
character*10 code
character*80 free(maxfree)
character*132 wid2line, inline
integer nfree, nsamp, nchar
logical datahold, hot
character*80 gsefile, sfffile
integer luin, luout, ierr, sff_GetN
parameter(luin=10, luout=11)
c commandline
integer maxopt, lastarg, iargc
character*80 argument
parameter(maxopt=3)
character*2 optid(maxopt)
character*40 optarg(maxopt)
logical optset(maxopt), opthasarg(maxopt)
c debugging
logical debug
c options
logical overwrite,srcedummy
c here are the keys to our commandline options
data optid/2h-d,2h-o,2h-s/
data opthasarg/3*.FALSE./
data optarg/3*1h-/
c
c------------------------------------------------------------------------------
c basic information
c
print *,version
print *,'Usage: gse2sff gse-file sff-file [-o] [-s]'
print *,' or: gse2sff -help'
c
if (iargc().lt.1) stop 'ERROR: missing arguments'
call getarg(1, argument)
if (argument(1:5).eq.'-help') then
print *,' '
print *,'Convert GSE2.0 CM6 data to SFF files format'
print *,' '
print *,'gse-file input file'
print *,'sff-file valid SFF output file'
print *,' '
print *,'-o replace existing output file'
print *,'-s install dummy SRCE line'
print *,' '
print *,'$Id$'
stop
endif
if (iargc().lt.2) stop 'ERROR: missing arguments'
c
c------------------------------------------------------------------------------
c read command line arguments
c
call tf_cmdline(3, lastarg, maxopt, optid,
& optarg, optset, opthasarg)
debug=optset(1)
overwrite=optset(2)
srcedummy=optset(3)
c
call getarg(1,gsefile)
call getarg(2,sfffile)
print *,' '
print *,'input file: ',gsefile(1:index(gsefile, ' '))
print *,'output file: ',sfffile(1:index(sfffile, ' '))
c
c------------------------------------------------------------------------------
c
datahold=.false.
foundcoord=.false.
hot=.true.
open(luin, file=gsefile, status='old', err=99)
do while(hot)
c look for next data segment
read(luin, '(a)', err=98, end=1) inline
nfree=0
do while(inline(1:5).ne.'WID2')
if (nfree.lt.maxfree) then
nfree=nfree+1
free(nfree)=inline(1:80)
endif
read(luin, '(a)', err=98, end=1) inline
enddo
c found
if (datahold) then
c first empty buffer
code='FD'
if (foundcoord) code='FID'
ampfac=1.
call sff_WData(luout, wid2line, nsamp, idata, ampfac, code)
call sff_WFree(luout, nfree, free)
if (foundcoord) call sff_WInfo(luout,'S',lat,long,height,1)
else
c first open new file
c call sff_New(luout, sfffile, ierr)
c if (ierr.ne.0) stop 'ERROR: removing SFF file'
if (overwrite) then
call sff_New(luout, sfffile, ierr)
if (ierr.ne.0) stop 'ERROR: replacing SFF file'
endif
if (srcedummy) then
call sff_WOpenFS(luout, sfffile, free, nfree,
& 'NSP', 'C', 0.,0.,0., '700101','000000.000', ierr)
else
call sff_WOpenF(luout, sfffile, free, nfree, ierr)
endif
c call sff_WOpen(luout, sfffile, ierr)
if (ierr.ne.0) stop 'ERROR: opening SFF file'
endif
c read next data segment
wid2line=inline
print *,' '
if (debug) print *,'DEBUG: found WID2:'
print *,wid2line
nsamp=sff_GetN(wid2line)
if (debug) print *,'DEBUG: number of samples: ',nsamp
if (nsamp.gt.maxsamp) stop 'ERROR: too many samples'
nchar=maxchar
if (debug) print *,'DEBUG: read data using RData'
call RData(luin, nsamp, idata, cbuf, nchar, ierr,
& lat, long, height, foundcoord, debug)
if (debug) print *,'DEBUG: data read from file'
if (ierr.ne.0) stop 'ERROR: reading GSE trace'
datahold=.true.
goto 2
1 hot=.false.
2 continue
enddo
c
if (nfree.lt.maxfree) then
nfree=nfree+1
free(nfree)=inline(1:80)
endif
c write last trace
if (datahold) then
code='F'
if (foundcoord) code='FI'
ampfac=1.
call sff_WData(luout, wid2line, nsamp, idata, ampfac, code)
call sff_WFree(luout, nfree, free)
if (foundcoord) call sff_WInfo(luout,'S',lat,long,height,1)
close(luout, err=96)
else
print *,'WARNING: no data found in input file'
endif
close(luin, err=97)
c
stop
99 stop 'ERROR: opening GSE file'
98 stop 'ERROR: reading GSE file'
97 stop 'ERROR: closing GSE file'
96 stop 'ERROR: closing SFF file'
end
c
c======================================================================
c
c my own reading routine
c
subroutine RData(lu,nsamp,idata,cbuf,nchar,ierr,
& lat, long, height, foundcoord, debug)
c
c Reads a data block from DAT2 to CHK2
c Input:
c lu: File unit
c nsamp: array dimension = expected number of samples
c nchar: dimension of work space cbuf
c Output:
c idata: integer data
c nsamp: number of samples received
c ierr: =0 if no error occured
c Work space:
c cbuf: work space of size ibufsize
c
integer lu, ierr, nsamp, idata(nsamp), nchar
real lat, long, height, edepth
logical foundcoord, debug
character cbuf(nchar)*1
cE
character line*80
character network*9, coordsys*12
integer i, j, ichecksum, nchecksum, nmax, ierror
c
c Now read in data according to the format:
c
if (debug) print *,'DEBUG: entered subroutine RData'
ierr=0
j=0
read(lu, '(a)') line
if (line(1:5).eq.'STA2 ') then
foundcoord=.true.
print *,'RData: STA2 line'
call sffu_rsta2(line, network, lat, long,
& coordsys, height, edepth, ierr)
if (ierr.ne.0) stop 'ERROR: reading STA2 line'
read(lu, '(a)') line
endif
if (line(1:5).ne.'DAT2 ') then
print *,'RData ERROR: data segment does not start with DAT2'
ierr=1
return
endif
if (debug) print *,'DEBUG: read next line'
11 read(lu,'(a)') line
if (debug) print *,'DEBUG: next line: ', line
if(line(1:5).eq.'CHK2 ') goto 12
j=j+1
if ((80*j).gt.nchar) then
print *,'RData2: ERROR character buffer not large enough'
ierr=1
return
endif
do 10 i=1,80
10 cbuf(80*(j-1)+i)=line(i:i)
goto 11
if (debug) print *,'DEBUG: read checksum'
12 read(line(5:),*) ichecksum
if (debug) print *,'DEBUG: checksum is: ',ichecksum
c if(nchar.ne.j*80) then
c write(0,'(a)') 'RData ERROR: Number of data != expected number'
c ierr =1
c return
c endif
nchar=j*80
nmax=nsamp
if (debug) print *,'DEBUG: call DCOMP6'
call DCOMP6(nchar,cbuf,nsamp,idata,ierror)
if (debug) print *,'DEBUG: returned from DCOMP6'
if(ierror.eq.-1) then
write(6,*)'RData ERROR: Data array not large enough !'
print *,'RData: nmax: ',nmax,' nsamp: ',nsamp
ierr = 1
return
endif
if(nsamp.ne.nmax)then
write(0,*)'RData ERROR in retrieving correct number of samples !'
write(0,*)'Expected ',nmax,', received ',nsamp
ierr = 1
return
endif
c remove second differences
if (debug) print *,'DEBUG: call REMDIF1'
call REMDIF1(idata,nsamp)
call REMDIF1(idata,nsamp)
if (debug) print *,'DEBUG: REMDIF1 finished'
c
call sff_checksum(nsamp, idata, nchecksum)
if(nchecksum.ne.ichecksum)then
write(0,*)'RData: ERROR in checksum'
write(0,*)'Read checksum =',ichecksum
write(0,*)'Calculated checksum =',nchecksum
ierr = 1
return
endif
ierr = 0
return
end
c
c ----- END OF gse2sff.f -----
c this is <listsff.f> by Thomas Forbirger
c
c It's a quick hack to list human readable parts of sff data files
c
c ----
c This program is free software; you can redistribute it and/or modify
c it under the terms of the GNU General Public License as published by
c the Free Software Foundation; either version 2 of the License, or
c (at your option) any later version.
c
c This program is distributed in the hope that it will be useful,
c but WITHOUT ANY WARRANTY; without even the implied warranty of
c MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
c GNU General Public License for more details.
c
c You should have received a copy of the GNU General Public License
c along with this program; if not, write to the Free Software
c Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
c ----
c
c REVISIONS and CHANGES
c 12/02/97 V1.0 Thomas Forbriger
c 09/01/98 V1.1 multiple file selection
c
c
c----------------------------------------------------------------------
program listsff
character*70 version, creator
parameter(version='LISTSFF V1.1 list human readable parts of sff')
parameter(creator='1997 by Thomas Forbriger (IfG Stuttgart)')
integer nlen, trace, iargc, ifile
logical typeout
integer lu
parameter(lu=10)
character inline*200, filename*200
c----------------------------------------------------------------------
print 50,version
print *,creator
print 50,'Usage: listsff file [file ...]'
if (iargc().lt.1) stop 'ERROR: need filename argument'
do ifile=1,iargc()
call getarg(ifile,filename)
if (iargc().gt.1) then
print 53,filename(1:index(filename, ' '))
endif
typeout=.true.
trace=0
open(lu, file=filename, err=99)
2 continue
read(lu, '(a)', err=98, end=1) inline
if (inline(1:5).eq.'DAST ') then
trace=trace+1
print 51,'START OF TRACE',trace
endif
if (inline(1:5).eq.'DAT2 ') then
typeout=.false.
print 52,'...SKIPPING DAT2 DATA BLOCK...'
endif
if (inline(1:5).eq.'CHK2 ') typeout=.true.
if (typeout) then
call sff_TrimLen(inline, nlen)
print 50,inline(1:nlen)
endif
goto 2
1 continue
close(lu, err=97)
enddo
stop
50 format(a)
51 format(/a14,1x,i3/18(1h-)/)
52 format(/a/)
53 format(/'****************',/
& '* NEXT FILE IS: ',a/
& '****************')
99 stop 'ERROR: opening file'
98 stop 'ERROR: reading file'
97 stop 'ERROR: closing file'
end
c this is <sff2ascii.f>
c------------------------------------------------------------------------------
c