📄 ktmig.c,v
字号:
if (!getparfloat("tpow", &tpow)) tpow = -1.; if (!getparfloat("tpowaf", &tpowaf)) tpowaf = 0.; itgain = 0; if (tpow != 0. || tpowaf != 0.) itgain = 1; if (!getparint("ifact", &ifact)) ifact = 1; if (!getparfloat("apers", &apers)) apers = fabs(ns * ds) / 4.; if (!getparfloat("aperl", &aperl)) aperl = fabs(nl * dl) / 4.; if (!getparfloat("rmsmar", &rmsmar)) rmsmar = 50.; getparstring("badtracefile", &badtracefile); if ((btfp = fopen(badtracefile, "r")) != NULL) { efclose(btfp); btfp = efopen(badtracefile, "a"); } else { btfp = efopen(badtracefile, "w"); } if (getparfloat("send", &send) && getparfloat("lend", &lend) && getparint("ntrend", &ntrend)) { if (ntrend < 1) err("ntrend must be greater than 0 "); nsout = ntrend; nlout = 1; } else { ntrend = 0; nsout = ns; nlout = nl; } if (!getparint("ntrdsk", &ntrdsk)) ntrdsk = 0; ndskwt = 0; if (!getparint("ncpu", &ncpu)) ncpu = 1; envs = (char *) emalloc(80 * sizeof(char)); if (!getenv("PARALLEL")) { sprintf(envs, "%s=%d", "PARALLEL", ncpu); putenv(envs); } if (!getparint("traceout", &traceout)) traceout = 1; if (!getparint("on2trace", &on2trace)) on2trace = 0; ikey = 0; if (getparstring("tracekey", &tracekey) && getparstring("linekey", &linekey)) { ikey = 1; trktype = hdtype(tracekey); lnktype = hdtype(linekey); indxtrk = getindex(tracekey); indxlnk = getindex(linekey); if (!getparfloat("tr1", &tr1)) err(" tr1 missing"); if (!getparfloat("tr2", &tr2)) err(" tr2 missing"); if (!getparfloat("tr3", &tr3)) err(" tr3 missing"); if (!getparfloat("ln1", &ln1)) err(" ln1 missing"); if (!getparfloat("ln2", &ln2)) err(" ln2 missing"); if (!getparfloat("ln3", &ln3)) err(" ln3 missing"); if (!getparint("strace", &strace)) strace = 0; if (!getparint("jthtrace", &jthtrace)) jthtrace = 1; if (!getparint("sline", &sline)) sline = 0; if (!getparint("jthline", &jthline)) jthline = 1; if (!getparint("mintrace", &mintrace)) mintrace = -2000000000; if (!getparint("maxtrace", &maxtrace)) maxtrace = 2000000000; if (!getparint("minline", &minline)) minline = -2000000000; if (!getparint("maxline", &maxline)) maxline = 2000000000; } /* read id headers */ fgethdr(infp, &ch, &bh); /* read in first trace for nt and dt */ if (!fgettr(infp, &tra)) err("can't get first trace"); nt = tra.ns; dt = (float) tra.dt / 1000000.; t0 = (float) tra.delrt / 1000; ntotal = tra.tracl; ntl = nt * ifact; dtl = dt / ifact; tminl = t0; dldt = dtl / dt; /* get velociry grid header info */ velfp = efopen(velfile, "r"); fseek2g(velfp, 0, 1); ierr = fgetghdr(velfp, &gh); if (ierr == 0) fromghdr(&gh, &scale, &dtype, &n1, &n2, &n3, &n4, &n5, &d1, &d2, &d3, &d4, &d5, &o1, &o2, &o3, &o4, &o5, &dcdp2, &dline3, &ocdp2, &oline3, &gmin, &gmax, &orient, >ype); if (gmin == 0. && ierr == 0) warn(" gmin=0 from velocity header file"); if (gmin == 0.) { if (!getparfloat("vmin", &gmin)) err(" vmin must be specified"); } /* optional parameters */ if (!getparint("ntv", &ntv)) { if (ierr == 0) { ntv = n1; } else { err("Must specify ntv "); } } if (!getparfloat("dtv", &dtv)) { if (ierr == 0) { dtv = d1; } else { err("Must specify dtv "); } } if (!getparfloat("t0v", &t0v)) { if (ierr == 0) { t0v = o1; } else { err("Must specify t0v "); } } if (!getparint("nsv", &nsv)) { if (ierr == 0) { nsv = n2; } else { err("Must specify nsv "); } } if (!getparfloat("dsv", &dsv)) { if (ierr == 0) { dsv = d2; } else { err("Must specify dsv "); } } if (!getparfloat("s0v", &s0v)) { if (ierr == 0) { s0v = o2; } else { err("Must specify s0v "); } } if (!getparint("nlv", &nlv)) { if (ierr == 0) { nlv = n3; } else { err("Must specify nlv "); } } if (!getparfloat("dlv", &dlv)) { if (ierr == 0) { dlv = d3; } else { err("Must specify dlv "); } } if (!getparfloat("l0v", &l0v)) { if (ierr == 0) { l0v = o3; } else { err("Must specify l0v "); } } if (dlv == 0.) dlv = dl; if (dsv == 0.) dsv = ds; if (!getparint("ntau", &ntau)) ntau = nt; if (!getparfloat("dtau", &dtau)) { dtau = dt; } else { dtau = dtau * 0.001; } if (!getparfloat("tau0", &tau0)) { tau0 = 0.; } else { tau0 = tau0 * 0.001; } if (!getparfloat("oofo", &ofomin)) ofomin = 0.; if (!getparfloat("dofo", &dofo)) dofo = 999999.; if (!getparfloat("obtol", &obtol)) obtol = 0.5 * dofo; if (!getparint("nofo", &nofo)) nofo = 1; itmp = countparname("ofo"); if (itmp > 0 && itmp != nofo) err("number of ofo not match with nofo"); ofo = (float *) emalloc(nofo * sizeof(float)); if (itmp > 0) { getparfloat("ofo", ofo); if (nofo > 1) { ofol = ofo[0] - 0.5 * (ofo[1] - ofo[0]); ofor = ofo[nofo - 1] + 0.5 * (ofo[nofo - 1] - ofo[nofo - 2]); } else { ofol = ofo[0] - 0.5 * dofo; ofor = ofo[nofo - 1] + 0.5 * dofo; ofomin = ofo[0]; } } else { for (io = 0; io < nofo; io++) ofo[io] = ofomin + io * dofo; } iofoin = itmp; if (!getparfloat("f0", &f0)) f0 = 10.; if (!getparfloat("df", &df)) df = 10.; if (!getparint("nf", &nf)) nf = 7; if (!getparfloat("ftaper", &ftaper)) ftaper = 5.; /* compute maximum wavenumbers to be used in migration */ if (!getparfloat("ksmax", &ksmax)) { if (ncdppl > 1) { ksmax = 0.5 / dds; } else { ksmax = 0.5 / 0.001; } } if (!getparfloat("klmax", &klmax)) { if (nlines > 1) { klmax = 0.5 / ddl; } else { klmax = 0.5 / 0.001; } } if (!getparint("tapecntl", &tapecntl)) tapecntl = 0; nsave = ((ntl * 3 / 2) / 2) * 2; radix_(&nsave, &nfft); nsave = nfft * 2 + 30; /* update id headers and write to output */ bh.hns = ntau; bh.hdt = dtau * 1000000; if (traceout == 1) fputhdr(outfp, &ch, &bh); if (!getparint("mlimit", &tmp_mlimit)) tmp_mlimit = 256; mlimit = tmp_mlimit; mlimit *= 1024 * 1024; getparstring("diskhdr", &diskhdr); getparstring("diskimg", &diskimg); getparstring("diskfld", &diskfld); if (getparstring("hisfile", &hisfile)) ihis = 1; if (!getparstring("jpfile", &jpfile)) { jpfp = stderr; } else { jpfp = efopen(jpfile, "w"); } if (!getparint("isave", &isave)) isave = 0; ibacki = 0; if (getparstring("backupi", &backupi)) { ibacki = 1; fprintf(jpfp, " Backup from the previous run "); fprintf(jpfp, " Backup %s , %s and %s from %s \n", diskimg, diskhdr, diskfld, backupi); tar3fr(backupi, diskimg, diskhdr, diskfld); } ibacko = 0; if (getparstring("backupo", &backupo)) ibacko = 1; if (ibacko == 1) isave = 1; fprintf(jpfp, "\n"); fprintf(jpfp, " -------- KTMIG PRINTOUT -------- \n"); fprintf(jpfp, "\n"); /* detect starting trace of migration */ jtrace = 0; if ((hffp = fopen(hisfile, "r")) != NULL) { fclose(hffp); hffp = efopen(hisfile, "r+"); buf = (char *) malloc(81 * sizeof(char)); do { bzero(buf, 81); if (fgets(buf, 81, hffp) == NULL) break; if (strncmp(buf, "Number of Traces Processed: ", 28) == 0) { sscanf(buf + 28, "%d %d", &ntrpre, &jtrace); } } while (feof(hffp) == 0); free(buf); fprintf(jpfp, " From history file: \n"); fprintf(jpfp, "Number of Traces Processed: %d\n", ntrpre);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -