/* ======== IGeoS ===== Distribition full ===== IGeoS ========= ** ** templ2e_pp.C : Created by 'seisweb' on Wed Apr 1 17:31:52 2020 ** ** Product : IGeoS - Integrated Geoscience Software ** ** Description : System for seismic, well log, and potential-field data analysis ** ** =================== Limited License: =================================== ** ** This software is provided free under the following terms and conditions: ** ** 1. Permission to use, copy, and modify this software ** for non-commercial purposes without fee is hereby granted, provided ** that this copyright notice, the warranty disclaimer, and this ** permission notice appear in all copies. ** ** 2. Distribution of this software or any part of it "bundled" in with ** any product is considered to be a 'commercial purpose'. ** ** 3. Any new or adapted code developed to operate as a part of this ** software shall be contributed to the authors and distributed under ** the same license. ** ** ================== Warranty Disclaimer: ================================ ** ** This software is provided "as is", with no support and without ** obligation on the part of the author to assist in its use, correction, ** modification, or enhancement. No guarantees or warranties, ** either express or implied, and regarding the accuracy, safety, or ** fitness for any particular purpose are provided by any contributor ** to this software package. ** ** ======== IGeoS ===== Distribition full ===== IGeoS ========= */ /* ========= S - I - A === S - I - A === S - I - A === S - I - A ========== ** ** templ2e_pp.C: Created by 'seisweb' on Fri Oct 20 19:19:51 2006 ** This file is a part of SIA distribution 'full' ** ** Copyright (c) 1995-2006, Igor Morozov, all rights reserved ** ** =================== Limited License: =================================== ** This software is provided free under the following terms and conditions: ** ** 1. Permission to use, copy, and modify this software ** for non-commercial purposes without fee is hereby granted, provided ** that this copyright notice, the warranty disclaimer, and this ** permission notice appear in all copies. ** ** 2. Distribution of this software or any part of it "bundled" in with ** any product is considered to be a 'commercial purpose'. ** ** 3. Any new or adapted code developed to operate as a part of this ** software shall be contributed to the authors and distributed under ** the same license. ** ** ================== Warranty Disclaimer: ================================ ** This software is provided "as is", with no support and without ** obligation on the part of the author to assist in its use, correction, ** modification, or enhancement. No guarantees or warranties, ** either express or implied, and regarding the accuracy, safety, or ** fitness for any particular purpose are provided by any contributor ** to this software package. ** ** ========= S - I - A ========== S - I - A ========== S - I - A ========== */ //#define DEBUG #include "sia_module.C.h" #include "templ2e.h" void TEMPL2E::proc( TRACE *t ) { // example of checking, for example, that DAATKEY is 3 for this trace: if ( round_int(datakey.value(t)) == 3 ) SIA_message("DATAKEY equals %f", datakey.value(t) ); // example of detecting that the trace is 2D (ny must be > 1, nz=1 ): if ( t->ny() < 2 || t->record_depth() > 1 ) { // print a warning and let the trace continue on its path down the tool flow SIA_err(SIA_ignore,"Not a 2D trace (ny %d, depth %d); passed without processing.", t->ny(), t->record_depth() ); return; } // Now, consider the trace as a 2D grid; obtain grid parameters: int nx = t->nx(); // the leading dimension int ny = t->ny(); // the second dimension double dx = t->dx(); // grid spacing along axis X double dy = t->dy(); // grid spacing along axis Y // class POINT is often useful to manipulate 2D (x,y) coordinates: POINT grid_increment(t->dx(),t->dy()); // grid increments in X,Y POINT grid_origin(t->x0(),t->y0()); // grid origin double par1 = param1.value(t); // this obtains parameter value from t /*--- typical loop through 2D trace record: (summing all values in 'sum' -----*/ double sum = 0.0; for ( int iy=0; iy < ny; iy++ ) { DATA_SAMPLE *d = t->data_start(iy); // pointer to the trace column #'iy' for ( int ix=0; ix < nx; ix++ ) { sum += d[ix]; } } // example of outputting a value into the trace header: out_header.set_value(t,sum); // output the 'sum' value into trace header } boolean TEMPL2E::proc( ENSEMBLE *e ) { /*-- go through all trace pairs and measure cross-correlations */ for ( TRACE *t1 = e->first_trace; t1; t1 = t1->next ) for ( TRACE *t2 = t1->next; t2; t2 = t2->next ) { proc(t1); // examples of hypothetical processing operations on the individual traces proc(t2); // ...... and so on } /*--- process phase functions return Boolean values ----------*/ return OK; // OK means the trace has been processed and passed to the output // FAIL (FALSE) would mean "wait for more input data" } /*========================================================================== Process phase - called every time the system tries to produce an output (e.g., when there is a trace in the input gather) ==========================================================================*/ boolean TEMPL2E::process() { GATHER *input = SIA.input(); // input trace ensemble gather if ( !input->num_ensembles ) // no input, wait for more return FAIL; /*----- wait for a closed ensemble -------------------------------*/ if ( final_eof() ) // no more inputs expected input->first_ensemble->close(FALSE); else if ( !input->first_ensemble->closed() ) // not end-of-ensemble flag yet return FAIL; /*-- at this point, we have a complete ensemble at input; pass it to the output and process there ----------------------*/ ENSEMBLE *e = input->pass_ensemble(SIA.output()); return e ? proc(e) : FAIL; }