[][src]Struct lasrs::Las

pub struct Las {
    pub blob: String,
}

Represents a parsed well log file

Fields

blob: String

blob holds the String data read from the file

Note

There's no need to access the blob field, only exposed for debugging

Implementations

impl Las[src]

pub fn new<T: AsRef<Path>>(path: T) -> Self[src]

Returns a Las read from a las file with the given path

Arguments

path - Path to well log file

Example

use lasrs::Las;
let log = Las::new("./sample/example.las");
assert_eq!(&log.blob[..=7], "~VERSION");

pub fn version(&self) -> f64[src]

Returns f64 representing the version of Las specification

Example

use lasrs::Las;
let log = Las::new("./sample/example.las");
assert_eq!(log.version(), 2.0);

pub fn wrap(&self) -> bool[src]

Returns a bool denoting the wrap mode

Example

use lasrs::Las;
let log = Las::new("./sample/example.las");
assert_eq!(log.wrap(), false);

pub fn headers(&self) -> Vec<String>[src]

Returns Vec<String> representing the titles of the curves (~C), Which can be mapped to a row in ~A (data) section

Example

use lasrs::Las;
let log = Las::new("./sample/A10.las");
assert_eq!(
    log.headers(),
    vec!["DEPT", "Perm", "Gamma", "Porosity", "Fluvialfacies", "NetGross"],
);

pub fn data(&self) -> Vec<Vec<f64>>[src]

Returns Vec<Vec<f64>> where every Vec represents a row in ~A (data) section, and every f64 represents an entry in a column/curve

Example

use lasrs::Las;
let log = Las::new("./sample/A10.las");
let expected: Vec<Vec<f64>> = vec![
                    vec![1501.129, -999.25, -999.25, 0.270646, 0.0, 0.0],
                    vec![1501.629, 124.5799, 78.869453, 0.267428, 0.0, 0.0],
                  ];
assert_eq!(expected, &log.data()[3..5]);

pub fn column(self, col: &str) -> Vec<f64>[src]

Returns Vec<f64> - all reading for a curve/column

Arguments

col - string slice representing the title of the column

Example

use lasrs::Las;
let log = Las::new("./sample/example.las");
assert_eq!(
    vec![1670.0, 1669.875, 1669.75, 1669.745],
    log.column("DEPT")
);

pub fn column_count(&self) -> usize[src]

Returns usize representing the total number of columns/curves

Example

use lasrs::Las;
let log = Las::new("./sample/example.las");
assert_eq!(8, log.column_count());

pub fn row_count(&self) -> usize[src]

Returns usize representing the total number of entry in ~A (data) section

Example

use lasrs::Las;
let log = Las::new("./sample/example.las");
assert_eq!(4, log.row_count());

pub fn headers_and_desc(&self) -> Vec<(String, String)>[src]

Returns Vec<(String, String)> where the first item in the tuple is the title of curve and the second is the full description of the curve

Example

use lasrs::Las;
let log = Las::new("./sample/example.las");
let mut expected = vec![
    ("DEPT".to_owned(), "DEPTH".to_owned()),
    ("DT".to_owned(), "SONIC TRANSIT TIME".to_owned()),
    ("ILD".to_owned(), "DEEP RESISTIVITY".to_owned()),
];
let mut result = log.headers_and_desc();
result.sort_by(|a, b| a.0.partial_cmp(&b.0).unwrap());
assert_eq!(expected, &result[..3]);

pub fn curve_params(&self) -> HashMap<String, WellProp>[src]

Returns HashMap<String, WellProp> containing all the WellProp(s) in a ~C (curve) section

Example

use lasrs::{Las, WellProp};
let log = Las::new("./sample/example.las");
let curve_section = log.curve_params();
assert_eq!(
    &WellProp::new("OHMM", "SHALLOW RESISTIVITY", "07 220 04 00"),
    curve_section.get("SFLU").unwrap()
);

pub fn well_info(&self) -> HashMap<String, WellProp>[src]

Returns HashMap<String, WellProp> containing all the WellProp(s) in a ~W (well) section

Example

use lasrs::{Las, WellProp};
let log = Las::new("./sample/example.las");
let well_section = log.well_info();
assert_eq!(
    &WellProp::new("M", "STOP DEPTH", "1669.7500"),
    well_section.get("STOP").unwrap()
);

pub fn log_params(&self) -> HashMap<String, WellProp>[src]

Returns HashMap<String, WellProp> containing all the WellProp(s) in a ~P (parameter) section

Example

use lasrs::{Las, WellProp};
let log = Las::new("./sample/example.las");
let params = log.log_params();
assert_eq!(
    &WellProp::new("", "MUD TYPE", "GEL CHEM"),
    params.get("MUD").unwrap()
);

pub fn other(&self) -> String[src]

Returns a String representing extra information in ~O (other) section

Example

use lasrs::Las;
let log = Las::new("./sample/example.las");
let expected = [
    "Note: The logging tools became stuck at 625 metres causing the data",
    "between 625 metres and 615 metres to be invalid.",
];
assert_eq!(log.other(), expected.join("\n").to_string());

pub fn to_csv(&self, filename: &str)[src]

Converts file to csv and saves it to the current directory

Arguments

filename - string slice, the name used to save the csv file

Auto Trait Implementations

impl RefUnwindSafe for Las

impl Send for Las

impl Sync for Las

impl Unpin for Las

impl UnwindSafe for Las

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.