set time values correctly
set time values
Definition at line 426 of file suheader.cc.
References datrw::su::TraceHeaderStruct::d1, DATRW_assert, DATRW_debug, datrw::su::TraceHeaderStruct::delrt, datrw::su::TraceHeaderStruct::dt, datrw::su::options::TemporalSampling::forceseismic, datrw::su::options::TemporalSampling::forceultrasonic, Mdebug, Mhassrce, Mhaswid2, Mheader, Mheadercontrol, Msrcedate, Mwid2date, Mwid2dt, and datrw::su::options::SUHeaderControl::temporalsampling.
Referenced by set().
430 "ERROR SUheader::settimes: ",
434 "ERROR SUheader::settimes: ",
438 "ERROR SUheader::settimes: ",
439 "SRCE time: " <<
Msrcedate.timestring());
442 "ERROR SUheader::settimes: " 443 "function called at wrong instance");
446 bool ultrasonic=
false;
452 "received non-positive sampling interval");
454 double dtfactor=1.e6;
455 double scaleddt=nearbyint(dtfactor*this->
Mwid2dt);
463 scaleddt=nearbyint(dtfactor*this->
Mwid2dt);
465 "SUheader::settimes",
466 "ultrasonic scaling is forced");
471 "SUheader::settimes",
472 "seismic scaling is forced");
477 if ((!ultrasonic) && scaleddt <1.)
481 scaleddt=nearbyint(dtfactor*this->
Mwid2dt);
483 "SUheader::settimes",
484 "ultrasonic scaling because of dt " 485 << scaleddt <<
"ns value");
490 "SUheader::settimes",
491 "seismic scaling because of dt " 492 << scaleddt <<
"us value");
495 if (scaleddt > USHRT_MAX)
497 std::cerr <<
"received sampling interval: " << scaleddt;
506 std::cerr << std::endl;
509 "ERROR (SUheader::set): " 510 "sampling interval cannot be represented by " 511 "a field of type unsigend short");
512 Mheader.
dt=
static_cast<unsigned short>(scaleddt);
524 double delfactor=1.e3;
525 if (ultrasonic) { delfactor=1.e6; }
526 double delvalue=std::floor(delfactor*libtime::time2double(del));
528 DATRW_assert(((delvalue >= SHRT_MIN) && (delvalue <= SHRT_MAX)),
529 "ERROR (SUheader::set): " 530 "trigger delay cannot be represented by " 531 "a field of type short.");
#define DATRW_assert(C, M)
Check an assertion and report by throwing an exception.
bool forceultrasonic
force ultrasonic headers
#define DATRW_debug(C, N, M)
produce debug output
bool forceseismic
force seismic headers