#include #include #include #include #include #include "pntsrc_appx.hh" #include "MPS_includes.hh" const char * sdoc[] = { "Usage: pntsrc_appx.x CWPROOT= src= wavelet= appx_ord= dervx= dervz=", " nt= ot= dt= sx= sz=", " nx= nz= ox= oz= dx= dz=", " ", "Required parameters:", " CWPROOT = path to SU root directory", " src = filename for output source traces", " wavelet = filename for input source wavelet (single trace)", " appx_ord = desired approximation order of point source", " dervx = number of x-derivatives", " dervz = number of z-derivatives", " nt = number of time samples in wavelet", " ot = time of first sample in wavelet (ms)", " dt = time step size of wavelet (ms)", " sx,sz = source coordinates (m)", " nx = number of grid points in model (x-axis)", " nz = number of grid points in model (z-axis)", " ox = x coord of first grid point in model (m)", " oz = z coord of first grid point in model (m)", " dx = x coord grid size (m)", " dz = z coord grid size (m)", NULL}; using TSOpt::pntsrc_weight; using RVL::valparse; int xargc; char **xargv; //----------------------------------------------------------------------------------- int main(int argc, char ** argv) { //----------------------------------------------------------------------------------- try { /* //Testing pntsrc_weight// float h = 2.0; float alpha =0.2; for( int s=0; s<=1; s++){ for( int p=1; p<=4; p++){ cerr << "(p,s)=("<(*par,"CWPROOT"); //wavelet information std::string wavelet = valparse(*par,"wavelet"); //int nt = valparse (*par,"nt"); //float ot = valparse(*par,"ot"); float dt = valparse(*par,"dt"); dt*=1e-3; //convert to sec. float sx = valparse(*par,"sx"); float sz = valparse(*par,"sz"); //model information float ox = valparse(*par,"ox"); float oz = valparse(*par,"oz"); float dx = valparse(*par,"dx"); float dz = valparse(*par,"dz"); int nx = valparse (*par,"nx"); int nz = valparse (*par,"nz"); //taking precautions for negative z-coord if( oz<0 ) oz *= -1; if( sz<0 ) sz *= -1; //parameters std::string src = valparse(*par,"src"); int appx_ord = valparse(*par,"appx_ord"); int dervx = valparse(*par,"dervx"); int dervz = valparse(*par,"dervz"); /* // extract time step from source wavelet, convert unit from mus to s FILE * fp = fopen(src.c_str(),"r"); segy tr; fgettr(fp,&tr); // dt in ms float dt = tr.dt*1.e-3; */ //set up paths to SU commands std::string suplane = cwp + "/bin/suplane"; std::string sushw = cwp + "/bin/sushw"; std::string suconv = cwp + "/bin/suconv"; std::string sugain = cwp + "/bin/sugain"; //finding mdl grid point index closest to src point int jx = (int)((sx-ox)/dx); int jz = (int)((sz-oz)/dz); float ax = (sx-ox-jx*dx)/dx; float az = (sz-oz-jz*dz)/dz; cerr << "(jx,jz) = ("<nx ){ RVLException e; e << "ERROR from pntsrc_appx.x: source x-coord is out of bounds!"; e << " sx="<nz ){ RVLException e; e << "ERROR from pntsrc_appx.x: source z-coord is out of bounds!"; e << " sz="<>"<< src <<";"; //cmd << suconv <<" sufile="<< wavelet <<" >>"<< src <<";"; cerr << "pt(ix="<