Commit 7e00e724 authored by laura.gassner's avatar laura.gassner

Usage of two time windows for each trace now possible

parent edf295fb
......@@ -740,7 +740,7 @@ To apply time windowing in a time series the paramter TIMEWIN must set to 1. A a
The parameters TWLENGTH\_PLUS and TWLENGTH\_MINUS specify the length of the time window after (PLUS) and before (MINUS) the picked time. The unit is seconds. The damping factor GAMMA must be set individually.
When usig TW\_IND = 1 three columns are expected in PICK\_FILE for each trace with the picked time, time window length plus and time window length minus. In this case TWLENGTH\_PLUS and TWLENGTH\_MINUS are ignored.
When using TW\_IND = 1 three columns are expected in PICK\_FILE for each trace with the picked time (PT), time window length plus (TWLP) and time window length minus (TWLM). In this case TWLENGTH\_PLUS and TWLENGTH\_MINUS are ignored. It is also possible to use two time windows for each trace which can be utilized with TW\_IND = 2. PICK\_FILE must then contain six columns with values for PT\_1, TWLP\_1, TWLM\_1, PT\_2, TWLP\_2 and TWLM\_2 for each trace.
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 PICKS\_FILE\_<sourcenumber>\_<workflowstage>.dat. If you don't provide separate files for some or all stages the standard file (PICKS\_FILE\_<sourcenumber>.dat) is used. This means a standard file should exist in any case.
......
......@@ -944,7 +944,10 @@ void read_par_json(FILE *fp, char *fileinp){
if (TIMEWIN==1){
if (get_int_from_objectlist("TW_IND",number_readobjects,&TW_IND,varname_list, value_list)){
TW_IND=0;
fprintf(fp,"Variable TW_IND is set to default value %d.\n",TW_IND);}
fprintf(fp,"Variable TW_IND is set to default value %d.\n",TW_IND);
} else {
if (TW_IND>2) declare_error("Only TW_IND=1 (one time window) and TW_IND=2 (two time windows) possible");
}
if (get_string_from_objectlist("PICKS_FILE",number_readobjects,PICKS_FILE,varname_list, value_list))
declare_error("Variable PICKS_FILE could not be retrieved from the json input file!");
if (get_float_from_objectlist("TWLENGTH_PLUS",number_readobjects,&TWLENGTH_PLUS,varname_list, value_list))
......
......@@ -17,7 +17,7 @@
-----------------------------------------------------------------------------------------*/
/*------------------------------------------------------------------------
* Apply time VPPML (after Brossier (2009))
* Apply time damping (after Brossier (2009))
* ----------------------------------------------------------------------*/
#include "fd.h"
......@@ -29,17 +29,23 @@ void time_window(float **sectiondata, int iter, int ntr_glob, int **recpos_loc,
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;
float *pick_tmp, **pick_tmp_m;
float time, dumpa, dumpb, dumpc, dumpd;
float dump1, dump2, dump3, dump4, dump5, dump6;
float taper, taper1, taper2, taper3;
float *pick_tmp, **pick_tmp_m, **dummysection=NULL;
int i, j, h;
float *picked_times=NULL, **picked_times_m=NULL;
FILE *fptime;
if(TW_IND){
if(TW_IND==1){
picked_times_m = matrix(1,3,1,ntr_glob);
pick_tmp_m = matrix(1,3,1,ntr_glob);
}else if(TW_IND==2){
picked_times_m = matrix(1,6,1,ntr_glob);
pick_tmp_m = matrix(1,6,1,ntr_glob);
dummysection = matrix(1,ntr,1,ns);
}else{
picked_times = vector(1,ntr_glob);
pick_tmp = vector(1,ntr_glob);
......@@ -64,17 +70,27 @@ void time_window(float **sectiondata, int iter, int ntr_glob, int **recpos_loc,
}
}
if(TW_IND){
if(TW_IND==1){
for(i=1;i<=ntr_glob;i++){
fscanf(fptime,"%f%f%f",&dump,&dump2,&dump3);
pick_tmp_m[1][i] = dump;
fscanf(fptime,"%f%f%f",&dump1,&dump2,&dump3);
pick_tmp_m[1][i] = dump1;
pick_tmp_m[2][i] = dump2;
pick_tmp_m[3][i] = dump3;
}
}else if(TW_IND==2){
for(i=1;i<=ntr_glob;i++){
fscanf(fptime,"%f%f%f%f%f%f",&dump1,&dump2,&dump3,&dump4,&dump5,&dump6);
pick_tmp_m[1][i] = dump1;
pick_tmp_m[2][i] = dump2;
pick_tmp_m[3][i] = dump3;
pick_tmp_m[4][i] = dump4;
pick_tmp_m[5][i] = dump5;
pick_tmp_m[6][i] = dump6;
}
}else{
for(i=1;i<=ntr_glob;i++){
fscanf(fptime,"%f",&dump);
pick_tmp[i] = dump;
fscanf(fptime,"%f",&dump1);
pick_tmp[i] = dump1;
}
}
......@@ -82,12 +98,23 @@ void time_window(float **sectiondata, int iter, int ntr_glob, int **recpos_loc,
/* distribute picks on CPUs */
h=1;
if(TW_IND){
if(TW_IND==1){
for(i=1;i<=ntr;i++){
picked_times_m[1][h] = pick_tmp_m[1][recpos_loc[3][i]];
picked_times_m[2][h] = pick_tmp_m[2][recpos_loc[3][i]];
picked_times_m[3][h] = pick_tmp_m[3][recpos_loc[3][i]];
h++;
}
}else if(TW_IND==2){
for(i=1;i<=ntr;i++){
picked_times_m[1][h] = pick_tmp_m[1][recpos_loc[3][i]];
picked_times_m[2][h] = pick_tmp_m[2][recpos_loc[3][i]];
picked_times_m[3][h] = pick_tmp_m[3][recpos_loc[3][i]];
picked_times_m[4][h] = pick_tmp_m[4][recpos_loc[3][i]];
picked_times_m[5][h] = pick_tmp_m[5][recpos_loc[3][i]];
picked_times_m[6][h] = pick_tmp_m[6][recpos_loc[3][i]];
h++;
}
}else{
......@@ -98,22 +125,24 @@ void time_window(float **sectiondata, int iter, int ntr_glob, int **recpos_loc,
}
}
if(TW_IND)
if(TW_IND==1)
free_matrix(pick_tmp_m,1,3,1,ntr_glob);
else if(TW_IND==2)
free_matrix(pick_tmp_m,1,6,1,ntr_glob);
else
free_vector(pick_tmp,1,ntr_glob);
if(TW_IND){
if(TW_IND==1){
for(i=1;i<=ntr;i++){
for(j=2;j<=ns;j++){
time = (float)(j * DT);
dump = (time-picked_times_m[1][i]-picked_times_m[2][i]);
taper = exp(-GAMMA*dump*dump);
dumpa = (time-picked_times_m[1][i]-picked_times_m[2][i]);
taper = exp(-GAMMA*dumpa*dumpa);
dump1 = (time-picked_times_m[1][i]+picked_times_m[3][i]);
taper1 = exp(-GAMMA*dump1*dump1);
dumpb = (time-picked_times_m[1][i]+picked_times_m[3][i]);
taper1 = exp(-GAMMA*dumpb*dumpb);
if(time>=picked_times_m[1][i]+picked_times_m[2][i]){
sectiondata[i][j] = sectiondata[i][j] * taper;}
......@@ -122,6 +151,41 @@ void time_window(float **sectiondata, int iter, int ntr_glob, int **recpos_loc,
sectiondata[i][j] = sectiondata[i][j] * taper1;}
sectiondata[i][j] = sectiondata[i][j];
}
}
}else if(TW_IND==2){
for(i=1;i<=ntr;i++){
for(j=2;j<=ns;j++){
time = (float)(j * DT);
dumpa = (time-picked_times_m[1][i]-picked_times_m[2][i]);
taper = exp(-GAMMA*dumpa*dumpa);
dumpb = (time-picked_times_m[1][i]+picked_times_m[3][i]);
taper1 = exp(-GAMMA*dumpb*dumpb);
dummysection[i][j] = sectiondata[i][j];
if(time>=picked_times_m[1][i]+picked_times_m[2][i]){
dummysection[i][j] = sectiondata[i][j] * taper;}
if(time<=picked_times_m[1][i]-picked_times_m[3][i]){
dummysection[i][j] = sectiondata[i][j] * taper1;}
dumpc = (time-picked_times_m[4][i]-picked_times_m[5][i]);
taper2 = exp(-GAMMA*dumpc*dumpc);
dumpd = (time-picked_times_m[4][i]+picked_times_m[6][i]);
taper3 = exp(-GAMMA*dumpd*dumpd);
if(time>=picked_times_m[4][i]+picked_times_m[5][i]){
sectiondata[i][j] = sectiondata[i][j] * taper2;}
if(time<=picked_times_m[4][i]-picked_times_m[6][i]){
sectiondata[i][j] = sectiondata[i][j] * taper3;}
sectiondata[i][j] = sectiondata[i][j] + dummysection[i][j];
}
}
......@@ -131,11 +195,11 @@ void time_window(float **sectiondata, int iter, int ntr_glob, int **recpos_loc,
time = (float)(j * DT);
dump = (time-picked_times[i]-TWLENGTH_PLUS);
taper = exp(-GAMMA*dump*dump);
dumpa = (time-picked_times[i]-TWLENGTH_PLUS);
taper = exp(-GAMMA*dumpa*dumpa);
dump1 = (time-picked_times[i]+TWLENGTH_MINUS);
taper1 = exp(-GAMMA*dump1*dump1);
dumpb = (time-picked_times[i]+TWLENGTH_MINUS);
taper1 = exp(-GAMMA*dumpb*dumpb);
if(time>=picked_times[i]+TWLENGTH_PLUS){
sectiondata[i][j] = sectiondata[i][j] * taper;}
......@@ -144,14 +208,17 @@ void time_window(float **sectiondata, int iter, int ntr_glob, int **recpos_loc,
sectiondata[i][j] = sectiondata[i][j] * taper1;}
sectiondata[i][j] = sectiondata[i][j];
}
}
}
if(TW_IND)
if(TW_IND==1){
free_matrix(picked_times_m,1,3,1,ntr_glob);
else
}else if(TW_IND==2){
free_matrix(picked_times_m,1,6,1,ntr_glob);
free_matrix(dummysection,1,ntr,1,ns);
}else{
free_vector(picked_times,1,ntr_glob);
}
} /* end of function time_window.c */
\ No newline at end of file
......@@ -17,9 +17,7 @@
-----------------------------------------------------------------------------------------*/
/*------------------------------------------------------------------------
* Apply time damping (after Brossier (2009))
* last update 31/08/11, D.Koehn
* modified 02/02/12, S.Heider
* Apply time damping (after Brossier (2009)
* ----------------------------------------------------------------------*/
#include "fd.h"
......@@ -31,18 +29,25 @@ void time_window_glob(float **sectiondata, int iter, int ntr_glob, int ns, int i
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;
float time, dumpa, dumpb, dumpc, dumpd;
float dump1, dump2, dump3, dump4, dump5, dump6;
float taper, taper1, taper2, taper3;
int i, j;
float **picked_times_m=NULL;
float *picked_times=NULL;
float **dummysection=NULL;
FILE *fptime;
if(TW_IND)
if(TW_IND==1){
picked_times_m = matrix(1,3,1,ntr_glob);
else
}else if(TW_IND==2){
picked_times_m = matrix(1,6,1,ntr_glob);
dummysection = matrix(1,ntr_glob,1,ns);
}else{
picked_times = vector(1,ntr_glob);
}
/* read picked first arrival times */
if(USE_WORKFLOW){
......@@ -63,33 +68,43 @@ void time_window_glob(float **sectiondata, int iter, int ntr_glob, int ns, int i
}
}
if(TW_IND){
if(TW_IND==1){
for(i=1;i<=ntr_glob;i++){
fscanf(fptime,"%f%f%f",&dump,&dump2,&dump3);
picked_times_m[1][i] = dump;
fscanf(fptime,"%f%f%f",&dump1,&dump2,&dump3);
picked_times_m[1][i] = dump1;
picked_times_m[2][i] = dump2;
picked_times_m[3][i] = dump3;
}
}if(TW_IND==2){
for(i=1;i<=ntr_glob;i++){
fscanf(fptime,"%f%f%f%f%f%f",&dump1,&dump2,&dump3,&dump4,&dump5,&dump6);
picked_times_m[1][i] = dump1;
picked_times_m[2][i] = dump2;
picked_times_m[3][i] = dump3;
picked_times_m[4][i] = dump4;
picked_times_m[5][i] = dump5;
picked_times_m[6][i] = dump6;
}
}else{
for(i=1;i<=ntr_glob;i++){
fscanf(fptime,"%f",&dump);
picked_times[i] = dump;
fscanf(fptime,"%f",&dump1);
picked_times[i] = dump1;
}
}
fclose(fptime);
if(TW_IND){
if(TW_IND==1){
for(i=1;i<=ntr_glob;i++){
for(j=2;j<=ns;j++){
time = (float)(j * DT);
dump = (time-picked_times_m[1][i]-picked_times_m[2][i]);
taper = exp(-GAMMA*dump*dump);
dumpa = (time-picked_times_m[1][i]-picked_times_m[2][i]);
taper = exp(-GAMMA*dumpa*dumpa);
dump1 = (time-picked_times_m[1][i]+picked_times_m[3][i]);
taper1 = exp(-GAMMA*dump1*dump1);
dumpb = (time-picked_times_m[1][i]+picked_times_m[3][i]);
taper1 = exp(-GAMMA*dumpb*dumpb);
if(time>=picked_times_m[1][i]+picked_times_m[2][i]){
sectiondata[i][j] = sectiondata[i][j] * taper;}
......@@ -99,6 +114,42 @@ void time_window_glob(float **sectiondata, int iter, int ntr_glob, int ns, int i
sectiondata[i][j] = sectiondata[i][j];
}
}
}if(TW_IND==2){
for(i=1;i<=ntr_glob;i++){
for(j=2;j<=ns;j++){
time = (float)(j * DT);
dumpa = (time-picked_times_m[1][i]-picked_times_m[2][i]);
taper = exp(-GAMMA*dumpa*dumpa);
dumpb = (time-picked_times_m[1][i]+picked_times_m[3][i]);
taper1 = exp(-GAMMA*dumpb*dumpb);
dummysection[i][j] = sectiondata[i][j];
if(time>=picked_times_m[1][i]+picked_times_m[2][i]){
dummysection[i][j] = sectiondata[i][j] * taper;}
if(time<=picked_times_m[1][i]-picked_times_m[3][i]){
dummysection[i][j] = sectiondata[i][j] * taper1;}
dumpc = (time-picked_times_m[4][i]-picked_times_m[5][i]);
taper2 = exp(-GAMMA*dumpc*dumpc);
dumpd = (time-picked_times_m[4][i]+picked_times_m[6][i]);
taper3 = exp(-GAMMA*dumpd*dumpd);
if(time>=picked_times_m[4][i]+picked_times_m[5][i]){
sectiondata[i][j] = sectiondata[i][j] * taper2;}
if(time<=picked_times_m[4][i]-picked_times_m[6][i]){
sectiondata[i][j] = sectiondata[i][j] * taper3;}
sectiondata[i][j] = sectiondata[i][j] + dummysection[i][j];
}
}
}else{
......@@ -107,11 +158,11 @@ void time_window_glob(float **sectiondata, int iter, int ntr_glob, int ns, int i
time = (float)(j * DT);
dump = (time-picked_times[i]-TWLENGTH_PLUS);
taper = exp(-GAMMA*dump*dump);
dumpa = (time-picked_times[i]-TWLENGTH_PLUS);
taper = exp(-GAMMA*dumpa*dumpa);
dump1 = (time-picked_times[i]+TWLENGTH_MINUS);
taper1 = exp(-GAMMA*dump1*dump1);
dumpb = (time-picked_times[i]+TWLENGTH_MINUS);
taper1 = exp(-GAMMA*dumpb*dumpb);
if(time>=picked_times[i]+TWLENGTH_PLUS){
sectiondata[i][j] = sectiondata[i][j] * taper;}
......@@ -120,14 +171,17 @@ void time_window_glob(float **sectiondata, int iter, int ntr_glob, int ns, int i
sectiondata[i][j] = sectiondata[i][j] * taper1;}
sectiondata[i][j] = sectiondata[i][j];
}
}
}
if(TW_IND)
if(TW_IND==1){
free_matrix(picked_times_m,1,3,1,ntr_glob);
else
}else if(TW_IND==2){
free_matrix(picked_times_m,1,6,1,ntr_glob);
free_matrix(dummysection,1,ntr_glob,1,ns);
}else{
free_vector(picked_times,1,ntr_glob);
}
} /* end of function time_window_glob.c */
\ No newline at end of file
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