Commit 00e10cb5 authored by laura.gassner's avatar laura.gassner

added an option to use individual tracekill and time-windowing files for each workflow stage

parent 907334d7
This diff is collapsed.
1
1
1
1
1
1
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1 1 0 1 1
1 1 0 1 1
1 1 0 1 1
1 0 1 1 0
1 0 1 1 0
1 0 1 0 0
1 0 1 0 0
1 0 1 0 1
0 0 1 0 1
0 0 1 1 1
0 1 1 1 1
0 1 0 1 1
0 1 0 1 1
0 1 0 1 1
0 1 0 1 1
......@@ -26,7 +26,7 @@ double calc_energy(float **sectiondata, int ntr, int ns, float energy, int ntr_g
/* declaration of variables */
extern float DT;
extern int MYID;
extern int MYID, USE_WORKFLOW, WORKFLOW_STAGE;
extern int TRKILL, NORMALIZE, FC, TIMEWIN;
extern char TRKILL_FILE[STRING_SIZE];
extern int VELOCITY;
......@@ -55,10 +55,24 @@ if(TRKILL==1){
kill_tmp = imatrix(1,ntr_glob,1,nsrc_glob);
kill_vector = ivector(1,ntr);
ftracekill=fopen(TRKILL_FILE,"r");
if (ftracekill==NULL) err(" Trace kill file could not be opened!");
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]);
......
......@@ -26,7 +26,7 @@ double calc_misfit(float **sectiondata, float **section, int ntr, int ns, int LN
/* declaration of variables */
extern float DT;
extern int MYID;
extern int MYID, USE_WORKFLOW, WORKFLOW_STAGE;
extern int TRKILL, NORMALIZE, FC, TIMEWIN;
extern char TRKILL_FILE[STRING_SIZE];
extern int VELOCITY;
......@@ -54,11 +54,25 @@ FILE *ftracekill;
if(TRKILL){
kill_tmp = imatrix(1,ntr_glob,1,nsrc_glob);
kill_vector = ivector(1,ntr);
ftracekill=fopen(TRKILL_FILE,"r");
if (ftracekill==NULL) err(" Trace kill file could not be opened!");
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]);
......
......@@ -29,7 +29,7 @@ extern float DT, WATERLEVEL_LNORM8;
extern int REC1, REC2, MYID, ACOUSTIC;
extern int TRKILL, NORMALIZE, FC, TIMEWIN;
extern char TRKILL_FILE[STRING_SIZE];
extern int VELOCITY;
extern int VELOCITY, USE_WORKFLOW, WORKFLOW_STAGE;
float RMS, signL1, intseis;
int Lcount,i,j,invtime,k,h, umax=0;
float l2;
......@@ -67,11 +67,25 @@ if(TRKILL==1){
kill_tmp = imatrix(1,ntr_glob,1,nsrc_glob);
kill_vector = ivector(1,ntr);
ftracekill=fopen(TRKILL_FILE,"r");
if (ftracekill==NULL) err(" Trace kill file could not be opened!");
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]);
......
......@@ -25,6 +25,7 @@
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;
......@@ -38,9 +39,23 @@ FILE *ftracekill;
kill_tmp = imatrix(1,ntr_glob,1,nsrc_glob);
kill_vector = ivector(1,ntr);
ftracekill=fopen(TRKILL_FILE,"r");
if (ftracekill==NULL) err(" Trace kill file could not be opened!");
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++){
......
......@@ -987,52 +987,52 @@ void read_par_json(FILE *fp, char *fileinp){
}
/* trace kill file */
if (TRKILL == 1)
{
if (access(TRKILL_FILE,0) != 0)
{
fprintf(fp, "\n==================================================================\n");
fprintf(fp, " ERROR parsing input file <%s>:\n", fileinp);
fprintf(fp, " The trace kill file does not exist!\n");
fprintf(fp, " File name: <%s>", TRKILL_FILE);
fprintf(fp, "\n==================================================================\n");
fserr = 1;
}
else if (access(TRKILL_FILE,4) != 0)
{
fprintf(fp, "\n==================================================================\n");
fprintf(fp, " ERROR parsing input file <%s>:\n", fileinp);
fprintf(fp, " The trace kill file does not have read access!\n");
fprintf(fp, " File name: <%s>", TRKILL_FILE);
fprintf(fp, "\n==================================================================\n");
fserr = 1;
}
}
/* trace kill STF file */
if (TRKILL_STF == 1)
{
if (access(TRKILL_FILE_STF,0) != 0)
{
fprintf(fp, "\n==================================================================\n");
fprintf(fp, " ERROR parsing input file <%s>:\n", fileinp);
fprintf(fp, " The trace kill file does not exist!\n");
fprintf(fp, " File name: <%s>", TRKILL_FILE_STF);
fprintf(fp, "\n==================================================================\n");
fserr = 1;
}
else if (access(TRKILL_FILE_STF,4) != 0)
{
fprintf(fp, "\n==================================================================\n");
fprintf(fp, " ERROR parsing input file <%s>:\n", fileinp);
fprintf(fp, " The trace kill file does not have read access!\n");
fprintf(fp, " File name: <%s>", TRKILL_FILE_STF);
fprintf(fp, "\n==================================================================\n");
fserr = 1;
}
}
// /* trace kill file */
// if (TRKILL == 1)
// {
// if (access(TRKILL_FILE,0) != 0)
// {
// fprintf(fp, "\n==================================================================\n");
// fprintf(fp, " ERROR parsing input file <%s>:\n", fileinp);
// fprintf(fp, " The trace kill file does not exist!\n");
// fprintf(fp, " File name: <%s>", TRKILL_FILE);
// fprintf(fp, "\n==================================================================\n");
// fserr = 1;
// }
// else if (access(TRKILL_FILE,4) != 0)
// {
// fprintf(fp, "\n==================================================================\n");
// fprintf(fp, " ERROR parsing input file <%s>:\n", fileinp);
// fprintf(fp, " The trace kill file does not have read access!\n");
// fprintf(fp, " File name: <%s>", TRKILL_FILE);
// fprintf(fp, "\n==================================================================\n");
// fserr = 1;
// }
// }
//
//
// /* trace kill STF file */
// if (TRKILL_STF == 1)
// {
// if (access(TRKILL_FILE_STF,0) != 0)
// {
// fprintf(fp, "\n==================================================================\n");
// fprintf(fp, " ERROR parsing input file <%s>:\n", fileinp);
// fprintf(fp, " The trace kill file does not exist!\n");
// fprintf(fp, " File name: <%s>", TRKILL_FILE_STF);
// fprintf(fp, "\n==================================================================\n");
// fserr = 1;
// }
// else if (access(TRKILL_FILE_STF,4) != 0)
// {
// fprintf(fp, "\n==================================================================\n");
// fprintf(fp, " ERROR parsing input file <%s>:\n", fileinp);
// fprintf(fp, " The trace kill file does not have read access!\n");
// fprintf(fp, " File name: <%s>", TRKILL_FILE_STF);
// fprintf(fp, "\n==================================================================\n");
// fserr = 1;
// }
// }
/* frequency file */
......
......@@ -32,7 +32,7 @@ int ntr_glob,int ntr, float ** srcpos, int ishot, int ns, int iter, int nshots,
extern float DT, DH;
extern int SEIS_FORMAT, MYID, NT, QUELLART, TIME_FILT, TIMEWIN, TAPER_STF;
extern char SEIS_FILE_VY[STRING_SIZE], SEIS_FILE_P[STRING_SIZE], PARA[STRING_SIZE], DATA_DIR[STRING_SIZE];
extern int TRKILL_STF, NORMALIZE;
extern int TRKILL_STF, NORMALIZE, USE_WORKFLOW, WORKFLOW_STAGE;
extern char TRKILL_FILE_STF[STRING_SIZE];
extern char SIGNAL_FILE[STRING_SIZE];
......@@ -64,9 +64,23 @@ int ntr_glob,int ntr, float ** srcpos, int ishot, int ns, int iter, int nshots,
kill_tmp = imatrix(1,ntr_glob,1,nshots);
kill_vector = ivector(1,ntr_glob);
ftracekill=fopen(TRKILL_FILE_STF,"r");
if (ftracekill==NULL) err(" Trace kill file could not be opened!");
if(USE_WORKFLOW){
sprintf(trace_kill_file,"%s_%i.dat",TRKILL_FILE_STF,WORKFLOW_STAGE);
ftracekill=fopen(trace_kill_file,"r");
if (ftracekill==NULL){
sprintf(trace_kill_file,"%s.dat",TRKILL_FILE_STF);
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_STF);
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<=nshots;j++){
......
......@@ -28,7 +28,7 @@ void time_window(float **sectiondata, int iter, int ntr_glob, int **recpos_loc,
/* declaration of variables */
extern float DT;
extern float GAMMA, TWLENGTH_PLUS, TWLENGTH_MINUS;
extern int TW_IND;
extern int TW_IND, USE_WORKFLOW, WORKFLOW_STAGE;
extern char PICKS_FILE[STRING_SIZE];
char pickfile_char[STRING_SIZE];
float time, dump, dump1, dump2, dump3, taper, taper1;
......@@ -47,14 +47,25 @@ void time_window(float **sectiondata, int iter, int ntr_glob, int **recpos_loc,
pick_tmp = vector(1,ntr_glob);
}
sprintf(pickfile_char,"%s_%i.dat",PICKS_FILE,ishot);
fptime=fopen(pickfile_char,"r");
if (fptime == NULL) {
err(" picks_?.dat could not be opened !");
/* read picked first arrival times */
if(USE_WORKFLOW){
sprintf(pickfile_char,"%s_%i_%i.dat",PICKS_FILE,ishot,WORKFLOW_STAGE);
fptime=fopen(pickfile_char,"r");
if (fptime == NULL) {
sprintf(pickfile_char,"%s_%i.dat",PICKS_FILE,ishot);
fptime=fopen(pickfile_char,"r");
if (fptime == NULL) {
err(" picks_?.dat could not be opened !");
}
}
}else{
sprintf(pickfile_char,"%s_%i.dat",PICKS_FILE,ishot);
fptime=fopen(pickfile_char,"r");
if (fptime == NULL) {
err(" picks_?.dat could not be opened !");
}
}
if(TW_IND){
for(i=1;i<=ntr_glob;i++){
fscanf(fptime,"%f%f%f",&dump,&dump2,&dump3);
......
......@@ -28,7 +28,7 @@ void time_window_glob(float **sectiondata, int iter, int ntr_glob, int ns, int i
/* declaration of variables */
extern float DT;
extern float GAMMA, TWLENGTH_PLUS, TWLENGTH_MINUS;
extern int TW_IND;
extern int TW_IND, USE_WORKFLOW, WORKFLOW_STAGE;
extern char PICKS_FILE[STRING_SIZE];
char pickfile_char[STRING_SIZE];
float time, dump, dump1, dump2, dump3, taper, taper1;
......@@ -45,12 +45,23 @@ void time_window_glob(float **sectiondata, int iter, int ntr_glob, int ns, int i
picked_times = vector(1,ntr_glob);
/* read picked first arrival times */
sprintf(pickfile_char,"%s_%i.dat",PICKS_FILE,ishot);
fptime=fopen(pickfile_char,"r");
if (fptime == NULL) {
err(" picks_?.dat could not be opened !");
}
if(USE_WORKFLOW){
sprintf(pickfile_char,"%s_%i_%i.dat",PICKS_FILE,ishot,WORKFLOW_STAGE);
fptime=fopen(pickfile_char,"r");
if (fptime == NULL) {
sprintf(pickfile_char,"%s_%i.dat",PICKS_FILE,ishot);
fptime=fopen(pickfile_char,"r");
if (fptime == NULL) {
err(" picks_?.dat could not be opened !");
}
}
}else{
sprintf(pickfile_char,"%s_%i.dat",PICKS_FILE,ishot);
fptime=fopen(pickfile_char,"r");
if (fptime == NULL) {
err(" picks_?.dat could not be opened !");
}
}
if(TW_IND){
for(i=1;i<=ntr_glob;i++){
......
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