Commit c7172e61 authored by Florian Wittkamp's avatar Florian Wittkamp

Automatic offset based tracekill

parent ba1116d6
......@@ -736,6 +736,10 @@ If you use the option "Workflow" (section \ref{sec:workflow}) it is possible to
"Trace killing" : "comment",
"TRKILL" : "0",
"TRKILL_FILE" : "./trace_kill/trace_kill",
"TRKILL_OFFSET" : "0",
"TRKILL_OFFSET_LOWER" : "20",
"TRKILL_OFFSET_UPPER" : "100",
\end{verbatim}}}
{\color{red}{\begin{verbatim}
......@@ -747,6 +751,7 @@ If you don't want to use single traces or a subset of your data, the parameter T
If you use the option "Workflow" (section \ref{sec:workflow}) it is possible to define separate files for each workflow stage. They have to be named TRKILL\_FILE\_<workflowstage>.dat. If you don't provide separate files for some or all stages the standard file (TRKILL\_FILE.dat) is used. This means a standard file should exist in any case.
Moreover, you can directly define a offset range that should be killed. Simply set TRKILL\_OFFSET and TRKILL to one and all traces with a offset between TRKILL\_OFFSET\_LOWER and TRKILL\_OFFSET\_UPPER will be killed.
\section{Gradient manipulation}
\subsection{Definition of a gradient taper}
......
This diff is collapsed.
......@@ -162,6 +162,7 @@ IFOS2D= \
prepare_update_p.c \
readmod_viscac.c \
time_window_glob.c \
create_trkill_table.c \
filter_frequencies.c
SNAPMERGE_OBJ = $(SNAPMERGE_SCR:%.c=%.o)
......
......@@ -2,139 +2,163 @@
* Copyright (C) 2016 For the list of authors, see file AUTHORS.
*
* This file is part of IFOS.
*
*
* IFOS is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, version 2.0 of the License only.
*
*
* IFOS is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with IFOS. See file COPYING and/or <http://www.gnu.org/licenses/gpl-2.0.html>.
-----------------------------------------------------------------------------------------*/
-----------------------------------------------------------------------------------------*/
/*------------------------------------------------------------------------
* Calculate energy of measured data
* Calculate energy of measured data
* last update 22/03/11, L. Rehor
* ----------------------------------------------------------------------*/
#include "fd.h"
double calc_energy(float **sectiondata, int ntr, int ns, float energy, int ntr_glob, int **recpos_loc, int nsrc_glob, int ishot, int iter){
/* declaration of variables */
extern float DT;
extern int MYID, USE_WORKFLOW, WORKFLOW_STAGE;
extern int TRKILL, NORMALIZE, FC, TIMEWIN;
extern char TRKILL_FILE[STRING_SIZE];
extern int VELOCITY;
int i, j;
float energy_dummy, intseis;
int umax=0, h;
float intseis_sd;
float **intseis_sectiondata=NULL;
float *picked_times=NULL;
intseis_sectiondata = matrix(1,ntr,1,ns); /* declaration of variables for integration */
if(TIMEWIN) picked_times = vector(1,ntr); /* declaration of variables for TIMEWIN */
/*extern int MYID;*/
/*printf("MYID: %d; ns=%d\n",MYID,ns);
printf("MYID: %d; ntr=%d\n",MYID,ntr);*/
/* TRACE KILLING */
int ** kill_tmp, *kill_vector; /* declaration of variables for trace killing */
char trace_kill_file[STRING_SIZE];
FILE *ftracekill;
if(TRKILL==1){
kill_tmp = imatrix(1,ntr_glob,1,nsrc_glob);
kill_vector = ivector(1,ntr);
if(USE_WORKFLOW){
sprintf(trace_kill_file,"%s_%i.dat",TRKILL_FILE,WORKFLOW_STAGE);
ftracekill=fopen(trace_kill_file,"r");
if (ftracekill==NULL){
sprintf(trace_kill_file,"%s.dat",TRKILL_FILE);
ftracekill=fopen(trace_kill_file,"r");
if (ftracekill==NULL){
err(" Trace kill file could not be opened!");
double calc_energy(float **sectiondata, int ntr, int ns, float energy, int ntr_glob, int **recpos_loc, int nsrc_glob, int ishot, int iter, float ** srcpos, int ** recpos){
/* declaration of variables */
extern float DT;
extern int MYID, USE_WORKFLOW, WORKFLOW_STAGE;
extern int TRKILL, NORMALIZE, FC, TIMEWIN;
extern char TRKILL_FILE[STRING_SIZE];
extern int VELOCITY;
int i, j;
float energy_dummy, intseis;
int umax=0, h;
float intseis_sd;
float **intseis_sectiondata=NULL;
float *picked_times=NULL;
intseis_sectiondata = matrix(1,ntr,1,ns); /* declaration of variables for integration */
if(TIMEWIN) picked_times = vector(1,ntr); /* declaration of variables for TIMEWIN */
/*extern int MYID;*/
/*printf("MYID: %d; ns=%d\n",MYID,ns);
printf("MYID: %d; ntr=%d\n",MYID,ntr);*/
/* TRACE KILLING */
int ** kill_tmp, *kill_vector; /* declaration of variables for trace killing */
char trace_kill_file[STRING_SIZE];
FILE *ftracekill;
extern int TRKILL_OFFSET;
extern float TRKILL_OFFSET_LOWER;
extern float TRKILL_OFFSET_UPPER;
/*-----------------*/
/* Start Tracekill */
/*-----------------*/
if(TRKILL){
kill_tmp = imatrix(1,ntr_glob,1,nsrc_glob);
kill_vector = ivector(1,ntr);
if(TRKILL_OFFSET) {
if(MYID==0) {
printf("Automatic offset based TraceKill: Experimental feature");
}
/* Generate TraceKill file on the fly */
create_trkill_table(kill_tmp,ntr_glob,recpos,nsrc_glob,srcpos,ishot,TRKILL_OFFSET_LOWER,TRKILL_OFFSET_UPPER);
} else {
/* READ TraceKill file from disk */
if(USE_WORKFLOW){
sprintf(trace_kill_file,"%s_%i.dat",TRKILL_FILE,WORKFLOW_STAGE);
ftracekill=fopen(trace_kill_file,"r");
if (ftracekill==NULL){
sprintf(trace_kill_file,"%s.dat",TRKILL_FILE);
ftracekill=fopen(trace_kill_file,"r");
if (ftracekill==NULL){
err(" Trace kill file could not be opened!");
}
}
}else{
sprintf(trace_kill_file,"%s.dat",TRKILL_FILE);
ftracekill=fopen(trace_kill_file,"r");
if (ftracekill==NULL){
err(" Trace kill file could not be opened!");
}
}
for(i=1;i<=ntr_glob;i++){
for(j=1;j<=nsrc_glob;j++){
fscanf(ftracekill,"%d",&kill_tmp[i][j]);
}
}
fclose(ftracekill);
}
}else{
sprintf(trace_kill_file,"%s.dat",TRKILL_FILE);
ftracekill=fopen(trace_kill_file,"r");
if (ftracekill==NULL){
err(" Trace kill file could not be opened!");
/* Generate local kill vector */
h=1;
for(i=1;i<=ntr;i++){
kill_vector[h] = kill_tmp[recpos_loc[3][i]][ishot];
h++;
}
}
/*---------------*/
/* End Tracekill */
/*---------------*/
for(i=1;i<=ntr_glob;i++){
for(j=1;j<=nsrc_glob;j++){
fscanf(ftracekill,"%d",&kill_tmp[i][j]);
}
}
fclose(ftracekill);
h=1;
for(i=1;i<=ntr;i++){
kill_vector[h] = kill_tmp[recpos_loc[3][i]][ishot];
h++;
}
} /* end if(TRKILL)*/
/* Integration of measured data */
for(i=1;i<=ntr;i++){
intseis_sd=0;
if (VELOCITY==0){ /* only integtration if displacement seismograms are inverted */
for(j=1;j<=ns;j++){
intseis_sd += sectiondata[i][j];
intseis_sectiondata[i][j]=intseis_sd*DT;
}
}
else{
for(j=1;j<=ns;j++){
intseis_sectiondata[i][j]=sectiondata[i][j];
}
}
}
/* TIME WINDOWING */
if(TIMEWIN==1) time_window(intseis_sectiondata, iter, ntr_glob,recpos_loc, ntr, ns, ishot);
/* NORMALIZE TRACES */
if(NORMALIZE==1) normalize_data(intseis_sectiondata,ntr,ns);
/* calculate energy of measured data */
for(i=1;i<=ntr;i++){
if((TRKILL==1)&&(kill_vector[i]==1))
continue;
for(j=1;j<=ns;j++){
energy += intseis_sectiondata[i][j]*intseis_sectiondata[i][j];
}
}
energy_dummy=energy;
/* printf("\n MYID = %i IN CALC_ENERGY: energy = %10.12f \n",MYID,energy); */
/* free memory for integrated seismogram */
free_matrix(intseis_sectiondata,1,ntr,1,ns);
/* free memory for time windowing and trace killing */
if(TIMEWIN==1) free_vector(picked_times,1,ntr);
if(TRKILL==1){
free_imatrix(kill_tmp,1,ntr_glob,1,nsrc_glob);
free_ivector(kill_vector,1,ntr);}
return energy_dummy;
/* Integration of measured data */
for(i=1;i<=ntr;i++){
intseis_sd=0;
if (VELOCITY==0){ /* only integtration if displacement seismograms are inverted */
for(j=1;j<=ns;j++){
intseis_sd += sectiondata[i][j];
intseis_sectiondata[i][j]=intseis_sd*DT;
}
}
else{
for(j=1;j<=ns;j++){
intseis_sectiondata[i][j]=sectiondata[i][j];
}
}
}
/* TIME WINDOWING */
if(TIMEWIN==1) time_window(intseis_sectiondata, iter, ntr_glob,recpos_loc, ntr, ns, ishot);
/* NORMALIZE TRACES */
if(NORMALIZE==1) normalize_data(intseis_sectiondata,ntr,ns);
/* calculate energy of measured data */
for(i=1;i<=ntr;i++){
if((TRKILL==1)&&(kill_vector[i]==1))
continue;
for(j=1;j<=ns;j++){
energy += intseis_sectiondata[i][j]*intseis_sectiondata[i][j];
}
}
energy_dummy=energy;
/* printf("\n MYID = %i IN CALC_ENERGY: energy = %10.12f \n",MYID,energy); */
/* free memory for integrated seismogram */
free_matrix(intseis_sectiondata,1,ntr,1,ns);
/* free memory for time windowing and trace killing */
if(TIMEWIN==1) free_vector(picked_times,1,ntr);
if(TRKILL==1){
free_imatrix(kill_tmp,1,ntr_glob,1,nsrc_glob);
free_ivector(kill_vector,1,ntr);}
return energy_dummy;
} /* end of function */
This diff is collapsed.
This diff is collapsed.
......@@ -2,75 +2,97 @@
* Copyright (C) 2016 For the list of authors, see file AUTHORS.
*
* This file is part of IFOS.
*
*
* IFOS is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, version 2.0 of the License only.
*
*
* IFOS is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with IFOS. See file COPYING and/or <http://www.gnu.org/licenses/gpl-2.0.html>.
-----------------------------------------------------------------------------------------*/
-----------------------------------------------------------------------------------------*/
/*------------------------------------------------------------------------
* Calculate number of killed traces
* Calculate number of killed traces
* last update 11/07/12, L. Groos
* ----------------------------------------------------------------------*/
#include "fd.h"
void count_killed_traces(int ntr, int swstestshot, int ntr_glob, int **recpos_loc, int nsrc_glob, int ishot, int* ptr_killed_traces, int* ptr_killed_traces_testshots){
/* declaration of variables */
extern int USE_WORKFLOW, WORKFLOW_STAGE;
extern char TRKILL_FILE[STRING_SIZE];
int i,j,h;
/* declaration of variables for trace killing */
int ** kill_tmp, *kill_vector;
char trace_kill_file[STRING_SIZE];
FILE *ftracekill;
kill_tmp = imatrix(1,ntr_glob,1,nsrc_glob);
kill_vector = ivector(1,ntr);
if(USE_WORKFLOW){
sprintf(trace_kill_file,"%s_%i.dat",TRKILL_FILE,WORKFLOW_STAGE);
ftracekill=fopen(trace_kill_file,"r");
if (ftracekill==NULL){
void count_killed_traces(int ntr, int swstestshot, int ntr_glob, int **recpos_loc, int nsrc_glob, int ishot, int* ptr_killed_traces, int* ptr_killed_traces_testshots,float ** srcpos, int ** recpos){
/* declaration of variables */
extern int USE_WORKFLOW, WORKFLOW_STAGE;
extern char TRKILL_FILE[STRING_SIZE];
extern int TRKILL_OFFSET;
extern float TRKILL_OFFSET_LOWER;
extern float TRKILL_OFFSET_UPPER;
extern int MYID;
int i,j,h;
/* declaration of variables for trace killing */
int ** kill_tmp, *kill_vector;
char trace_kill_file[STRING_SIZE];
FILE *ftracekill;
kill_tmp = imatrix(1,ntr_glob,1,nsrc_glob);
kill_vector = ivector(1,ntr);
if(TRKILL_OFFSET) {
if(MYID==0) {
printf("Automatic offset based TraceKill: Experimental feature");
}
/* Generate TraceKill file on the fly */
create_trkill_table(kill_tmp,ntr_glob,recpos,nsrc_glob,srcpos,ishot,TRKILL_OFFSET_LOWER,TRKILL_OFFSET_UPPER);
} else {
/* READ TraceKill file from disk */
if(USE_WORKFLOW){
sprintf(trace_kill_file,"%s_%i.dat",TRKILL_FILE,WORKFLOW_STAGE);
ftracekill=fopen(trace_kill_file,"r");
if (ftracekill==NULL){
sprintf(trace_kill_file,"%s.dat",TRKILL_FILE);
ftracekill=fopen(trace_kill_file,"r");
if (ftracekill==NULL){
err(" Trace kill file could not be opened!");
}
}
}else{
sprintf(trace_kill_file,"%s.dat",TRKILL_FILE);
ftracekill=fopen(trace_kill_file,"r");
if (ftracekill==NULL){
err(" Trace kill file could not be opened!");
}
}
}else{
sprintf(trace_kill_file,"%s.dat",TRKILL_FILE);
ftracekill=fopen(trace_kill_file,"r");
if (ftracekill==NULL){
err(" Trace kill file could not be opened!");
for(i=1;i<=ntr_glob;i++){
for(j=1;j<=nsrc_glob;j++){
fscanf(ftracekill,"%d",&kill_tmp[i][j]);
}
}
fclose(ftracekill);
}
for(i=1;i<=ntr_glob;i++){
for(j=1;j<=nsrc_glob;j++){
fscanf(ftracekill,"%d",&kill_tmp[i][j]);
}
}
fclose(ftracekill);
h=1;
for(i=1;i<=ntr;i++){
kill_vector[h] = kill_tmp[recpos_loc[3][i]][ishot];
if (kill_vector[h]==1) *ptr_killed_traces=*ptr_killed_traces+1;
if ((kill_vector[h]==1) && (swstestshot==1)) *ptr_killed_traces_testshots=*ptr_killed_traces_testshots+1;
h++;
}
h=1;
for(i=1;i<=ntr;i++){
kill_vector[h] = kill_tmp[recpos_loc[3][i]][ishot];
if (kill_vector[h]==1) *ptr_killed_traces=*ptr_killed_traces+1;
if ((kill_vector[h]==1) && (swstestshot==1)) *ptr_killed_traces_testshots=*ptr_killed_traces_testshots+1;
h++;
}
}
/*-----------------------------------------------------------------------------------------
* Copyright (C) 2016 For the list of authors, see file AUTHORS.
*
* This file is part of IFOS.
*
* IFOS is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, version 2.0 of the License only.
*
* IFOS is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with IFOS. See file COPYING and/or <http://www.gnu.org/licenses/gpl-2.0.html>.
-----------------------------------------------------------------------------------------*/
#include "fd.h"
void create_trkill_table(int ** killtable, int ntr_glob, int **recpos, int nsrc_glob, float **srcpos, int ishot, float kill_offset_lower, float kill_offset_upper) {
/* Local variables */
int s, r;
float offset=0.0;
/* extern variables */
extern float DH;
extern int MYID;
/*------------------*/
/* clear kill table */
/*------------------*/
for(s=1;s>=nsrc_glob;s++){
for (r=1; r<=ntr_glob; r++) {
killtable[r][s]=0;
}
}
/*---------------------*/
/* Generate Killtable */
/*---------------------*/
for(s=1;s<=nsrc_glob;s++){
for (r=1; r<=ntr_glob; r++) {
/* calculate Offset for current reciever and source */
offset=fabs(sqrt((srcpos[1][s]-recpos[1][r]*DH)*(srcpos[1][s]-recpos[1][r]*DH)+(srcpos[2][s]-recpos[2][r]*DH)*(srcpos[2][s]-recpos[2][r]*DH)));
/* If offset lies inside the bound kill */
if( offset>kill_offset_lower && offset<kill_offset_upper ) {
killtable[r][s]=1;
}
}
}
}
......@@ -86,6 +86,14 @@ void exchange_par(void){
extern int ACOUSTIC;
extern int VERBOSE;
extern int TRKILL_STF_OFFSET;
extern float TRKILL_STF_OFFSET_LOWER;
extern float TRKILL_STF_OFFSET_UPPER;
extern int TRKILL_OFFSET;
extern float TRKILL_OFFSET_LOWER;
extern float TRKILL_OFFSET_UPPER;
// Parameter for inversion of SH waves and joint inversion
extern int WAVETYPE;
extern int SOURCE_SHAPE_SH;
......@@ -209,6 +217,11 @@ void exchange_par(void){
fdum[64]=WOLFE_C1_SL;
fdum[65]=WOLFE_C2_SL;
fdum[66]=TRKILL_STF_OFFSET_LOWER;
fdum[67]=TRKILL_STF_OFFSET_UPPER;
fdum[68]=TRKILL_OFFSET_LOWER;
fdum[69]=TRKILL_OFFSET_UPPER;
/***********/
/* Integer */
/***********/
......@@ -360,6 +373,9 @@ void exchange_par(void){
idum[112]=TAPER_STF;
idum[113]=TW_IND;
idum[114]=TRKILL_OFFSET;
idum[115]=TRKILL_STF_OFFSET;
} /** if (MYID == 0) **/
if (MYID != 0) FL=vector(1,L);
......@@ -484,6 +500,11 @@ void exchange_par(void){
WOLFE_C1_SL=fdum[64];
WOLFE_C2_SL=fdum[65];
TRKILL_STF_OFFSET_LOWER=fdum[66];
TRKILL_STF_OFFSET_UPPER=fdum[67];
TRKILL_OFFSET_LOWER=fdum[68];
TRKILL_OFFSET_UPPER=fdum[69];
/***********/
/* Integer */
/***********/
......@@ -638,6 +659,8 @@ void exchange_par(void){
TAPER_STF=idum[112];
TW_IND=idum[113];
TRKILL_OFFSET=idum[114];
TRKILL_STF_OFFSET=idum[115];
MPI_Bcast(&FL[1],L,MPI_FLOAT,0,MPI_COMM_WORLD);
......
......@@ -21,7 +21,7 @@
#define fsign(x) ((x<0.0)?(-1):1)
#define PI (3.141592653589793)
#define NPAR 119
#define NPAR 120
#define STRING_SIZE 74
#define STRING_SIZE2 256
#define REQUEST_COUNT 4
......@@ -67,15 +67,15 @@ void calc_mat_change(float ** waveconv, float ** waveconv_rho, float ** waveco
void calc_mat_change_test(float ** waveconv, float ** waveconv_rho, float ** waveconv_u, float ** rho, float ** rhonp1, float ** pi, float ** pinp1, float ** u, float ** unp1, int iter,
int epstest, int FORWARD_ONLY, float eps_scale, int itest, int nfstart, float ** u_start, float ** pi_start, float ** rho_start,int wavetype_start,float **bfgsmod,int bfgsnum,int bfgspar,float Vs_avg,float Vp_avg,float rho_avg,int LBFGS_iter_start);
double calc_res(float **sectiondata, float **section, float **sectiondiff, float **sectiondiffold, int ntr, int ns, int LNORM, float L2, int itest, int sws, int swstestshot, int ntr_glob, int **recpos_loc, int nsrc_glob, int ishot, int iter);
double calc_res(float **sectiondata, float **section, float **sectiondiff, float **sectiondiffold, int ntr, int ns, int LNORM, float L2, int itest, int sws, int swstestshot, int ntr_glob, int **recpos_loc, int nsrc_glob, int ishot, int iter, float ** srcpos, int ** recpos);
double calc_misfit(float **sectiondata, float **section, int ntr, int ns, int LNORM, float L2, int itest, int sws, int swstestshot, int ntr_glob, int **recpos_loc, int nsrc_glob, int ishot, int iter);
double calc_misfit(float **sectiondata, float **section, int ntr, int ns, int LNORM, float L2, int itest, int sws, int swstestshot,int ntr_glob, int **recpos_loc, int nsrc_glob, int ishot, int iter, float ** srcpos, int ** recpos);
float calc_opt_step(float * L2t, float ** waveconv, float ** gradp, float * epst, int sws, float C_vp);
float calc_opt_step_test(float * L2t, float ** waveconv, float ** gradp, float * epst, int sws, float C_vp);
double calc_energy(float **sectiondata, int ntr, int ns, float energy, int ntr_glob, int **recpos_loc, int nsrc_glob, int ishot, int iter);
double calc_energy(float **sectiondata, int ntr, int ns, float energy, int ntr_glob, int **recpos_loc, int nsrc_glob, int ishot, int iter, float ** srcpos, int ** recpos);
void checkfd(FILE *fp, float ** prho, float ** ppi, float ** pu, float ** ptaus, float ** ptaup, float * peta, float *hc, float **srcpos, int nsrc, int **recpos, int ntr);
......@@ -94,7 +94,9 @@ void comm_ini(float ** bufferlef_to_rig, float ** bufferrig_to_lef,
void conv_FD(float * temp_TS, float * temp_TS1, float * temp_conv, int ns);
void count_killed_traces(int ntr, int swstestshot, int ntr_glob, int **recpos_loc, int nsrc_glob, int ishot, int* ptr_killed_traces, int* ptr_killed_traces_testsshots);
void count_killed_traces(int ntr, int swstestshot, int ntr_glob, int **recpos_loc, int nsrc_glob, int ishot, int* ptr_killed_traces, int* ptr_killed_traces_testshots,float ** srcpos, int ** recpos);
void create_trkill_table(int ** killtable, int ntr_glob, int **recpos, int nsrc_glob, float **srcpos, int ishot, float kill_offset_lower, float kill_offset_upper);
float exchange_L2(float L2, int sw, int bcast_l2);
......
......@@ -104,10 +104,18 @@ float WOLFE_C2_SL;
int TRKILL;
char TRKILL_FILE[STRING_SIZE];
int TRKILL_OFFSET;
float TRKILL_OFFSET_LOWER;
float TRKILL_OFFSET_UPPER;
/* trace kill STF variables */
int TRKILL_STF;
char TRKILL_FILE_STF[STRING_SIZE];
int TRKILL_STF_OFFSET;
float TRKILL_STF_OFFSET_LOWER;
float TRKILL_STF_OFFSET_UPPER;
int TIMEWIN, NORMALIZE;
float TWLENGTH_PLUS, TWLENGTH_MINUS, GAMMA;
char PICKS_FILE[STRING_SIZE];
......
......@@ -77,9 +77,17 @@ void read_par_json(FILE *fp, char *fileinp){
extern int TRKILL;
extern char TRKILL_FILE[STRING_SIZE];
extern int TRKILL_OFFSET;
extern float TRKILL_OFFSET_LOWER;
extern float TRKILL_OFFSET_UPPER;
extern int TRKILL_STF;
extern char TRKILL_FILE_STF[STRING_SIZE];
extern int TRKILL_STF_OFFSET;
extern float TRKILL_STF_OFFSET_LOWER;
extern float TRKILL_STF_OFFSET_UPPER;
extern int TAPER_STF;
extern int TIMEWIN, NORMALIZE, TW_IND;
......@@ -753,8 +761,18 @@ void read_par_json(FILE *fp, char *fileinp){
fprintf(fp,"Variable TRKILL_STF is set to default value %d.\n",TRKILL_STF);}
else {
if (TRKILL_STF==1) {
if (get_string_from_objectlist("TRKILL_FILE_STF",number_readobjects,TRKILL_FILE_STF,varname_list, value_list))
err("Variable TRKILL_FILE_STF could not be retrieved from the json input file!");
if (get_int_from_objectlist("TRKILL_STF_OFFSET",number_readobjects,&TRKILL_STF_OFFSET,varname_list, value_list)){
TRKILL_STF_OFFSET=0;
if (get_string_from_objectlist("TRKILL_FILE_STF",number_readobjects,TRKILL_FILE_STF,varname_list, value_list))
err("Variable TRKILL_FILE_STF could not be retrieved from the json input file!");
} else {
if (get_float_from_objectlist("TRKILL_STF_OFFSET_LOWER",number_readobjects,&TRKILL_STF_OFFSET_LOWER,varname_list, value_list)){
TRKILL_STF_OFFSET_LOWER=0.0;
}
if (get_float_from_objectlist("TRKILL_STF_OFFSET_UPPER",number_readobjects,&TRKILL_STF_OFFSET_UPPER,varname_list, value_list)){
err("Variable TRKILL_STF_OFFSET_UPPER could not be retrieved from the json input file!");
}
}
}
}
/* Taper STF */
......@@ -837,8 +855,19 @@ void read_par_json(FILE *fp, char *fileinp){
fprintf(fp,"Variable TRKILL is set to default value %d.\n",TRKILL);}
else {
if (TRKILL==1) {
if (get_string_from_objectlist("TRKILL_FILE",number_readobjects,TRKILL_FILE,varname_list, value_list))
err("Variable TRKILL_FILE could not be retrieved from the json input file!");
if (get_int_from_objectlist("TRKILL_OFFSET",number_readobjects,&TRKILL_OFFSET,varname_list, value_list)){
TRKILL_OFFSET=0;
if (get_string_from_objectlist("TRKILL_FILE",number_readobjects,TRKILL_FILE,varname_list, value_list))
err("Variable TRKILL_FILE could not be retrieved from the json input file!");
} else {
if (get_float_from_objectlist("TRKILL_OFFSET_LOWER",number_readobjects,&TRKILL_OFFSET_LOWER,varname_list, value_list)){
TRKILL_OFFSET_LOWER=0.0;
}
if (get_float_from_objectlist("TRKILL_OFFSET_UPPER",number_readobjects,&TRKILL_OFFSET_UPPER,varname_list, value_list)){
err("Variable TRKILL_OFFSET_UPPER could not be retrieved from the json input file!");
}
}
}
}
......
......@@ -45,7 +45,7 @@ int **receiver(FILE *fp, int *ntr){
{
if (READREC){ /* read receiver positions from file */
fprintf(fp,"\n Reading receiver positions from file: \n\t%s\n",REC_FILE);
fpr=fopen(REC_FILE,"r");
fpr=fopen(REC_FILE,"r");
if (fpr==NULL) err(" Receiver file could not be opened !");
*ntr=0;
while ((c=fgetc(fpr)) != EOF)
......@@ -62,7 +62,12 @@ int **receiver(FILE *fp, int *ntr){
fclose(fpr);
fprintf(fp," Message from function receiver (written by PE %d):\n",MYID);/***/
fprintf(fp," Number of receiver positions found: %i\n",*ntr);
/* recpos1[1][itr] X in m
* recpos1[2][itr] Y in m
*
*/
/* check if more than one receiver is located
at the same gridpoint */
for (itr=1;itr<=(*ntr-1);itr++)
......
......@@ -77,6 +77,7 @@ float **sources(int *nsrc){
err("Missing parameter in SOURCE_FILE!");
case 6: srcpos[7][l]=0.0;
case 7: srcpos[8][l]=SOURCE_TYPE;
}
if ((srcpos[8][l]!=4) && (nvarin>6)) {
current_source=(int)srcpos[8][l];
......@@ -94,15 +95,6 @@ float **sources(int *nsrc){
fc=srcpos[5][l];
}
/* fscanf(fpsrc,"%f%f%f%f%f%f",&xsrc, &zs