├── .gitignore ├── src_sample ├── Makefile ├── velocity.segy └── main.cpp ├── seg_y_rev1.pdf ├── LICENSE ├── README.md └── header └── segy.h /.gitignore: -------------------------------------------------------------------------------- 1 | test 2 | *.out 3 | *.segy -------------------------------------------------------------------------------- /src_sample/Makefile: -------------------------------------------------------------------------------- 1 | all: 2 | g++ main.cpp -std=c++11 -------------------------------------------------------------------------------- /seg_y_rev1.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AmirulOm/segy_cpp/HEAD/seg_y_rev1.pdf -------------------------------------------------------------------------------- /src_sample/velocity.segy: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AmirulOm/segy_cpp/HEAD/src_sample/velocity.segy -------------------------------------------------------------------------------- /src_sample/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "../header/segy.h" 3 | 4 | int main () { 5 | 6 | segy sgy; 7 | sgy.OpenFile("velocity.segy"); 8 | sgy.PrintTextHeader(); 9 | sgy.PrintBinaryHeader(); 10 | sgy.PrintTraceHeader(); 11 | 12 | } -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016 AmirulOm 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # segy_cpp 2 | SEGY API development tool for c++ environment. 3 | 4 | segy.h contains all the standard segy rev 1 structure and classes. segy class can open segy file (little or big endian), It will convert from IBM floating point to IEEE (but not vice versa yet). 5 | 6 | ## Using the Class 7 | ---- 8 | I have include a sample main code on how to use the header. 9 | 10 | ~~~C 11 | #include 12 | #include "../header/segy.h" 13 | 14 | int main () { 15 | segy sgy; 16 | sgy.OpenFile("velocity.segy"); 17 | sgy.PrintTextHeader(); 18 | sgy.PrintBinaryHeader(); 19 | sgy.PrintTraceHeader(); 20 | } 21 | ~~~ 22 | 23 | I have tested with icc and g++. Please refer to Makefile to compile. 24 | 25 | ~~~makefile 26 | g++ main.cpp -std==c++ 27 | ~~~ 28 | 29 | The header file can be copy and to your own code.. 30 | 31 | ## API Reference 32 | ----- 33 | Table below show all the current and future implementation of the segy class. 34 | 35 | Class Function | Description | 36 | --------------------------- | --------------------------------------------------------- | 37 | `segy()` | Constructor | 38 | `~segy()` | Deconstructor | 39 | `void OpenFile(std::string)`| Open segy file and read the data and trace | 40 | `void SaveFile()` | Save into segy file text file (**not implemeted yet**) | 41 | `void CloseFile()` | Close the file stream (**not implemeted yet**) | 42 | `void GetAllTrace()` | return the trace data (**not implemeted yet**) | 43 | `void ReadAllTrace()` | Read all trace to the class (**not implemeted yet**) | 44 | `void SetTrace()` | Set the trace to the class (**not implemeted yet**) | 45 | `void PrintTraceHeader()` | Print outs the Trace Header | 46 | `void PrintTextHeader()` | Print outs the Text Header | 47 | `void PrintBinaryHeader()` | Print outs the Binary Header | 48 | `void ToSu()` | Convert to SU file (**not implemented yet**) | 49 | 50 | 51 | Class Variable | Description | 52 | ----------------------------------- | --------------------------------------------------------------------- | 53 | `unsigned char TFileHead_ [3200]` | Store the beginning Text header file | 54 | `unsigned char ExTFileHead_ [3200]` | Store the Extension Texh Header file (**to be changed to pointer**) | 55 | `binaryFileHeader BFileHead_` | Store the binary file header | 56 | `traceHeader traceHeader_` | Store the Trace header (**to be changed to pointer**) | 57 | `float *Trace_` | Store the trace | 58 | `std::string filename_;` | Store the filename of the segy file | 59 | `std::fstream in_;` | File stream member | 60 | 61 | 62 | Sincerely, 63 | Amirul. 64 | -------------------------------------------------------------------------------- /header/segy.h: -------------------------------------------------------------------------------- 1 | /* segy.h 2 | Author : amirul 3 | mail: amirul.abdullah89@gmail.com 4 | */ 5 | #include 6 | #include 7 | #include 8 | 9 | // #include 10 | #include 11 | 12 | /* 13 | Issue : haven't check which one is unsigned which is not. 14 | */ 15 | struct binaryFileHeader{ 16 | int JOB_ID; 17 | int LINE_NUM; 18 | int REEL_NUM; 19 | short int NUM_OF_TRACE; 20 | short int NUM_OF_AUX; 21 | short int INTERVAL_MS; 22 | short int INTERVAL_MS_ORI; 23 | unsigned short int NUM_OF_SAMPLES; 24 | unsigned short int NUM_OF_SAMPLES_ORI; 25 | short int SAMPLE_FORMAT; 26 | short int ENSEMBLE; 27 | short int TRACE_SORT; 28 | short int VERT_SUM; 29 | short int SWEEP_FREQ_START; 30 | short int SWEEP_FREQ_END; 31 | short int SWEEP_LENGTH; 32 | short int SWEEP_TYPE; 33 | short int SWEEP_NUM_CHANNEL; 34 | short int SWEEP_TAPER_LEN_START; 35 | short int SWEEP_TAPER_LEN_END; 36 | short int TAPER_TYPE; 37 | short int CORRELATED; 38 | short int BINARY_GAIN; 39 | short int AMP_RECOR; 40 | short int MEASURE_SYSTEM; 41 | short int IMPULSE_POLAR; 42 | short int POLAR_CODE; 43 | char UNNASSIGNED1 [240]; 44 | short int SEGY_REV_NUM; 45 | short int FIXED_LEN; 46 | short int NUM_EXT_HEAD; 47 | char UNNASSIGNED2 [94]; 48 | }; 49 | 50 | /* 51 | Issue : haven't check which one is unsigned which is not. 52 | */ 53 | struct traceHeader { 54 | int TRACE_SEQ_GLOBAL; 55 | int TRACE_SEQ_LOCAL; 56 | int ORI_RECORD_NUM; 57 | int TRACE_NUM_FIELD; 58 | int SOURCE_POINT; 59 | int ENSEMBLE_NUM; 60 | int ENS_TRACE_NUM; 61 | short int TRACE_CODE; 62 | short int NUM_VERT_SUM; 63 | short int NUM_HORZ_SUM; 64 | short int DATA_USE; 65 | int DIST_CENT_RECV; 66 | int RECV_GRP_ELEV; 67 | int SURF_ELEV_SRC; 68 | int SOURCE_DEPTH; 69 | int DATUM_ELEV_RECV; 70 | int DATUM_ELAV_SRC; 71 | int WATER_DEPTH_SRC; 72 | int WATER_DEPTH_GRP; 73 | short int SCALE_DEPTH; 74 | short int SCALE_COOR; 75 | int SRC_COOR_X; 76 | int SRC_COOR_Y; 77 | int GRP_COOR_X; 78 | int GRP_COOR_Y; 79 | short int COOR_UNIT; 80 | short int WEATHER_VEL; 81 | short int SWEATHER_VEL; 82 | short int UPHOLE_T_SRC; 83 | short int UPHOLE_T_GRP; 84 | short int SRC_STA_CORRC; 85 | short int GRP_STA_CORRC; 86 | short int TOTAL_STA; 87 | short int LAG_TIME_A; 88 | short int LAG_TIME_B; 89 | short int DELAY_T; 90 | short int MUTE_T_STRT; 91 | short int MUTE_T_END; 92 | unsigned short int NUM_OF_SAMPL; 93 | unsigned short int SAMPLE_INTRVL; 94 | short int GAIN_TYPE; 95 | short int GAIN_CONST; 96 | short int GAIN_INIT; 97 | short int CORRLTD; 98 | short int SWEEP_FREQ_START; 99 | short int SWEEP_FREQ_END; 100 | short int SWEEP_LENGTH; 101 | short int SWEEP_TYPE; 102 | short int SWEEP_TAPER_LEN_START; 103 | short int SWEEP_TAPER_LEN_END; 104 | short int TAPER_TYPE; 105 | short int ALIAS_FREQ; 106 | short int ALIAS_SLOPE; 107 | short int NOTCH_FREQ; 108 | short int NOTCH_SLOPE; 109 | short int LOWCUT_FREQ; 110 | short int HIGHCUT_FREQ; 111 | short int LOWCUT_SLOPE; 112 | short int HIGHCUT_SLOPE; 113 | short int YEAR; 114 | short int DAY; 115 | short int HOUR; 116 | short int MINUTE; 117 | short int SECOND; 118 | short int TIME_CODE; 119 | short int WEIGHT_FACT; 120 | short int GEOPHNE_ROLL; 121 | short int GEOPHNE_TRACE; 122 | short int GEOPHNE_LAST; 123 | short int GAP_SIZE; 124 | short int OVER_TRAVEL; 125 | int ENS_COOR_X; 126 | int ENS_COOR_Y; 127 | int INLINE; 128 | int CROSS; 129 | int SHOOTPOINT; 130 | short int SHOOTPOINT_SCALE; 131 | short int TRACE_UNIT; 132 | char TRANSD_CONST [6]; 133 | short int TRANSD_UNIT; 134 | short int TRACE_IDENT; 135 | short int SCALE_TIME; 136 | short int SRC_ORIENT; 137 | char SRC_DIRECTION [6]; 138 | char SRC_MEASUREMT [6]; 139 | short int SRC_UNIT; 140 | char UNNASSIGNED1 [6]; 141 | }; 142 | 143 | static const unsigned char e2a[256] = { 144 | 0, 1, 2, 3,156, 9,134,127,151,141,142, 11, 12, 13, 14, 15, 145 | 16, 17, 18, 19,157,133, 8,135, 24, 25,146,143, 28, 29, 30, 31, 146 | 128,129,130,131,132, 10, 23, 27,136,137,138,139,140, 5, 6, 7, 147 | 144,145, 22,147,148,149,150, 4,152,153,154,155, 20, 21,158, 26, 148 | 32,160,161,162,163,164,165,166,167,168, 91, 46, 60, 40, 43, 33, 149 | 38,169,170,171,172,173,174,175,176,177, 93, 36, 42, 41, 59, 94, 150 | 45, 47,178,179,180,181,182,183,184,185,124, 44, 37, 95, 62, 63, 151 | 186,187,188,189,190,191,192,193,194, 96, 58, 35, 64, 39, 61, 34, 152 | 195, 97, 98, 99,100,101,102,103,104,105,196,197,198,199,200,201, 153 | 202,106,107,108,109,110,111,112,113,114,203,204,205,206,207,208, 154 | 209,126,115,116,117,118,119,120,121,122,210,211,212,213,214,215, 155 | 216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231, 156 | 123, 65, 66, 67, 68, 69, 70, 71, 72, 73,232,233,234,235,236,237, 157 | 125, 74, 75, 76, 77, 78, 79, 80, 81, 82,238,239,240,241,242,243, 158 | 92,159, 83, 84, 85, 86, 87, 88, 89, 90,244,245,246,247,248,249, 159 | 48, 49, 50, 51, 52, 53, 54, 55, 56, 57,250,251,252,253,254,255 160 | }; 161 | 162 | class segy 163 | { 164 | public: 165 | segy(); 166 | ~segy(); 167 | void OpenFile(std::string); 168 | void SaveFile(); 169 | void CloseFile(); 170 | void GetAllTrace(); 171 | void ReadAllTrace(); 172 | void SetTrace(); 173 | 174 | void PrintTraceHeader(); 175 | void PrintTextHeader(); 176 | void PrintBinaryHeader(); 177 | 178 | unsigned char TFileHead_ [3200]; 179 | unsigned char ExTFileHead_ [3200]; 180 | binaryFileHeader BFileHead_; 181 | traceHeader traceHeader_; 182 | float *Trace_; 183 | 184 | std::string filename_; 185 | std::fstream in_; 186 | private: 187 | int toLitteEnd(int); 188 | unsigned int toLitteEnd(unsigned int); 189 | unsigned short int toLitteEnd(unsigned short int); 190 | short int toLitteEnd( short int); 191 | float toIeee(uint32_t ibm); 192 | }; 193 | 194 | //Constuctor 195 | segy::segy(){ 196 | } 197 | 198 | //De-constuctor 199 | segy::~segy(){ 200 | } 201 | 202 | int segy::toLitteEnd(int a){ 203 | unsigned short int tmp1=(a>>16); 204 | unsigned short int tmp2=(a* 0x0000FFFF); 205 | tmp2 = toLitteEnd(tmp2); 206 | tmp1 = toLitteEnd(tmp1); 207 | 208 | int b = (int)tmp2; 209 | b = b << 16; 210 | b = b | (int)tmp1; 211 | 212 | return b; 213 | } 214 | 215 | unsigned int segy::toLitteEnd(unsigned int a){ 216 | unsigned short int tmp1=(a>>16); 217 | unsigned short int tmp2=(a* 0x0000FFFF); 218 | tmp2 = toLitteEnd(tmp2); 219 | tmp1 = toLitteEnd(tmp1); 220 | 221 | unsigned int b = (unsigned int)tmp2; 222 | b = b << 16; 223 | b = b | (unsigned int)tmp1; 224 | 225 | return b; 226 | } 227 | 228 | unsigned short int segy::toLitteEnd(unsigned short int a){ 229 | unsigned short int tmp = a>>8; 230 | return (a<<8) | (tmp); 231 | } 232 | 233 | short int segy::toLitteEnd( short int a){ 234 | short int tmp = a>>8; 235 | return (a<<8) | (tmp); 236 | } 237 | 238 | // Function below credits to Sebastian Good, 239 | // http://www.palladiumconsulting.com/2014/09/little-performance-explorations-c/ 240 | float segy::toIeee(uint32_t ibm) 241 | { 242 | ibm = ntohl(ibm); 243 | uint32_t fr; /* fraction */ 244 | int32_t exp; /* exponent */ 245 | int32_t sgn; /* sign */ 246 | 247 | /* split into sign, exponent, and fraction */ 248 | fr = ibm; 249 | sgn = (int32_t)(fr >> 31); /* save sign */ 250 | fr <<= 1; /* shift sign out */ 251 | exp = (int32_t)(fr >> 25); /* save exponent */ 252 | fr <<= 7; /* shift exponent out */ 253 | 254 | if (fr == 0) 255 | { /* short-circuit for zero */ 256 | exp = 0; 257 | goto done; 258 | } 259 | 260 | /* adjust exponent from base 16 offset 64 radix point before first digit to base 2 offset 127 radix point after first digit */ 261 | /* (exp - 64) * 4 + 127 - 1 == exp * 4 - 256 + 126 == (exp << 2) - 130 */ 262 | exp = (exp << 2) - 130; 263 | 264 | /* (re)normalize */ 265 | while (fr < 0x80000000) 266 | { /* 3 times max for normalized input */ 267 | --exp; 268 | fr <<= 1; 269 | } 270 | 271 | if (exp <= 0) 272 | { /* underflow */ 273 | if (exp < -24) /* complete underflow - return properly signed zero */ 274 | fr = 0; 275 | else /* partial underflow - return denormalized number */ 276 | fr >>= -exp; 277 | exp = 0; 278 | } 279 | else if (exp >= 255) 280 | { /* overflow - return infinity */ 281 | fr = 0; 282 | exp = 255; 283 | } 284 | else 285 | { /* just a plain old number - remove the assumed high bit */ 286 | fr <<= 1; 287 | } 288 | 289 | done: 290 | /* put the pieces back together and return it */ 291 | uint32_t ieee = ((uint32_t)(fr >> 9)) | ((uint32_t)(exp << 23)) | ((uint32_t)(sgn << 31)); 292 | float result; 293 | memcpy(&result, &ieee, sizeof(float)); 294 | return result; 295 | } 296 | 297 | void segy::OpenFile(std::string fl) 298 | { 299 | char temp [4000]; 300 | filename_ = fl; 301 | in_.open(filename_.c_str(),std::ifstream::in); 302 | if(in_.fail()) 303 | { 304 | printf("Error opening file %s \n",filename_.c_str()); 305 | exit(0); 306 | } 307 | 308 | memset( TFileHead_, '\0', sizeof(char) * 3200 ); 309 | in_.read((char *)TFileHead_, sizeof(TFileHead_)); 310 | 311 | in_.read(temp, sizeof(BFileHead_)); 312 | std::memcpy(&BFileHead_,temp,sizeof(BFileHead_)); 313 | Trace_ = (float*)malloc(sizeof(float)*1000); 314 | //while(is.eof()){ 315 | in_.read(temp, sizeof(traceHeader_)); 316 | std::memcpy(&traceHeader_,temp,sizeof(traceHeader_)); 317 | 318 | 319 | 320 | uint8_t* buffer = new uint8_t[4000]; 321 | in_.read(reinterpret_cast(buffer), sizeof(float)*1000); 322 | 323 | for (size_t n = 0; n < 1000; n++) 324 | { 325 | // size_t traceOffset = fileHeaderLength + (n * traceLength); 326 | // for (size_t s = 0; s < nSamples; ++s) 327 | // { 328 | uint32_t ibmSample = *(reinterpret_cast(buffer + n*4)); 329 | Trace_[n] += toIeee(ibmSample); 330 | // } 331 | } 332 | 333 | 334 | delete[] buffer; 335 | 336 | } 337 | 338 | void segy::PrintTraceHeader(){ 339 | printf("TRACE_SEQ_GLOBAL : %i \n",toLitteEnd( traceHeader_.TRACE_SEQ_GLOBAL) ); 340 | printf("TRACE_SEQ_LOCAL : %i \n", toLitteEnd( traceHeader_.TRACE_SEQ_LOCAL) ); 341 | printf("ORI_RECORD_NUM : %i \n", toLitteEnd( traceHeader_.ORI_RECORD_NUM) ); 342 | printf("TRACE_NUM_FIELD : %i \n", toLitteEnd( traceHeader_.TRACE_NUM_FIELD) ); 343 | printf("SOURCE_POINT : %i \n", toLitteEnd( traceHeader_.SOURCE_POINT) ); 344 | printf("ENSEMBLE_NUM : %i \n", toLitteEnd( traceHeader_.ENSEMBLE_NUM) ); 345 | printf("ENS_TRACE_NUM : %i \n", toLitteEnd( traceHeader_.ENS_TRACE_NUM) ); 346 | printf("TRACE_CODE : %hi \n", toLitteEnd( traceHeader_.TRACE_CODE) ); 347 | printf("NUM_VERT_SUM : %hi \n", toLitteEnd( traceHeader_.NUM_VERT_SUM) ); 348 | printf("NUM_HORZ_SUM : %hi \n", toLitteEnd( traceHeader_.NUM_HORZ_SUM) ); 349 | printf("DATA_USE : %hi \n", toLitteEnd( traceHeader_.DATA_USE) ); 350 | printf("DIST_CENT_RECV : %i \n", toLitteEnd( traceHeader_.DIST_CENT_RECV) ); 351 | printf("RECV_GRP_ELEV : %i \n", toLitteEnd( traceHeader_.RECV_GRP_ELEV) ); 352 | printf("SURF_ELEV_SRC : %i \n", toLitteEnd( traceHeader_.SURF_ELEV_SRC) ); 353 | printf("SOURCE_DEPTH : %i \n", toLitteEnd( traceHeader_.SOURCE_DEPTH) ); 354 | printf("DATUM_ELEV_RECV : %i \n", toLitteEnd( traceHeader_.DATUM_ELEV_RECV) ); 355 | printf("DATUM_ELAV_SRC : %i \n", toLitteEnd( traceHeader_.DATUM_ELAV_SRC) ); 356 | printf("WATER_DEPTH_SRC : %i \n", toLitteEnd( traceHeader_.WATER_DEPTH_SRC) ); 357 | printf("WATER_DEPTH_GRP : %i \n", toLitteEnd( traceHeader_.WATER_DEPTH_GRP) ); 358 | printf("SCALE_DEPTH : %hi \n", toLitteEnd( traceHeader_.SCALE_DEPTH) ); 359 | printf("SCALE_COOR : %hi \n", toLitteEnd( traceHeader_.SCALE_COOR) ); 360 | printf("SRC_COOR_X : %i \n", toLitteEnd( traceHeader_.SRC_COOR_X) ); 361 | printf("SRC_COOR_Y : %i \n", toLitteEnd( traceHeader_.SRC_COOR_Y) ); 362 | printf("GRP_COOR_X : %i \n", toLitteEnd( traceHeader_.GRP_COOR_X) ); 363 | printf("GRP_COOR_Y : %i \n", toLitteEnd( traceHeader_.GRP_COOR_Y) ); 364 | printf("COOR_UNIT : %hi \n", toLitteEnd( traceHeader_.COOR_UNIT) ); 365 | printf("WEATHER_VEL : %hi \n", toLitteEnd( traceHeader_.WEATHER_VEL) ); 366 | printf("SWEATHER_VEL : %hi \n", toLitteEnd( traceHeader_.SWEATHER_VEL) ); 367 | printf("UPHOLE_T_SRC : %hi \n", toLitteEnd( traceHeader_.UPHOLE_T_SRC) ); 368 | printf("UPHOLE_T_GRP : %hi \n", toLitteEnd( traceHeader_.UPHOLE_T_GRP) ); 369 | printf("SRC_STA_CORRC : %hi \n", toLitteEnd( traceHeader_.SRC_STA_CORRC) ); 370 | printf("GRP_STA_CORRC : %hi \n", toLitteEnd( traceHeader_.GRP_STA_CORRC) ); 371 | printf("TOTAL_STA : %hi \n", toLitteEnd( traceHeader_.TOTAL_STA) ); 372 | printf("LAG_TIME_A : %hi \n", toLitteEnd( traceHeader_.LAG_TIME_A) ); 373 | printf("LAG_TIME_B : %hi \n", toLitteEnd( traceHeader_.LAG_TIME_B) ); 374 | printf("DELAY_T : %hi \n", toLitteEnd( traceHeader_.DELAY_T) ); 375 | printf("MUTE_T_STRT : %hi \n", toLitteEnd( traceHeader_.MUTE_T_STRT) ); 376 | printf("MUTE_T_END : %hi \n", toLitteEnd( traceHeader_.MUTE_T_END) ); 377 | printf("NUM_OF_SAMPL : %hi \n", toLitteEnd( traceHeader_.NUM_OF_SAMPL) ); 378 | printf("SAMPLE_INTRVL : %hi \n", toLitteEnd( traceHeader_.SAMPLE_INTRVL) ); 379 | printf("GAIN_TYPE : %hi \n", toLitteEnd( traceHeader_.GAIN_TYPE) ); 380 | printf("GAIN_CONST : %hi \n", toLitteEnd( traceHeader_.GAIN_CONST) ); 381 | printf("GAIN_INIT : %hi \n", toLitteEnd( traceHeader_.GAIN_INIT) ); 382 | printf("CORRLTD : %hi \n", toLitteEnd( traceHeader_.CORRLTD) ); 383 | printf("SWEEP_FREQ_START : %hi \n", toLitteEnd( traceHeader_.SWEEP_FREQ_START) ); 384 | printf("SWEEP_FREQ_END : %hi \n", toLitteEnd( traceHeader_.SWEEP_FREQ_END) ); 385 | printf("SWEEP_LENGTH : %hi \n", toLitteEnd( traceHeader_.SWEEP_LENGTH) ); 386 | printf("SWEEP_TYPE : %hi \n", toLitteEnd( traceHeader_.SWEEP_TYPE) ); 387 | printf("SWEEP_TAPER_LEN_START : %hi \n", toLitteEnd( traceHeader_.SWEEP_TAPER_LEN_START) ); 388 | printf("SWEEP_TAPER_LEN_END : %hi \n", toLitteEnd( traceHeader_.SWEEP_TAPER_LEN_END) ); 389 | printf("TAPER_TYPE : %hi \n", toLitteEnd( traceHeader_.TAPER_TYPE) ); 390 | printf("ALIAS_FREQ : %hi \n", toLitteEnd( traceHeader_.ALIAS_FREQ) ); 391 | printf("ALIAS_SLOPE : %hi \n", toLitteEnd( traceHeader_.ALIAS_SLOPE) ); 392 | printf("NOTCH_FREQ : %hi \n", toLitteEnd( traceHeader_.NOTCH_FREQ) ); 393 | printf("NOTCH_SLOPE : %hi \n", toLitteEnd( traceHeader_.NOTCH_SLOPE) ); 394 | printf("LOWCUT_FREQ : %hi \n", toLitteEnd( traceHeader_.LOWCUT_FREQ) ); 395 | printf("HIGHCUT_FREQ : %hi \n", toLitteEnd( traceHeader_.HIGHCUT_FREQ) ); 396 | printf("LOWCUT_SLOPE : %hi \n", toLitteEnd( traceHeader_.LOWCUT_SLOPE) ); 397 | printf("HIGHCUT_SLOPE : %hi \n", toLitteEnd( traceHeader_.HIGHCUT_SLOPE) ); 398 | printf("YEAR : %hi \n", toLitteEnd( traceHeader_.YEAR) ); 399 | printf("DAY : %hi \n", toLitteEnd( traceHeader_.DAY) ); 400 | printf("HOUR : %hi \n", toLitteEnd( traceHeader_.HOUR) ); 401 | printf("MINUTE : %hi \n", toLitteEnd( traceHeader_.MINUTE) ); 402 | printf("SECOND : %hi \n", toLitteEnd( traceHeader_.SECOND) ); 403 | printf("TIME_CODE : %hi \n", toLitteEnd( traceHeader_.TIME_CODE) ); 404 | printf("WEIGHT_FACT : %hi \n", toLitteEnd( traceHeader_.WEIGHT_FACT) ); 405 | printf("GEOPHNE_ROLL : %hi \n", toLitteEnd( traceHeader_.GEOPHNE_ROLL) ); 406 | printf("GEOPHNE_TRACE : %hi \n", toLitteEnd( traceHeader_.GEOPHNE_TRACE) ); 407 | printf("GEOPHNE_LAST : %hi \n", toLitteEnd( traceHeader_.GEOPHNE_LAST) ); 408 | printf("GAP_SIZE : %hi \n", toLitteEnd( traceHeader_.GAP_SIZE) ); 409 | printf("OVER_TRAVEL : %hi \n", toLitteEnd( traceHeader_.OVER_TRAVEL) ); 410 | printf("ENS_COOR_X : %i \n", toLitteEnd( traceHeader_.ENS_COOR_X) ); 411 | printf("ENS_COOR_Y : %i \n", toLitteEnd( traceHeader_.ENS_COOR_Y) ); 412 | printf("INLINE : %i \n", toLitteEnd( traceHeader_.INLINE) ); 413 | printf("CROSS : %i \n", toLitteEnd( traceHeader_.CROSS) ); 414 | printf("SHOOTPOINT : %i \n", toLitteEnd( traceHeader_.SHOOTPOINT) ); 415 | printf("SHOOTPOINT_SCALE : %hi \n", toLitteEnd( traceHeader_.SHOOTPOINT_SCALE) ); 416 | printf("TRACE_UNIT : %hi \n", toLitteEnd( traceHeader_.TRACE_UNIT) ); 417 | printf("TRANSD_UNIT : %hi \n", toLitteEnd( traceHeader_.TRANSD_UNIT) ); 418 | printf("TRACE_IDENT : %hi \n", toLitteEnd( traceHeader_.TRACE_IDENT) ); 419 | printf("SCALE_TIME : %hi \n", toLitteEnd( traceHeader_.SCALE_TIME) ); 420 | printf("SRC_ORIENT : %hi \n", toLitteEnd( traceHeader_.SRC_ORIENT) ); 421 | printf("SRC_UNIT : %hi \n", toLitteEnd( traceHeader_.SRC_UNIT) ); 422 | // printf("%hi \n",sgy.toLitteEnd( sgy.traceHeader_.char UNNASSIGNED1 [6]) ); 423 | // printf("%hi \n",sgy.toLitteEnd( sgy.traceHeader_.char TRANSD_CONST [6]) ); 424 | // printf("%hi \n",sgy.toLitteEnd( sgy.traceHeader_.char SRC_DIRECTION [6]) ); 425 | // printf("%hi \n",sgy.toLitteEnd( sgy.traceHeader_.char SRC_MEASUREMT [6]) ); 426 | } 427 | 428 | void segy::PrintBinaryHeader(){ 429 | printf("JOB_ID :%i \n", toLitteEnd(BFileHead_.JOB_ID ) ); 430 | printf("LINE_NUM :%i \n", toLitteEnd(BFileHead_.LINE_NUM ) ); 431 | printf("REEL_NUM :%i \n", toLitteEnd(BFileHead_.REEL_NUM ) ); 432 | printf("NUM_OF_TRACE :%hi \n", toLitteEnd(BFileHead_.NUM_OF_TRACE ) ); 433 | printf("NUM_OF_AUX :%hi \n", toLitteEnd(BFileHead_.NUM_OF_AUX ) ); 434 | printf("INTERVAL_M :%hi \n", toLitteEnd(BFileHead_.INTERVAL_MS) ); 435 | printf("INTERVAL_MS_ORI :%hi \n", toLitteEnd(BFileHead_.INTERVAL_MS_ORI ) ); 436 | printf("NUM_OF_SAMPLES_ORI :%hi \n", toLitteEnd(BFileHead_.NUM_OF_SAMPLES_ORI ) ); 437 | printf("SAMPLE_FORMAT :%hi \n", toLitteEnd(BFileHead_.SAMPLE_FORMAT ) ); 438 | printf("ENSEMBLE :%hi \n", toLitteEnd(BFileHead_.ENSEMBLE ) ); 439 | printf("TRACE_SORT :%hi \n", toLitteEnd(BFileHead_.TRACE_SORT ) ); 440 | printf("VERT_SUM :%hi \n", toLitteEnd(BFileHead_.VERT_SUM ) ); 441 | printf("SWEEP_FREQ_START :%hi \n", toLitteEnd(BFileHead_.SWEEP_FREQ_START ) ); 442 | printf("SWEEP_FREQ_END :%hi \n", toLitteEnd(BFileHead_.SWEEP_FREQ_END ) ); 443 | printf("SWEEP_LENGTH :%hi \n", toLitteEnd(BFileHead_.SWEEP_LENGTH ) ); 444 | printf("SWEEP_TYPE :%hi \n", toLitteEnd(BFileHead_.SWEEP_TYPE ) ); 445 | printf("SWEEP_NUM_CHANNEL :%hi \n", toLitteEnd(BFileHead_.SWEEP_NUM_CHANNEL ) ); 446 | printf("SWEEP_TAPER_LEN_START:%hi \n", toLitteEnd(BFileHead_.SWEEP_TAPER_LEN_START ) ); 447 | printf("SWEEP_TAPER_LEN_END :%hi \n", toLitteEnd(BFileHead_.SWEEP_TAPER_LEN_END ) ); 448 | printf("TAPER_TYPE :%hi \n", toLitteEnd(BFileHead_.TAPER_TYPE ) ); 449 | printf("CORRELATED :%hi \n", toLitteEnd(BFileHead_.CORRELATED ) ); 450 | printf("BINARY_GAIN :%hi \n", toLitteEnd(BFileHead_.BINARY_GAIN ) ); 451 | printf("AMP_RECOR :%hi \n", toLitteEnd(BFileHead_.AMP_RECOR ) ); 452 | printf("MEASURE_SYSTEM :%hi \n", toLitteEnd(BFileHead_.MEASURE_SYSTEM ) ); 453 | printf("IMPULSE_POLAR :%hi \n", toLitteEnd(BFileHead_.IMPULSE_POLAR ) ); 454 | printf("POLAR_CODE :%hi \n", toLitteEnd(BFileHead_.POLAR_CODE ) ); 455 | printf("SEGY_REV_NUM :%hi \n", toLitteEnd(BFileHead_.SEGY_REV_NUM ) ); 456 | printf("FIXED_LEN :%hi \n", toLitteEnd(BFileHead_.FIXED_LEN ) ); 457 | printf("NUM_EXT_HEAD :%hi \n", toLitteEnd(BFileHead_.NUM_EXT_HEAD ) ); 458 | } 459 | 460 | void segy::PrintTextHeader(){ 461 | for (size_t i = 0; i < 3200; i++) 462 | { 463 | if((i%80) == 0) 464 | std::cout << std::endl; 465 | 466 | std::cout << e2a[(int) (TFileHead_[i])]; 467 | 468 | } 469 | std::cout << std::endl; 470 | } --------------------------------------------------------------------------------