A set of tools for reading and writing SEGY files conforming to the SEG Technical Standards Committee's SEG-Y_r2.0 standard, written in the Rust programming language.
giga-segy-in
is part of the giga-segy
library workspace, which is a tool for working with data in the SEG-Y format. The giga-segy-in
library provides functionality for parsing SEG-Y files of arbitrary size with a variety of options.
The library is quite lightweight, but provides options (feature flags) for allowing serialization/deserialization via serde
/serde_json
. NB: Functionality for the production of C bindings for header structures requires the direct use of giga-segy-core
.
Using the basic functionality of giga-segy
is as simple as adding the dependencies to the [dependencies]
section of the Cargo.toml of your project. Usually you only need giga-segy-in
or giga-segy-out
as they re-export all the necessities. However, for the generation of C bindings, you will need giga-segy-core
.
```toml [dependencies]
giga-segy-in
for my parser.giga-segy-in = "0.3.1"
giga-segy-core = { version = "0.3.1", features = ["gen_cbindings"]} ```
Here is an example of a super simple SEG-Y parser that uses giga-segy
.
```Rust
use std::path::PathBuf;
use gigasegyin::SegyFile;
let dir = PathBuf::from("/my/data/lives/here"); let full_path = dir.join("MyFavouriteSEGYDataset.sgy");
let file = SegyFile::open(name.to_str().unwrap(), Default::default()).unwrap();
// I want to get the text header and dump it to the terminal. let textheader: &str = file.gettextheader(); println!("Text header: {:?}", textheader);
// Oops. SEG-Y headers look messy if we don't go line by line... for line in file.gettextheader_lines() { println!("{}", line); }
// Now to have a look at the binary header. let binheader = file.getbinheader(); println!("Bin header: {}", binheader);
// Get the data in the order of appearance of traces in the file.
// Of course there are more organised ways of doing this,
// but I just want to see the data...
for trace in file.tracesiter() {
// First a quick peek at the trace header.
println!("Trace header: {}", trace.getheader());
// ..And then the data.
// NB: trace data is not loaded to RAM until this is called.
let data:Vec
The library was designed to work foremost for the GiGa infosystems codebase and thus has something of a "GiGa flavour" to it.