diff --git a/fdelmodc/getParameters.c b/fdelmodc/getParameters.c index edf157883b26f007055e567fec5225bc541c9747..d882ba97c05a56c85c4314bc10ba87480ddcdb25 100644 --- a/fdelmodc/getParameters.c +++ b/fdelmodc/getParameters.c @@ -283,7 +283,7 @@ int getParameters(modPar *mod, recPar *rec, snaPar *sna, wavPar *wav, srcPar *sr /* Check stability and dispersion setting */ - if (cp_max > dx*stabfactor/dt) { + if (cp_max > (dx*stabfactor)/dt) { vwarn("************ ! Stability ! ****************"); vwarn("From the input file maximum P-wave velocity"); vwarn("in the current model is %f !!", cp_max); diff --git a/fdelmodc/getWaveletInfo.c b/fdelmodc/getWaveletInfo.c index 2f3734aae6c38e54653fab909ec5e936a157d8ce..efeee9b4e9bfb8904f0b403f2881c6e0f4ed96ba 100644 --- a/fdelmodc/getWaveletInfo.c +++ b/fdelmodc/getWaveletInfo.c @@ -41,7 +41,7 @@ int getWaveletInfo(char *file_src, int *n1, int *n2, float *d1, float *d2, float off_t bytes; int ret, one_shot, ntraces; int optn, nfreq, i, iwmax; - float *trace; + float *trace, df; float ampl, amplmax, tampl, tamplmax; complex *ctrace; segy hdr; @@ -73,8 +73,9 @@ int getWaveletInfo(char *file_src, int *n1, int *n2, float *d1, float *d2, float /* check to find out number of traces in shot gather */ - optn = optncr(*n1); + optn = optncr(*n1); nfreq = optn/2 + 1; + df = 1.0/(optn*(*d1)); ctrace = (complex *)malloc(nfreq*sizeof(complex)); one_shot = 1; trace = (float *)malloc(optn*sizeof(float)); @@ -107,12 +108,13 @@ int getWaveletInfo(char *file_src, int *n1, int *n2, float *d1, float *d2, float iwmax = i; } } + /* from the maximum amplitude position look for the largest frequency * which has an amplitude 400 times weaker than the maximum amplitude */ for (i=iwmax;i<nfreq;i++) { ampl = sqrt(ctrace[i].r*ctrace[i].r+ctrace[i].i*ctrace[i].i); if (400*ampl < amplmax) { - *fmax = (i-1)*(1.0/(optn*(*d1))); + *fmax = (i-1)*df; break; } }