Crewes Seismic I/O Library File Index. Function Documentation. Functions to access seimic header definitions, страница 4

Returns:

Success code (0) or error code (non-zero).

int seisio_close (int id)

Closes a SEG-Y file.

Parameters:

id   seisio file identification number

Returns:

0 for success.

int seisio_getDataFmt (int id)

Gets the data format of a SEG-Y file.

Tries to determine the data format of a SEG-Y file by looking  at the data format in the SEG-Y file header. The standard dictates that the data-format word value 1=F4IBM, 2=I4, 3=I2, 4=I4G. If a value of 5 is found, we interpret this to mean F4IEEE. If a value of 0 if found, we interpret this to  mean F4IBM. Values outside the range of 1-4 are undefined, and our guesses are possibly wrong some of the time.

Todo:

Use heuristics to make better guesses.

Bugs and limitations:

May not work when modifying a file with zero traces - fseek always succeeds.

If seisio_setDataFmt is called prior to this function, then  the previously set data format is returned, not the value within the file.

Parameters:

id   seisio file identification number

Returns:

the data format of the SEG-Y file. One of: SEISIO_FMT_F4IBM SEISIO_FMT_I4, SEISIO_FMT_I2, SEISIO_FMT_I4G, SEISIO_FMT_F4IEEE, SEISIO_FMT_F4IBM

int seisio_getMaxNSamp (int id)

Gets the maximum number of samples per trace in a file.

This operation scans the entire file.

Parameters:

id   seisio file identification number

Returns:

Maximum number of samples per trace for all traces in the file.

int seisio_getNSamp (int id, int trcNum)

Gets the number of data samples per trace for the given trace.

See also:

seisio_getMaxNSamp() (p.pagenum)

Parameters:

id   seisio file identification number

trcNum   trace number, first has a value of 1. If trace numebr of zero is passed we peek at the next trace's trace length WITHOUT advancing to that trace.

int seisio_getNSampFixed (int id)

Gets the number of samples per trace from fixed-trace-length files.

This uses the NSAMP header word from the file header. If the file header contains an invalid (less than 1) trace length, the trace length from the first trace is used.

int seisio_getNumTrcs (int id)

Gets the number of traces in the file, else -1 if unable to determine.

Parameters:

id   seisio file identification number

Returns:

the number of traces in the file, else -1 if unable to determine.

int seisio_getTrcLength (int id, int trcNum)

Gets the number bytes (not samples) per trace for the specified trace.

See also:

seisio_getNSamp() (p.pagenum)

Todo:

Handle invalid values for trcNum.

Parameters:

id   seisio file identification number

trcNum   Trace number for which we want to know the trace length. First trace is trace 1 (not zero). If 0 is supplied, peek at the next trace's length but do not advance to that trace.

Returns:

number of bytes required to hold the given trace, including that trace's header.

long seisio_getTrcPos (int id, int trcNum)

Gets the byte-position of the start of a trace in a Seismic file.

Parameters:

trcNum   Trace number (the first being 1).

Returns:

The byte-position (counting from zero) of the start of the requested trace. If we read the file starting from this position, we will encounter the trace header, then the trace data. 

Bugs and limitations:

Doesn't handle incorrect values of trcNum (like zero, or values more than numTrc) (yet).

Todo:

Handle >2.4 GB files.

int seisio_open (const char * filename, const char * readWriteMode, int seisioHdrDefnID)

Opens a SEG-Y file.

Parameters:

filename   Name of the file to open

readwritemode   One of "r" for read-only access, "w" for write access  (erases current contents), "m" for modify access  (creates if doesn't already exists).

seisioHdrDefnId   Seisio header definition object id. Determines the layout of the placement of file and trace headers in the SEG-Y file.

Returns:

seisio file identification number or an error. Use seisio_ok to test for an error.