Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Write traces and trace_headers using the segyio C interface #550

Open
ahadji05 opened this issue Mar 19, 2023 · 1 comment
Open

Write traces and trace_headers using the segyio C interface #550

ahadji05 opened this issue Mar 19, 2023 · 1 comment

Comments

@ahadji05
Copy link

I want to create some functionality in my C code that allows to model data and store them in SEG-Y files for usage later. I couldn't find an example that demonstrates how to write files from scratch, and I find it difficult to get started with it. I would appreciate any help that could give me a point to start working on this, e.g. a minimal example/script that shows how to write a trace and a trace_header, or so.

I have the following data-structure in my C code, which I want to store into a SEG-Y:

typedef struct wavefield {
  float xmin, xmax, dx;  // receivers across X-axis
  float ymin, ymax, dy;  // receivers across Y-axis
  float tmin, tmax, dt;  // time-range and sample interval
  float *data;           // pointer to data
  float srcx, srcy;      // source position
  int nx, ny, nt;        // dimensions
  int ldx, ldy, ldt;     // leading dimensions ( ldx==1,  ldy==nx,  ldt==ny*nx )
} wavefield;

my goal is to implement an interface like this:

void create_writeable_segyfile( segy_file *fp, const char *name );

void write_trace_header( segy_file *fp,  wavefield *wf, int trace_index );

void write_trace( segy_file *fp, wavefield *wf, int trace_index );

Any piece of code, hint, or link where to look further would be much appreciated:)

@ErlendHaa
Copy link
Contributor

The flip endianness application might give you some insight into how to write a new file using the C api

https://github.com/equinor/segyio/blob/master/applications/flip-endianness.cpp

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants