Commit bad8b773 authored by Florian Wittkamp's avatar Florian Wittkamp

Possibility to invert offset window at STF

With the option TRKILL_STF_OFFSET_INVERT it is possible to invert the sense of the STF Offset window.
So TRKILL_STF_OFFSET_INVERT==1 means, do NOT kill the specified offset, instead kill all other offsets.
parent febe26fe
......@@ -83,6 +83,7 @@ void exchange_par(void){
extern int VERBOSE;
extern int TRKILL_STF_OFFSET;
extern int TRKILL_STF_OFFSET_INVERT;
extern float TRKILL_STF_OFFSET_LOWER;
extern float TRKILL_STF_OFFSET_UPPER;
......@@ -374,6 +375,7 @@ void exchange_par(void){
idum[114]=TRKILL_OFFSET;
idum[115]=TRKILL_STF_OFFSET;
idum[116]=TRKILL_STF_OFFSET_INVERT;
} /** if (MYID == 0) **/
......@@ -660,6 +662,7 @@ void exchange_par(void){
TRKILL_OFFSET=idum[114];
TRKILL_STF_OFFSET=idum[115];
TRKILL_STF_OFFSET_INVERT=idum[116];
MPI_Bcast(&FL[1],L,MPI_FLOAT,0,MPI_COMM_WORLD);
......
......@@ -105,6 +105,7 @@ int TRKILL;
char TRKILL_FILE[STRING_SIZE];
int TRKILL_OFFSET;
int TRKILL_STF_OFFSET_INVERT;
float TRKILL_OFFSET_LOWER;
float TRKILL_OFFSET_UPPER;
......
......@@ -84,6 +84,7 @@ void read_par_json(FILE *fp, char *fileinp){
extern char TRKILL_FILE_STF[STRING_SIZE];
extern int TRKILL_STF_OFFSET;
extern int TRKILL_STF_OFFSET_INVERT;
extern float TRKILL_STF_OFFSET_LOWER;
extern float TRKILL_STF_OFFSET_UPPER;
......@@ -769,6 +770,10 @@ void read_par_json(FILE *fp, char *fileinp){
declare_error("Variable TRKILL_FILE_STF could not be retrieved from the json input file!");
}
if(TRKILL_STF_OFFSET==1) { /* Only Offset based TRKill */
if (get_int_from_objectlist("TRKILL_STF_OFFSET_INVERT",number_readobjects,&TRKILL_STF_OFFSET_INVERT,varname_list, value_list)){
TRKILL_STF_OFFSET_INVERT=0;
}
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;
}
......@@ -777,6 +782,23 @@ void read_par_json(FILE *fp, char *fileinp){
}
}
if(TRKILL_STF_OFFSET==2){ /* Both Offset based TRKill & File */
if (get_int_from_objectlist("TRKILL_STF_OFFSET_INVERT",number_readobjects,&TRKILL_STF_OFFSET_INVERT,varname_list, value_list)){
TRKILL_STF_OFFSET_INVERT=0;
} else {
if(TRKILL_STF_OFFSET_INVERT==1) {
declare_error("Variable TRKILL_STF_OFFSET_INVERT==1 and TRKILL_STF_OFFSET==2 not possible!");
}
}
if (get_int_from_objectlist("TRKILL_STF_OFFSET_INVERT",number_readobjects,&TRKILL_STF_OFFSET_INVERT,varname_list, value_list)){
TRKILL_STF_OFFSET_INVERT=0;
}
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)){
declare_error("Variable TRKILL_STF_OFFSET_UPPER could not be retrieved from the json input file!");
}
if (get_string_from_objectlist("TRKILL_FILE_STF",number_readobjects,TRKILL_FILE_STF,varname_list, value_list))
declare_error("Variable TRKILL_FILE_STF could not be retrieved from the json input file!");
}
......@@ -880,7 +902,13 @@ void read_par_json(FILE *fp, char *fileinp){
declare_error("Variable TRKILL_OFFSET_UPPER could not be retrieved from the json input file!");
}
}
if(TRKILL_STF_OFFSET==2){ /* Both Offset based TRKill & File */
if(TRKILL_OFFSET==2){ /* Both Offset based TRKill & File */
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)){
declare_error("Variable TRKILL_OFFSET_UPPER could not be retrieved from the json input file!");
}
if (get_string_from_objectlist("TRKILL_FILE",number_readobjects,TRKILL_FILE,varname_list, value_list))
declare_error("Variable TRKILL_FILE could not be retrieved from the json input file!");
}
......
......@@ -37,6 +37,7 @@ void stf(FILE *fp, float **sectionvy, float ** sectionvy_obs, float ** sectionvy
extern FILE *FP;
extern int TRKILL_STF_OFFSET;
extern int TRKILL_STF_OFFSET_INVERT;
extern float TRKILL_STF_OFFSET_LOWER;
extern float TRKILL_STF_OFFSET_UPPER;
......@@ -93,6 +94,18 @@ void stf(FILE *fp, float **sectionvy, float ** sectionvy_obs, float ** sectionvy
/* Generate TraceKill file on the fly */
create_trkill_table(kill_tmp,ntr_glob,recpos,nsrc_glob,srcpos,-100,TRKILL_STF_OFFSET_LOWER,TRKILL_STF_OFFSET_UPPER);
if(TRKILL_STF_OFFSET_INVERT) {
for(i=1;i<=nsrc_glob;i++){
for (j=1; j<=ntr_glob; j++) {
if (kill_tmp[j][i]==1) {
kill_tmp[j][i]=0;
} else {
kill_tmp[j][i]=1;
}
}
}
}
} else {
if(USE_WORKFLOW){
sprintf(trace_kill_file,"%s_%i.dat",TRKILL_FILE_STF,WORKFLOW_STAGE);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment