Expand description
This is a simplified library for reading SEG-Y files into rust. It is designed for efficient reading of SEG-Y headers and data without holding potentially very large SEG-Y files in memory.
The library was designed to follow the SEG Technical Standards Committee’s SEG-Y_r2.0 standard (from January 2017).
The interface allows fairly simple extraction of data from trace headers and traces themselves.
Parameters such as coordinate format and file endianness is automatically determined.
If the file is written with non-standard byte locations for inline, crossline or other data,
or if it is known that there are other “tricks” to it, SegySettings can be adjusted to
to reflect this.
use std::env::var;
use std::path::PathBuf;
use giga_segy_in::SegyFile;
let mut root = var("CARGO_MANIFEST_DIR").map(PathBuf::from).unwrap();
root.pop();
let name = root.join("testdata").join("DutchMiniHead.sgy");
let file = SegyFile::open(name.to_str().unwrap(), Default::default()).unwrap();
let text_header: &str = file.get_text_header();
// SEG-Y text headers should always have 3200 character.
assert_eq!(text_header.len(), 3200);
println!("Text header: {:?}", text_header);
let bin_header = file.get_bin_header();
println!("Bin header: {}", bin_header);
// Get the data in the order of appearance of traces in the file.
// Of course there are more organised ways of doing this, but for a demo, this will do.
for trace in file.traces_iter() {
println!("Trace header: {}", trace.get_header());
let data:Vec<f32> = file.get_trace_data_as_f32_from_trace(trace).unwrap();
if data.len() > 9 {
println!("Data: {:?}", &data[0..10]);
} else {
panic!("The traces in `DutchMiniHead` are at least this long.");
}
}This library is not designed for editing of SEG-Y files, although it can theoretically be accomplished
with the clever use of giga_segy_in and giga_segy_out, we do not recommend this.
Modules§
- convert_
headers - This module contains the trait that is used for constructing internal representations of SEG-Y headers from bytes. It is mostly used internally by this library, but could perhaps also be of use for those who require specialisd internal representations of this data.
- enums
- This contains all the enums that are used in the trace and binary headers.
- memory_
map - This submodule exists to map the file as a “memory map” and then allow reading of the data.
- read_
data - This submodule deals with reading the actual data in the file once it has been mapped to memory.
Structs§
- BinHeader
- This structure represents a parsed binary header for a SEG-Y file.
- Readable
Tape Label - This is a rust readable version of the
TapeLabelstructure, which can be generated after the file has been read, but is not stored. - Segy
File - A structure which represents a mapped SEG-Y file.
- Segy
Metadata - This structure contains all of the metadata for opening a SEG-Y file.
- Segy
Settings - This structure holds a list of various settings to be imported for the custom reading of byte locations of various variables in the headers and other things when interpreting a SEG-Y file.
- Tape
Label - This structure represents the 128-byte SEG-Y tape label which is largely optional. It appears that this is stored mostly as character bytes (u8).
- Trace
- This structure represents a SEG-Y trace.
- Trace
Header - This structure represents a parsed binary trace header for a single trace of a SEG-Y file..
Enums§
- RsgError
- Basic Error types.