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

◆ translate()

SFFchannelid datrw::tsoft::translate ( const TSOFTchannelid ci)

return SFF channel ID for given TSOFT channel ID

Definition at line 364 of file channeltranslation.cc.

References datrw::tsoft::SFFchannelid::auxid, datrw::tsoft::SFFchannelid::channel, datrw::tsoft::TSOFTchannelid::datatype, DATRW_assert, datrw::tsoft::TSOFTchannelid::instrument, datrw::tsoft::SFFchannelid::instrument, datrw::tsoft::TSOFTchannelid::location, schannelid(), datrw::tsoft::SFFchannelid::station, tchannelid(), translationtable, and datrw::tsoft::Channel::TSOFTname.

Referenced by readfile().

365  {
366  /*
367  std::cout << "translate: "
368  << ci.location << ":"
369  << ci.instrument << ":"
370  << ci.datatype << ":" << std::endl;
371  */
372  SFFchannelid retval;
373  retval.station=ci.location;
374  retval.channel=ci.datatype.substr(0,3);
375  retval.instrument=ci.instrument;
376  retval.auxid=ci.datatype.substr(3);
377  const Channel* pc=translationtable;
378  bool hot=true;
379  while (hot && (pc->TSOFTname != NULL))
380  {
381  DATRW_assert(pc->TSOFTname != NULL,
382  "UUPS... this is a programming error!");
383  TSOFTchannelid tci=tchannelid(*pc);
384  if ((tci.location==ci.location)
385  && (tci.instrument==ci.instrument)
386  && (tci.datatype==ci.datatype))
387  {
388  /*
389  std::cout << "found: "
390  << tci.location << ":"
391  << tci.instrument << ":"
392  << tci.datatype << ":" << std::endl;
393  */
394  SFFchannelid sci=schannelid(*pc);
395  retval.station=sci.station;
396  retval.channel=sci.channel;
397  retval.instrument=sci.instrument;
398  retval.auxid=sci.auxid;
399  hot=false;
400  }
401  ++pc;
402  }
403  return(retval);
404  } // SFFchannelid translate(const TSOFTchannelid& ci)
#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...
SFFchannelid schannelid(const Channel &ci)
split SFF channel description
TSOFTchannelid tchannelid(const Channel &ci)
split TSOFT channel description
Here is the call graph for this function:
Here is the caller graph for this function: