Struct Las

Source
pub struct Las {
    pub blob: String,
}
Expand description

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§

Source§

impl Las

Source

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

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");
Source

pub fn version(&self) -> f64

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);
Source

pub fn wrap(&self) -> bool

Returns a bool denoting the wrap mode

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

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

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"],
);
Source

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

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]);
Source

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

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")
);
Source

pub fn column_count(&self) -> usize

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());
Source

pub fn row_count(&self) -> usize

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());
Source

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

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]);
Source

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

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()
);
Source

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

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()
);
Source

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

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()
);
Source

pub fn other(&self) -> String

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());
Source

pub fn to_csv(&self, filename: &str)

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 Freeze for Las

§

impl RefUnwindSafe for Las

§

impl Send for Las

§

impl Sync for Las

§

impl Unpin for Las

§

impl UnwindSafe for Las

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.