Commit 75fca8c0 authored by thomas.forbriger's avatar thomas.forbriger

[FEATURE] (evelox): make file format selectable

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.
parent 1f21c542
...@@ -29,6 +29,7 @@ c 01/03/99 V1.3 calculate spectral coefficients ...@@ -29,6 +29,7 @@ c 01/03/99 V1.3 calculate spectral coefficients
c 25/06/01 V1.4 depart from GSE sampling rate standard formst if c 25/06/01 V1.4 depart from GSE sampling rate standard formst if
c necessary c necessary
c 04/12/09 V1.5 corrected comment c 04/12/09 V1.5 corrected comment
c 05/07/14 V1.6 provide access to other data formats
c c
c============================================================================== c==============================================================================
c c
...@@ -36,7 +37,7 @@ c ...@@ -36,7 +37,7 @@ c
c c
character*79 version character*79 version
parameter(version= parameter(version=
& 'EVELO V1.5 calculate EnVELOpe of time series') & 'EVELO V1.6 calculate EnVELOpe of time series')
c c
integer maxsamples,nsamp,nspa,i, npow, limit integer maxsamples,nsamp,nspa,i, npow, limit
parameter(maxsamples=310000) parameter(maxsamples=310000)
...@@ -68,6 +69,8 @@ c ...@@ -68,6 +69,8 @@ c
character*20 srctype character*20 srctype
character*6 srcdate character*6 srcdate
character*10 srctime character*10 srctime
c
character*80 inputformat, outputformat
c c
integer maxfree, maxreadfree, nfree, lenmax integer maxfree, maxreadfree, nfree, lenmax
parameter(maxfree=200, maxreadfree=maxfree-1) parameter(maxfree=200, maxreadfree=maxfree-1)
...@@ -75,16 +78,17 @@ c ...@@ -75,16 +78,17 @@ c
c commandline c commandline
integer maxopt, lastarg, iargc integer maxopt, lastarg, iargc
character*80 argument character*80 argument
parameter(maxopt=8) parameter(maxopt=11)
character*2 optid(maxopt) character*2 optid(maxopt)
character*40 optarg(maxopt) character*40 optarg(maxopt)
logical optset(maxopt), opthasarg(maxopt) logical optset(maxopt), opthasarg(maxopt)
c debugging c debugging
logical debug, verbose logical debug, verbose
c here are the keys to our commandline options c here are the keys to our commandline options
data optid/2h-d, 2h-v, 2h-H, 2h-R, 2h-I, 2h-A, 2h-P, '-4'/ data optid/2h-d, 2h-v, 2h-H, 2h-R, 2h-I, 2h-A, 2h-P, '-4',
data opthasarg/8*.FALSE./ & '-ty', '-it', '-ot'/
data optarg/8*1h-/ data opthasarg/8*.FALSE.,3*.TRUE./
data optarg/8*1h-,3*'sff'/
c c
c------------------------------------------------------------------------------ c------------------------------------------------------------------------------
c basic information c basic information
...@@ -95,6 +99,7 @@ c ...@@ -95,6 +99,7 @@ c
if ((argument(1:5).eq.'-help').or.(iargc().lt.2)) then if ((argument(1:5).eq.'-help').or.(iargc().lt.2)) then
print *,version print *,version
print *,'Usage: evelo infile outfile [-H|-R|-I|-A|-P|-4]' print *,'Usage: evelo infile outfile [-H|-R|-I|-A|-P|-4]'
print *,' [-ty f] [-it f] [-ot f]'
print *,' or: evelo -help' print *,' or: evelo -help'
if (argument(1:5).ne.'-help') stop 'ERROR: wrong number of arguments' if (argument(1:5).ne.'-help') stop 'ERROR: wrong number of arguments'
print *,' ' print *,' '
...@@ -108,6 +113,11 @@ c ...@@ -108,6 +113,11 @@ c
print *,'-P calculate Fourier phase spectrum' print *,'-P calculate Fourier phase spectrum'
print *,'-4 phase shift by pi/4' print *,'-4 phase shift by pi/4'
print *,' ' print *,' '
print *,'-ty f choose file format ''f'' instead of SFF'
print *,' for input and output files'
print *,'-it f choose input file format ''f'' instead of SFF'
print *,'-ot f choose output file format ''f'' instead of SFF'
print *,' '
print *,'The switches are exclusive with priority in the order' print *,'The switches are exclusive with priority in the order'
print *,'listed above.' print *,'listed above.'
print *,' ' print *,' '
...@@ -118,6 +128,8 @@ c ...@@ -118,6 +128,8 @@ c
print *,'Thus Fourier coeffients and spectral amplitudes are' print *,'Thus Fourier coeffients and spectral amplitudes are'
print *,'given in [amplitude]/Hz, where [amplitude] is' print *,'given in [amplitude]/Hz, where [amplitude] is'
print *,'the unit of the input samples.' print *,'the unit of the input samples.'
print *,' '
call sff_help_formats
stop stop
endif endif
c c
...@@ -152,11 +164,20 @@ c ...@@ -152,11 +164,20 @@ c
endif endif
endif endif
endif endif
inputformat=optarg(9)
outputformat=optarg(9)
if (optset(10)) inputformat=optarg(10)
if (optset(11)) outputformat=optarg(11)
c c
c c
call getarg(1, infile) call getarg(1, infile)
call getarg(2, outfile) call getarg(2, outfile)
c c
call sff_select_input_format(inputformat, ierr)
if (ierr.ne.0) stop 'ERROR: selected input format is not supported'
call sff_select_output_format(outputformat, ierr)
if (ierr.ne.0) stop 'ERROR: selected output format is not supported'
c
c------------------------------------------------------------------------------ c------------------------------------------------------------------------------
c go c go
c c
......
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