/* ---------------------------------------------------------------------- */ 
/* StandardSegyDefs.h                                                     */ 
/* ---------------------------------------------------------------------- */ 
/*                                                                        */ 
/* (c) Copyright 2002, 2005  EdgeTech,                                    */ 
/*                                                                        */ 
/* This file contains proprietary information, and trade secrets of       */ 
/* EdgeTech, and may not be disclosed or reproduced without the prior     */ 
/* written consent of EdgeTech.                                           */ 
/*                                                                        */ 
/* EdgeTech is not responsible for the consequences of the use or misuse  */ 
/* of this software, even if they result from defects in it.              */ 
/*                                                                        */ 
/* Standard SEG-Y file format.                                            */ 
/* ---------------------------------------------------------------------- */ 

#ifndef STANDARDSEGYDEFS_H__

#define STANDARDSEGYDEFS_H__


/* ---------------------------------------------------------------------- */ 
/* This file contains the EdgeTech header for writing standard SEG-Y      */ 
/* files.  Those fields relevant to sonar data collection are filled with */ 
/* the most reasonable available value.  Most fields are left blank or    */ 
/* set to zero.  For detailed information see SEG-Y rev 1 Data Exchange   */ 
/* format, release 1.0 available from the Society of Exploration          */ 
/* Geophysicist.                                                          */ 
/* ---------------------------------------------------------------------- */ 

/* ---------------------------------------------------------------------- */ 
/* A SEG-Y format file consists of a single text header of 3200 bytes,    */ 
/* this is followed by a single 400 byte binary header.  Next comes a     */ 
/* succession of 240 byte trace header / sonar data packets.              */ 
/* ---------------------------------------------------------------------- */ 

/* ---------------------------------------------------------------------- */ 
/* SEG-Y Text (ASCII / EBCDIC) header                                     */ 
/* ---------------------------------------------------------------------- */ 

typedef struct
{
  unsigned char   textHeader[40][80];

}  SegyTextHeaderType;


/* ---------------------------------------------------------------------- */ 
/* SEG-Y binary header                                                    */ 
/* ---------------------------------------------------------------------- */ 

typedef struct
{ /*  Offset   : Description                                              */ 
  /*   0 -   3 : job identification number                Unused set to 0 */ 
  long   jobNum;

  /*   4 -   7 : line number                              always set to 1 */ 
  long   lineNum;

  /*   8 -  11 : reel number                              always set to 1 */ 
  long   reelNum;

  /*  13 -  14 : number of data traces                    always set to 1 */ 
  short  tracesPerRecord;

  /*  14 -  15 : number of auxillary data traces          Unused set to 0 */ 
  short  auxTracesPerRecord;

  /*  16 -  17 : sample interval in microseconds                          */ 
  /*             set to current value, may change at later traces         */ 
  short  sampleIntervalus;

  /*  18 -  19 : sample interval in mircroseconds                         */ 
  /*             set to current value, may change at later traces         */ 
  short  sampleIntervalusOriginal;

  /*  20 -  21 : number of samples per trace                              */ 
  /*             set to current value, may change at later traces         */ 
  short  samplesPerTrace;

  /*  22 -  23 : number of samples per trace                              */ 
  /*             set to current value, may change at later traces         */ 
  short  samplesPerTraceOriginal;

  /*  24 -  25 : data sample format code                                  */ 
  /*             1 - 4 byte IBM floating point values , 5 - 4 byte IEEE   */ 
  /*             floating point values                                    */ 
  short  format;

  /*  26 -  27 : ensemble fold                            always set to 1 */ 
  short  cpdFold;

  /*  28 -  29 : trace sorting code                       always set to 1 */ 
  short  traceSortCode;

  /*  30 -  31 : vertical sum code                        always set to 1 */ 
  short  verticalSumCode;

  /*  32 -  33 : sweep frequency at start in Hertz                        */ 
  /*             set to current value, may change at later traces         */ 
  short  sweepFreq0;

  /*  34 -  35 : sweep frequency at end in Hertz                          */ 
  /*             set to current value, may change at later traces         */ 
  short  sweepFreq1;

  /*  36 -  37 : sweep length in milliseconds                             */ 
  /*             set to current value, may change at later traces         */ 
  short  sweepLengthms;

  /*  38 -  39 : sweep type code  1 - linear              always set to 1 */ 
  short  sweepType;

  /*  40 -  41 : trace number of sweep channel            Unused set to 0 */ 
  short  traceNumofSweep;

  /*  42 -  43 : sweep trace taper length in milliseconds Unused set to 0 */ 
  short  sweepTaperStart;

  /*  44 -  45 : sweep trace taper length in milliseconds Unused set to 0 */ 
  short  sweepTaperEnd;

  /*  46 -  47 : taper type                               Unused set to 0 */ 
  short  taperCode;

  /*  48 -  49 : correlated data traces                   Unused set to 0 */ 
  short  correlated;

  /*  50 -  51 : binary gain recovered                    Unused set to 0 */ 
  short  binaryGainRecovered;

  /*  52 -  53 : amplitude recovery method                Unused set to 0 */ 
  short  amplitudeMethod;

  /*  54 -  55 : measurement system  1 - meters           always set to 1 */ 
  short  measurementSystem;

  /*  56 -  57 : impulse signal polarity                  Unused set to 0 */ 
  short  impulsePolarity;

  /*  58 -  59 : vibratory polarity code                  Unused set to 0 */ 
  short  vibPolarCode;

  /*  60 - 399 : unassigned                                      set to 0 */ 
  char   unassigned[340];

} SegyBinaryHeaderType;


/* ---------------------------------------------------------------------- */ 
/* SEG-Y trace header                                                     */ 
/* ---------------------------------------------------------------------- */ 

typedef struct
{ /*  Offset   : Description                                              */ 

  /*   0 -   3 : trace sequence within line                               */ 
  long   lineSeq;

  /*   4 -   7 : trace sequence within file                               */ 
  long   reelSeq;

  /*   8 -  11 : original field record number or trigger number           */ 
  long   event_number;

  /*  12 -  15 : trace channel number within the original field record    */ 
  long   channel_number;

  /*  16 -  19 : energy source point number               Unused set to 0 */ 
  long   energySourcePt;

  /*  20 -  23 : ensemble number                          Unused set to 0 */ 
  long   cdpEns;

  /*  24 -  27 : trace number within ensemble             Unused set to 0 */ 
  long   traceInEnsemble;

  /*  28 -  29 : Trace identification code: seismic data = 1              */ 
  short  traceID;

  /*  30 -  31 : number of vertically summed traces       always set to 1 */ 
  short  vertSum;

  /*  32 -  33 : number of horizontally stacked traces    always set to 1 */ 
  short  horSum;

  /*  34 -  35 : data use                                 always set to 1 */ 
  short  dataUse;

  /*  36 -  39 : distance from center source to receiver  Unused set to 0 */ 
  long   sourceToRecDist;

  /*  40 -  43 : receiver group elevation                 Unused set to 0 */ 
  long   recElevation;

  /*  44 -  47 : source surface elevation                 Unused set to 0 */ 
  long   sourceSurfaceElevation;

  /*  48 -  51 : source depth below surface               Unused set to 0 */ 
  long   sourceDepth;

  /*  52 -  55 : datum elevation at receiver              Unused set to 0 */ 
  long   datumElevRec;

  /*  56 -  59 : datum elevation at source                Unused set to 0 */ 
  long   datumElevSource;

  /*  60 -  63 : water depth at source                    Unused set to 0 */ 
  long   sourceWaterDepth;

  /*  64 -  67 : water depth at group                     Unused set to 0 */ 
  long   recWaterDepth;

  /*  68 -  69 : Elevation Scaler:  + multiplier, - divider               */ 
  short  elevationScale;

  /*  70 -  71 : Coordinate Scaler: + multiplier, - divider               */ 
  short  coordScale;

  /*  72 -  75 : longitude or X                                           */ 
  long   sourceLongOrX;

  /*  76 -  79 : latitude  or Y                                           */ 
  long   sourceLatOrY;

  /*  80 -  83 : longitude or X                                           */ 
  long   recLongOrX;

  /*  84 -  87 : latitude  or Y                                           */ 
  long   recLatOrY;

  /*  88 -  89 : Coordinate Units:  = 2 seconds of arc, 1 meters          */ 
  short  coordUnits;

  /*  90 -  91 : weathering velocity                      Unused set to 0 */ 
  short  weatheringVelocity;

  /*  92 -  93 : subweathering velocity                   Unused set to 0 */ 
  short  subWeatheringVelocity;

  /*  94 -  95 : uphole time at source                    Unused set to 0 */ 
  short  sourceUpholeTime;

  /*  96 -  97 : uphole time at group                     Unused set to 0 */ 
  short  recUpholeTime;

  /*  98 -  99 : source static correction                 Unused set to 0 */ 
  short  sourceStaticCor;

  /* 100 - 101 : receiver static correction               Unused set to 0 */ 
  short  recStaticCor;

  /* 102 - 103 : total static correction                  Unused set to 0 */ 
  short  totalStatic;

  /* 104 - 105 : lag time A                               Unused set to 0 */ 
  short  lagTimeA;

  /* 106 - 107 : lag time B                               Unused set to 0 */ 
  short  lagTimeB;

  /* 108 - 109 : delay recording time in ms                               */ 
  short  delay;

  /* 110 - 111 : mute time start in ms                    Unused set to 0 */ 
  short  muteStart;

  /* 112 - 113 : mute time end in ms                      Unused set to 0 */ 
  short  muteEnd;

  /* 114 - 115 : Number of samples in this trace (unless == 32767)        */ 
  short  sampleLength;

  /* 116 - 117 : Sampling interval in microseconds (unless == 1)          */ 
  short  deltaSample;

  /* 118 - 119 : Gain Type: 1 = Fixed Gain                                */ 
  short  gainType;

  /* 120 - 121 : instrument gain constant                                 */ 
  short  gainConst; 

  /* 122 - 123 : instrument initial gain                  Unused set to 0 */ 
  short  initialGain;

  /* 124 - 125 : correlated  1 - no                       always set to 1 */ 
  short  correlated;

  /* 126 - 127 : sweep frequency at start                                 */ 
  short  sweepStart;

  /* 128 - 129 : sweep frequency at end                                   */ 
  short  sweepEnd;

  /* 130 - 131 : sweep length in milliseconds                             */ 
  short  sweepLength;

  /* 132 - 133 : sweep type  1 - linear                   always set to 1 */ 
  short  sweepType;

  /* 134 - 135 : sweep trace taper length at start        Unused set to 0 */ 
  short  sweepTaperAtStart;

  /* 136 - 137 : sweep trace taper length at end          Unused set to 0 */ 
  short  sweepTaperAtEnd;

  /* 138 - 139 : taper type                               Unused set to 0 */ 
  short  taperType;

  /* 140 - 141 : alias filter frequency in Hz                             */ 
  short  aliasFreq;

  /* 142 - 143 : alias filter slope   dB / octave         Unused set to 0 */ 
  short  aliasSlope;

  /* 144 - 145 : notch filter frequency in Hz             Unused set to 0 */ 
  short  notchFreq;

  /* 146 - 147 : notch filter slope   dB / octave         Unused set to 0 */ 
  short  notchSlope;

  /* 148 - 149 : low cut frequency in Hz                  Unused set to 0 */ 
  short  lowCutFreq;

  /* 150 - 151 : high cut frequency in Hz                 Unused set to 0 */ 
  short  hiCutFreq;

  /* 152 - 153 : low cut slope  dB / octave               Unused set to 0 */ 
  short  lowCutSlope;

  /* 154 - 155 : high cut slope  dB / octave              Unused set to 0 */ 
  short  hiCutSlope;

  /* 156 - 157 : year data recorded                                       */ 
  short  year;

  /* 158 - 158 : day of year (julian day)                                 */ 
  short  day;

  /* 160 - 161 : hour of day (24 hour clock)                              */ 
  short  hour;

  /* 162 - 163 : minute of hour                                           */ 
  short  minute;

  /* 164 - 165 : second of minute                                         */ 
  short  second;

  /* 166 - 167 : Time basis code: 4 = UTC                                 */ 
  short  timeBasisCode;

  /* 168 - 169 : trace weighting factor                   Unused set to 0 */ 
  short  traceWeightingFactor;

  /* 170 - 171 : geophone group number of roll switch 1   Unused set to 0 */ 
  short  phoneRollPos1;

  /* 172 - 173 : geophone group number of trace 1         Unused set to 0 */ 
  short  phoneFirstTrace;

  /* 174 - 175 : geophone group number of last trace      Unused set to 0 */ 
  short  phoneLastTrace;

  /* 176 - 177 : gap size                                 Unused set to 0 */ 
  short  gapSize;

  /* 178 - 179 : over travel with taper                   Unused set to 0 */ 
  short  taperOvertravel;

  /* 180 - 183 : X coordinate of ensemble position        Unused set to 0 */ 
  long   ensembleX;

  /* 184 - 187 : Y coordinate of ensemble position        Unused set to 0 */ 
  long   ensembleY;

  /* 188 - 191 : in-line number                           Unused set to 0 */ 
  long   inLineNumber;

  /* 192 - 195 : cross-line number                        Unused set to 0 */ 
  long   crossLineNumber;

  /* 196 - 199 : shotpoint number                         Unused set to 0 */ 
  long   shotpointNumber;

  /* 200 - 201 : shotpoint scaler, + multiplier,- divider Unused set to 0 */ 
  short  shotpointScaler;

  /* 202 - 203 : trace value measurement untis            Unused set to 0 */ 
  short  traceValueUnits;

  /* 204 - 207 : transduction constant mantissa           Unused set to 0 */ 
  long   transductionConstantMantissa;

  /* 208 - 209 : transduction constant exponent           Unused set to 0 */ 
  short  transductionConstantExponent;

  /* 210 - 211 : transduction units                       Unused set to 0 */ 
  short  transductionUnits;

  /* 212 - 213 : device/trace identifier                  Unused set to 0 */ 
  short  deviceTraceId;

  /* 214 - 215 : trace time scaler,+ multiplier,- divider Unused set to 0 */ 
  short  traceTimeScaler;

  /* 216 - 217 : source type/orientation                  Unused set to 0 */ 
  short  sourceTypeOrientation;

  /* 216 - 217 : source energy direction                  Unused set to 0 */ 
  char   sourceEnergyDirection[6];

  /* 224 - 227 : source measurement mantissa              Unused set to 0 */ 
  long   sourceMeasurementMantissa;

  /* 228 - 229 : source measurement exponent              Unused set to 0 */ 
  short  sourceMeasurementExponent;

  /* 230 - 231 : source measurement units                 Unused set to 0 */ 
  short  sourceMeasurementUnits;

  /* 232 - 239 : unassigned, for optional information                     */ 

  /* 232 - 233 : mark number                                              */ 
  short  markNumber;

  /* 234 - 239 : unassigned area                                 set to 0 */  
  char   unassigned[6];

} SegyStandardType;


/* ---------------------------------------------------------------------- */ 
/* end of segy trace header                                               */ 
/* ---------------------------------------------------------------------- */ 


#endif  /* STANDARDSEGYDEFS_H__ */ 


/* ---------------------------------------------------------------------- */ 
/*                        end StandardSegyDefs.cpp                        */ 
/* ---------------------------------------------------------------------- */ 


