Read one trace of data and return FREE block and INFO line additionally.
c----------------------------------------------------------------------
subroutine sff_RTraceFI(lu, tanf, dt,
& wid2line, nsamp, fdata, idata, code, last,
& nline, lines, lindim, lenmax,
& cs, c1, c2, c3, nstack, ierr)
c
c Read one data block starting with DAST line.
c Read also FREE block and INFO line.
c The File will be closed after reading the last trace.
c
c input
c lindim number of elements in FREE block array lines
c nsamp array dimension of idata and fdata
c ouput:
c ierr error status (ok: ierr=0)
c code code indicating optional blocks
c wid2line valid WID2 line
c tanf time of first sample from midnight
c dt sampling interval in seconds
c nsamp number of samples
c fdata data array
c last is true if read trace is the last one in this file
c nline number of FREE block lines read
c lines FREE block lines
c lenmax length of longest line in FREE block array lines
c cs coordinate system
c c1, c2, c3 receiver coordinates
c nstack number of stacks
c
c workspace:
c idata data will be first read to idata and then converted
c to fdata using sff_i2f (both array may be in same memory
c space - see comments on sff_f2i)
c
integer lu, nsamp, idata(nsamp), nline, nstack, lindim, lenmax
real fdata(nsamp), c1, c2, c3, dt, tanf
character wid2line*132, lines(lindim)*(*), cs*1, code*(*)
c----------------------------------------------------------------------
109 datrw::Tfseries iseries;
112 "sff_rtracefi__: too many samples");
113 int nsamples=iseries.size();
114 aff::LinearShape shape(0, nsamples-1, 0);
115 datrw::Tfseries series(shape, aff::SharedHeap<real>(fdata, *nsamp));
116 series.copyin(iseries);
117 *last = is.last() ? 1 : 0;
119 std::string ocode(
"");
120 if (is.hasfree()) { ocode.append(
"F"); }
121 if (is.hasinfo()) { ocode.append(
"I"); }
122 if (!is.last()) { ocode.append(
"D"); }
123 if (is.hasinfo()) { is >> info; }
126 *dt=
static_cast<real>(wid2.dt);
128 *nsamp=series.size();
129 char thecs=sff::coosysID(info.cs);
131 *c1=
static_cast<real>(info.cx);
132 *c2=
static_cast<real>(info.cy);
133 *c3=
static_cast<real>(info.cz);
134 *nstack=info.nstacks;
136 if (is.hasfree()) { is >> free; }
137 freeblock(free, nline, lines, lindim, lenmax, lines_len);
sff::FREE freeblock(integer *nline, char *lines, ftnlen lines_len)
create C++ FREE block from Fortran FREE lines
void fillfstring(const std::string &s, char *fstring, ftnlen slen)
fill a Fortran string with a C++ string
#define FAPIDXX_fuassert(C, U, M)
Check an assertion and report by throwing an exception.
float real
Fortran real type (single precision)
float maketanf(const libtime::TAbsoluteTime &time)
create the tanf value
::fapidxx::IFileUnits istreammanager
the global istream manager