Fortran SFF API to data I/O streams in C++

◆ sff_prepwid2__()

int sff_prepwid2__ ( integer nsamp,
real samprat,
char *  station,
integer year,
integer month,
integer day,
integer hour,
integer minute,
char *  comp,
char *  auxid,
char *  instyp,
real second,
real calib,
real calper,
real hang,
real vang,
char *  wid2line,
integer ierr,
ftnlen  station_len,
ftnlen  comp_len,
ftnlen  auxid_len,
ftnlen  instyp_len,
ftnlen  wid2line_len 
)

Encode WID2 data.

Description from stuff.f:

c----------------------------------------------------------------------
c
c Prepare a WID2 line from scratch
c
c The routine sets defaults for all variables set either to -1
c for integers, -1. for floats or 'NSP' (not specified) for characters
c If a component e.g. in the form LHZ is given hang and vang are
c determined automatically
c
c Reasonable values must be given for at least
c samprat: sampling rate (= 1./(sampling interval))
c nsamp: number of smaples
c station: station name
c
c Defaults are:
c year: 0
c month. 0
c day: 0
c hour: 0
c minute: 0
c second: 10.0
c comp: NSP
c auxid: NSP
c instyp: NSP
c calib: 1.
c calper: 1.
c hang: -1.
c vang: 90.
c
c Returns wid2line
c
c major changes:
c 22/11/96 T.F. changed format of calib to e10.2 as defined by GSE2.0
c
integer nsamp, year, month, day, hour, minute
character comp*(*), auxid*(*), station*(*), instyp*(*)
real samprat, second, calib, calper, hang, vang
character wid2line*(*)
integer ierr
c----------------------------------------------------------------------

Definition at line 90 of file fapid_sff_prepwid2.cc.

References fapidxx::WID2container::encode(), and fapidxx::stringfromfstring().

97 {
98  ::sff::WID2 wid2;
99  wid2.nsamples= *nsamp;
100  wid2.dt = 1./(*samprat);
101  wid2.station =fapidxx::stringfromfstring(station, station_len);
102  double dsecond=*second;
103  libtime::timeint isecond=static_cast<libtime::timeint>(std::floor(dsecond));
104  libtime::timeint milsec
105  =static_cast<libtime::timeint>(std::floor(1.e3*dsecond));
106  libtime::timeint micsec
107  =static_cast<libtime::timeint>(std::floor(1.e6*dsecond));
108  milsec -= 1000*isecond;
109  micsec -= 1000*(milsec+1000*isecond);
110  libtime::TAbsoluteTime date(*year, *month, *day, *hour, *minute,
111  isecond, milsec, micsec);
112  wid2.date =date;
113  wid2.channel =fapidxx::stringfromfstring(comp, comp_len);
114  wid2.auxid =fapidxx::stringfromfstring(auxid, auxid_len);
115  wid2.instype =fapidxx::stringfromfstring(instyp, instyp_len);
116  wid2.calib = *calib;
117  wid2.calper = *calper;
118  wid2.hang = *hang;
119  wid2.vang = *vang;
120  fapidxx::WID2container wid2c(wid2);
121  wid2c.encode(wid2line, wid2line_len);
122  *ierr=0;
123  return(0);
124 } // int sff_prepwid2__
This struct is used to pass WID2 line data within libfapidxx.
Definition: wid2container.h:62
std::string stringfromfstring(char *fstring, ftnlen slen)
create a C++ string from a Fortran string
Definition: helper.cc:51
Here is the call graph for this function: