#include #include #include #include #include #include const char * sdoc[] = { "Usage: planewave.x CWPROOT= src= pwhdr= pwsrc= ", " nt= ot= nx= dx= ox= zs= zr=", " nts= ots= nxs= dxs= oxs=", " np= dp= op=", " ", "Purpose: create a pair of (a) SU data file with zero samples and ", "correct trace headers for plane wave modeling output, and (b) SU data", "file with source traces for plane wave modeling input", "and corresponding headers, for use in 2D synthetic plane wave studies", "", "Notes:", "", "1.This utility delegates to SU commands, hence depends on proper", "installation of SU. In particular, CWPROOT must be defined in the", "execution environment and point to the SU root directory. CWPROOT", "passed as parameter in order to work in the brain-dead environment", "created by Flow", "", "2. suconv creates a minimal time axis of the source traces, based on", "min and max slowness, pivot position for impulse plane waves,", "horizontal extent of the source array, and the length of the", "source wavelet.", "", "3. Time step (dt) for output files is that of input file (source pulse)", "", "4. TO DO: add option for taking receiver positions from file, to", "permit nonuniform trace spacing", "", "5. TO DO; 3D-ize", "", "Required parameters:", " CWPROOT = path to SU root directory", " src = filename for source wavelet or pulse (single trace)", " pwhdr = filename for multiple plane wave data file (zero samples) [OUTPUT]", " pwsrc = filename for multiple plane wave source file = impulse pw traces ", " convolved with src [OUTPUT]", " nt = number of time samples in pwhdr traces", " ot = time of first sample in pwhdr traces (ms)", " nx = number of traces in each pwhdr gather", " dx = x increment between traces in pwhdr gather (m)", " ox = x coord of first trace in pwhdr gather (m)", " zr = depth of receiver points (pwhdr)", " zs = depth of source points (pwsrc)", " nxs = number of traces in each pwsrc gather", " dxs = x increment between traces in pwsrc gather (m) (must be > 0)", " oxs = x coord of first trace in pwsrc gather (m)", " np = number of plane waves = number of pwhdr, pwsrc gathers", " dp = slowness increment between plane waves (ms/m)", " op = slowness of first gather (ms/m)", NULL}; using RVL::RVLException; using RVL::valparse; using RVL::ProtectedDivision; int xargc; char **xargv; int main(int argc, char ** argv) { try { xargc=argc; xargv=argv; requestdoc(1); PARARRAY * par = ps_new(); if ( ps_createargs(par, argc - 1, argv + 1) ) { printf("Error parsing input data. ABORT.\n"); exit(1); } ps_printall(*par,stderr); // test for presence of SU std::string cwp = valparse(*par,"CWPROOT"); int nt = valparse(*par,"nt"); int nx = valparse(*par,"nx"); int nxs = valparse(*par,"nxs"); int np = valparse(*par,"np"); float ot = valparse(*par,"ot"); float ox = valparse(*par,"ox"); float oxs = valparse(*par,"oxs"); float op = valparse(*par,"op"); float zs = valparse(*par,"zs"); float zr = valparse(*par,"zr"); float dx = valparse(*par,"dx"); float dxs = valparse(*par,"dxs"); if (!(dxs>0)) { RVLException e; e<<"Error: planewave\n"; e<<" source trace spacing (dxs) must be > 0\n"; throw e; } float dp = valparse(*par,"dp"); // extract time step from source wavelet, convert unit from mus to s std::string src = valparse(*par,"src"); FILE * fp = fopen(src.c_str(),"r"); segy tr; fgettr(fp,&tr); // dt in ms float dt = tr.dt*1.e-3; // note: dp = ms/m, so ms/trace needed by suplane (dip1) is dp*dxs // compute time axis for impulse response float pmin = iwave_min(op,op+(np-1)*dp); float pmax = iwave_max(op,op+(np-1)*dp); // min time of plane wave with slope pmin float ptmin = pmin*dxs*nxs/2; float ptmax = pmax*dxs*nxs/2; float tmin = iwave_min(ptmin,iwave_min(-ptmin,iwave_min(ptmax,-ptmax))); float tmax = iwave_max(ptmin,iwave_max(-ptmin,iwave_max(ptmax,-ptmax))); cerr<<"dt="<(*par,"pwsrc"); std::string pwhdr = valparse(*par,"pwhdr"); // preclean string cln = "/bin/rm -f " + pwsrc + " " + pwhdr + ";"; system(cln.c_str()); // loop over plane waves // note need to convert from ms to s in sunull, suplane commands for (int ip=0; ip> " << pwhdr <<";"; cerr << "ip="<> " << pwsrc <<";"; cerr << "ip="<