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

◆ equalizescaling()

void datrw::su::Coordinates::equalizescaling ( )

equalize scaling

Definition at line 411 of file sucomanager.cc.

References DATRW_assert, DATRW_debug, gelev, gx, gy, Mcontrol, datrw::su::options::SpatialSampling::scalco, datrw::su::ScalCoo::scale, datrw::su::ScalCoo::scaletopower(), sdepth, datrw::su::ScalCoo::smallestpower(), sx, and sy.

Referenced by main(), and setvaluesin().

412  {
413  bool debug=false;
414  // adjust horizontal coordinates
415  DATRW_debug(debug, "Coordinates::equalizescaling",
416  "scales on entry"
417  << " gelev.scale " << this->gelev.scale
418  << " sdepth.scale " << this->sdepth.scale);
419  /* is not required when search for the smallest possible power
420  this->sx.adjustscale();
421  this->sy.adjustscale();
422  this->gx.adjustscale();
423  this->gy.adjustscale();
424  */
425  // search for smallest possible power
426  int psx=this->sx.smallestpower(Mcontrol.scalco);
427  int psy=this->sy.smallestpower(Mcontrol.scalco);
428  int pgx=this->gx.smallestpower(Mcontrol.scalco);
429  int pgy=this->gy.smallestpower(Mcontrol.scalco);
430  int pnew = psx > psy ? psx : psy;
431  pnew = pnew > pgx ? pnew : pgx;
432  pnew = pnew > pgy ? pnew : pgy;
433  // check against largest possible power
434  /* is not necessary
435  pnew = pnew < sx.power() ? pnew : sx.power();
436  pnew = pnew < sy.power() ? pnew : sy.power();
437  pnew = pnew < gx.power() ? pnew : gx.power();
438  pnew = pnew < gy.power() ? pnew : gy.power();
439  */
440  this->sx.scaletopower(pnew);
441  this->sy.scaletopower(pnew);
442  this->gx.scaletopower(pnew);
443  this->gy.scaletopower(pnew);
444  DATRW_assert(((this->sx.scale==this->sy.scale) &&
445  (this->sy.scale==this->gx.scale) &&
446  (this->gx.scale==this->gy.scale)),
447  "ERROR: inconsistent coordinate scaling");
448  // adjust vertical coordinates
449  /* is not required when scaling with the smallest possible power
450  this->sdepth.adjustscale();
451  this->gelev.adjustscale();
452  DATRW_debug(debug, "Coordinates::equalizescaling",
453  "scales after adjust"
454  << " gelev.scale " << this->gelev.scale
455  << " sdepth.scale " << this->sdepth.scale);
456  */
457  int psdepth=this->sdepth.smallestpower(Mcontrol.scalco);
458  int pgelev=this->gelev.smallestpower(Mcontrol.scalco);
459  pnew = psdepth > pgelev ? psdepth : pgelev;
460  /* is not necessary
461  pnew = pnew < sdepth.power() ? pnew : sdepth.power();
462  pnew = pnew < gelev.power() ? pnew : gelev.power();
463  */
464  this->sdepth.scaletopower(pnew);
465  this->gelev.scaletopower(pnew);
466  DATRW_assert((this->sdepth.scale==this->gelev.scale),
467  "ERROR: inconsistent coordinate scaling");
468  } // void Coordinates::equalizescaling()
datrw::su::options::SpatialSampling Mcontrol
control parameters
Definition: sucomanager.h:223
#define DATRW_assert(C, M)
Check an assertion and report by throwing an exception.
Definition: error.h:92
ScalCoo gy
receiver y coordinate
Definition: sucomanager.h:217
ScalCoo sx
source x coordinate
Definition: sucomanager.h:211
short scale
scale like scalco
Definition: sucomanager.h:169
short scalco
preferred scalco value
Definition: suformat.h:131
ScalCoo gx
receiver x coordinate
Definition: sucomanager.h:215
ScalCoo gelev
source y coordinate
Definition: sucomanager.h:221
ScalCoo sdepth
source z coordinate
Definition: sucomanager.h:219
int smallestpower(const short &desiredscale=datrw::su::subformat::def::scalco) const
smallest possible power larger or equal desired
Definition: sucomanager.cc:298
#define DATRW_debug(C, N, M)
produce debug output
Definition: debug.h:50
void scaletopower(const int &p)
scale to given scaling factor as defined by decimal power
Definition: sucomanager.cc:238
ScalCoo sy
source y coordinate
Definition: sucomanager.h:213
Here is the call graph for this function:
Here is the caller graph for this function: