⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 testsegy.cpp

📁 segy读写程序
💻 CPP
📖 第 1 页 / 共 2 页
字号:
//---------------------------------------------------------------------------

#pragma hdrstop

//---------------------------------------------------------------------------


#include <stdio.h>
#include <string.h>
#include <dir.h>

#include "Util.h"

#pragma argsused

FILE* _f = NULL;
char  _txthed [3200];
char  _binhed  [400];
char  _trched  [240];
char  _inptrc[10000];
float _data  [10000];

double _si;

int _nsmp;
int _frmt;
int _smpl;
int _trl;
int _ntr;

int _ctr;


static int ft [] = {
  4,  4,  4,  4,  4,  4,  4,  2,  2,  2,  2,  4,  4,  4,  4,  4,  4,  4,  4,  2,
  2,  4,  4,  4,  4,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,
  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,
  2,  2,  2,  2,  2,  2,  2,  2,  2,  0
};

static int pt[] = {
  1,  5,  9, 13, 17, 21, 25, 29, 31, 33, 35, 37, 41, 45, 49, 53, 57, 61, 64, 69,
 71, 73, 77, 81, 85, 89, 91, 93, 95, 97, 99,101,103,105,107,109,111,113,115,117,
119,121,123,125,127,129,131,133,135,137,139,141,143,149,151,153,155,157,159,161,
163,165,167,169,171,173,175,177,179,0
};

static char* str[] = {
"* Trace sequence number withing line",
"  Trace sequence number withing reel",
"* FFID - Original field record number ",
"* Trace number withing field record",
"  SP - Energy source point number",
"  CDP ensemble  number ",
"  Trace  number",
"* Trace identification code",
"  Number of vertically summed traces",
"  Number of horizontally stacked traces",
"  Data use ( 1-production, 2-test )",
"  Distance from source point to receiv grp",
"  Receiver group elevation",
"  Surface elevation at source",
"  Surface depth below source",
"  Datum elevation at reciever group",
"  Datum elevation at source",
"  Water depth at source",
"  Water depth at group",
"  Scaler to all elevations & depths",
"  Scaler to all coordinates",
"  Source X coordinate",
"  Source Y coordinate",
"  Group  X coordinate",
"  Group  Y coordinate",
"  Coordinate units (1-lenm/ft 2-secarc)",
"  Weathering velocity",
"  Subweathering velocity",
"  Uphole time at source",
"  Uphole time at group",
"  Source static correction",
"  Group  static correction",
"  Total static applied",
"  Lag time A",
"  Lag time B",
"  Delay Recording time",
"  Mute time start",
"  Mute time end",
"* Number of samples in this trace",
"* Sample interval in ms for this trace",
"  Gain type of field instruments",
"  Insrument gain",
"  Insrument gain constant",
"  Corellated (1-yes / 2-no)",
"  Sweep frequency at start",
"  Sweep frequency at end",
"  Sweep lenth in ms",
"  Sweep type 1-lin,2-parabol,2-exp,4-ohter",
"  Sweep trace taper length at start in ms",
"  Sweep trace taper length at end   in ms",
"  Taper type 1-lin,2-cos2,3-other",
"  Alias filter frequency, if used",
"  Alias filter slope",
"  Low cut frequency,  if used ",
"  High cut frequency, if used ",
"  Low cut slope",
"  High cut slope",
"  Year data recorded",
"  Day of year",
"  Hour of day",
"  Minute of hour",
"  Second of minute",
"  Time basis code 1-local,2-GMT,3-other",
"  Trace weighting factor",
"  Geophone group number of roll sw pos 1",
"  Geophone group number of trace # 1",
"  Geophine group number of last trace",
"  Gap size (total # of groups dropped)",
"  Overtravel assoc w taper of beg/end line",
""};


void TrcDataShow()
{
    int i,n;

    if(_f==NULL) return;

    printf("trace # %d\n",_ctr);

    for(i=n=0;n<_nsmp;n++)
    {
        printf("%11g ",_data[n]);
        i++;
        if(i==6)
        {
            printf("\n"); i=0;
        }
    }
    printf("\n");
}

void TrcHeadShow()
{
    if(_f==NULL) return;

    printf("trace # %d\n",_ctr);

    printf("* Trace sequence number withing line:........%10d\n",i4(_inptrc,1));
    printf("  Trace sequence number withing reel:........%10d\n",i4(_inptrc,5));
    printf("* Original field record number :.............%10d\n",i4(_inptrc,9));
    printf("* Trace number withing field record:.........%10d\n",i4(_inptrc,13));
    printf("  Energy source point number:................%10d\n",i4(_inptrc,17));
    printf("  CDP ensemble  number :.....................%10d\n",i4(_inptrc,21));
    printf("  Trace  number:.............................%10d\n",i4(_inptrc,25));
    printf("* Trace identification code:.................%10d\n",i2(_inptrc,29));
    printf("  Number of vertically summed traces:........%10d\n",i2(_inptrc,31));
    printf("  Number of horizontally stacked traces:.....%10d\n",i2(_inptrc,33));
    printf("  Data use ( 1-production, 2-test ):.........%10d\n",i2(_inptrc,35));
    printf("  Distance from source point to receiv. grp.:%10d\n",i4(_inptrc,37));
    printf("  Receiver group elevation:..................%10d\n",i4(_inptrc,41));
    printf("  Surface elevation at source:...............%10d\n",i4(_inptrc,45));
    printf("  Surface depth below source:................%10d\n",i4(_inptrc,49));
    printf("  Datum elevation at reciever group:.........%10d\n",i4(_inptrc,53));
    printf("  Datum elevation at source:.................%10d\n",i4(_inptrc,57));
    printf("  Water depth at source:.....................%10d\n",i4(_inptrc,61));
    printf("  Water depth at group:......................%10d\n",i4(_inptrc,64));
    printf("  Scaler to all elevations & depths:.........%10d\n",i2(_inptrc,69));
    printf("  Scaler to all coordinates:.................%10d\n",i2(_inptrc,71));
    printf("  Source X coordinate:.......................%10d\n",i4(_inptrc,73));
    printf("  Source Y coordinate:.......................%10d\n",i4(_inptrc,77));
    printf("  Group  X coordinate:.......................%10d\n",i4(_inptrc,81));
    printf("  Group  Y coordinate:.......................%10d\n",i4(_inptrc,85));
    printf("  Coordinate units (1-len.m/ft 2-sec.arc):...%10d\n",i2(_inptrc,89));
    printf("  Weathering velocity:.......................%10d\n",i2(_inptrc,91));
    printf("  Subweathering velocity:....................%10d\n",i2(_inptrc,93));
    printf("  Uphole time at source:.....................%10d\n",i2(_inptrc,95));
    printf("  Uphole time at group:......................%10d\n",i2(_inptrc,97));
    printf("  Source static correction:..................%10d\n",i2(_inptrc,99));
    printf("  Group  static correction:..................%10d\n",i2(_inptrc,101));
    printf("  Total static applied:......................%10d\n",i2(_inptrc,103));
    printf("  Lag time A:................................%10d\n",i2(_inptrc,105));
    printf("  Lag time B:................................%10d\n",i2(_inptrc,107));
    printf("  Delay Recording time:......................%10d\n",i2(_inptrc,109));
    printf("  Mute time start:...........................%10d\n",i2(_inptrc,111));
    printf("  Mute time end:.............................%10d\n",i2(_inptrc,113));
    printf("* Number of samples in this trace:...........%10d\n",i2(_inptrc,115));
    printf("* Sample interval in ms for this trace:......%10d\n",i2(_inptrc,117));
    printf("  Gain type of field instruments:............%10d\n",i2(_inptrc,119));
    printf("  Insrument gain:............................%10d\n",i2(_inptrc,121));
    printf("  Insrument gain constant:...................%10d\n",i2(_inptrc,123));
    printf("  Corellated (1-yes / 2-no):.................%10d\n",i2(_inptrc,125));
    printf("  Sweep frequency at start:..................%10d\n",i2(_inptrc,127));
    printf("  Sweep frequency at end:....................%10d\n",i2(_inptrc,129));
    printf("  Sweep lenth in ms:.........................%10d\n",i2(_inptrc,131));
    printf("  Sweep type 1-lin,2-parabol,2-exp,4-ohter:..%10d\n",i2(_inptrc,133));
    printf("  Sweep trace taper length at start in ms:...%10d\n",i2(_inptrc,135));
    printf("  Sweep trace taper length at end   in ms:...%10d\n",i2(_inptrc,137));
    printf("  Taper type 1-lin,2-cos2,3-other:...........%10d\n",i2(_inptrc,139));
    printf("  Alias filter frequency, if used:...........%10d\n",i2(_inptrc,141));
    printf("  Alias filter slope:........................%10d\n",i2(_inptrc,143));
    printf("  Low cut frequency,  if used :..............%10d\n",i2(_inptrc,149));
    printf("  High cut frequency, if used: ..............%10d\n",i2(_inptrc,151));
    printf("  Low cut slope:.............................%10d\n",i2(_inptrc,153));
    printf("  High cut slope:............................%10d\n",i2(_inptrc,155));
    printf("  Year data recorded:........................%10d\n",i2(_inptrc,157));
    printf("  Day of year:...............................%10d\n",i2(_inptrc,159));
    printf("  Hour of day:...............................%10d\n",i2(_inptrc,161));
    printf("  Minute of hour:............................%10d\n",i2(_inptrc,163));
    printf("  Second of minute:..........................%10d\n",i2(_inptrc,165));
    printf("  Time basis code 1-local,2-GMT,3-other:.....%10d\n",i2(_inptrc,167));
    printf("  Trace weighting factor:....................%10d\n",i2(_inptrc,169));
    printf("  Geophone group number of roll sw. pos. 1...%10d\n",i2(_inptrc,171));
    printf("  Geophone group number of trace # 1:........%10d\n",i2(_inptrc,173));
    printf("  Geophine group number of last trace:.......%10d\n",i2(_inptrc,175));
    printf("  Gap size (total # of groups dropped):......%10d\n",i2(_inptrc,177));
    printf("  Overtravel assoc w taper of beg/end line:..%10d\n",i2(_inptrc,179));
    printf("\n");
}

void BinHeadShow()
{
    if(_f==NULL) return;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -