DATRW++ library: seismic data I/O with multiple formats

◆ channel()

ChannelDescription datrw::tsoft::channel ( const SFFchannelid insid)

return channel data for given SFF channel ID

Definition at line 408 of file channeltranslation.cc.

References datrw::tsoft::SFFchannelid::auxid, datrw::tsoft::ChannelDescription::cc, datrw::tsoft::SFFchannelid::channel, CNFD, datrw::tsoft::Channel::ConversionCode, datrw::tsoft::TSOFTchannelid::datatype, DATRW_assert, datrw::tsoft::TSOFTchannelid::instrument, datrw::tsoft::SFFchannelid::instrument, datrw::tsoft::TSOFTchannelid::location, schannelid(), datrw::tsoft::ChannelDescription::sid, datrw::tsoft::SFFchannelid::station, tchannelid(), datrw::tsoft::ChannelDescription::tid, translationtable, datrw::util::trimws(), and datrw::tsoft::Channel::TSOFTname.

409  {
410  SFFchannelid sid;
411  sid.station=datrw::util::trimws(insid.station);
412  sid.channel=datrw::util::trimws(insid.channel);
413  sid.instrument=datrw::util::trimws(insid.instrument);
414  sid.auxid=datrw::util::trimws(insid.auxid);
415 
416  /*
417  std::cout << "translate: "
418  << sid.station << ":"
419  << sid.channel << ":"
420  << sid.instrument << ":"
421  << sid.auxid << std::endl;
422  */
423 
424  // initialize return value with default
425  ChannelDescription retval;
426  TSOFTchannelid& tid=retval.tid;
427  tid.location=sid.station;
428  tid.datatype=sid.channel;
429  tid.instrument=sid.instrument;
430  retval.sid=sid;
431  retval.cc=CNFD;
432 
433  const Channel* pc=translationtable;
434  bool hot=true;
435  while (hot && (pc->TSOFTname != NULL))
436  {
437  DATRW_assert(pc->TSOFTname != NULL,
438  "UUPS... this is a programming error!");
439  SFFchannelid sffid=schannelid(*pc);
440  if ((sid.station==sffid.station)
441  && (sid.instrument==sffid.instrument)
442  && (sid.channel==sffid.channel)
443  && (sid.auxid==sffid.auxid))
444  {
445  /*
446  std::cout << "found: "
447  << tci.location << ":"
448  << tci.instrument << ":"
449  << tci.datatype << ":" << std::endl;
450  */
451  tid=tchannelid(*pc);
452  retval.cc=pc->ConversionCode;
453  hot=false;
454  }
455  ++pc;
456  }
457  return(retval);
458  } // ChannelDescription channel(const SFFchannelid& sci)
#define DATRW_assert(C, M)
Check an assertion and report by throwing an exception.
Definition: error.h:92
const Channel translationtable[]
global variable: channel name translation tableThis table is specific for SG056 at BFO...
std::string trimws(std::string s)
remove leading and trailing whitespace
Definition: util.cc:129
SFFchannelid schannelid(const Channel &ci)
split SFF channel description
TSOFTchannelid tchannelid(const Channel &ci)
split TSOFT channel description
not found in channel translation table
Here is the call graph for this function: