Skip to content

Commit

Permalink
add tests for stack_curves method (issue kinverarity1#284)
Browse files Browse the repository at this point in the history
  • Loading branch information
dagrha committed Oct 21, 2019
1 parent c0abaff commit bb4cac7
Show file tree
Hide file tree
Showing 4 changed files with 209 additions and 0 deletions.
52 changes: 52 additions & 0 deletions tests/examples/multi_channel.las
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
~VERSION INFORMATION
VERS. 2.0 :CWLS Log ASCII Standard - VERSION 2.0
WRAP. NO :One Line per depth step
#--------------------------------------------------
~WELL INFORMATION
#MNEM.UNIT DATA DESCRIPTION
#---- ------ -------------- -----------------------------
STRT .F 7508.0 :START DEPTH
STOP .F 7506.0 :STOP DEPTH
STEP .F -0.5 :STEP
NULL . -999.25 :NULL VALUE
COMP . HIGHMOUNT EXPL & PROD TEXAS LLC :COMPANY
WELL . UNIVERSITY 54-5 # 3 :WELL
CNTY . SCHLEICHER :COUNTY
STAT . TEXAS :STATE
CTRY . USA :COUNTRY
API . 42-413-32879 :API NUMBER
#-----------------------------------------------------------------------------
~PARAMETER INFORMATION
#MNEM.UNIT VALUE DESCRIPTION
#---- ----- -------------------- ------------------------
BHT .DEGF 175.00000 :Bottom Hole Temperature
BS .IN 7.87500 :Bit Size
#-----------------------------------------------------------------------------
~CURVE INFORMATION
#MNEM.UNIT API CODE DESCRIPTION
#---- ----- -------- -----------------------
DEPT .F :DEPTH (BOREHOLE) {F10.1}
BFV .CFCF :Bound Fluid Volume {F11.4}
CBP1 .CFCF :CMR Bin Porosity 1 {F11.4}
CBP2 .CFCF :CMR Bin Porosity 2 {F11.4}
CBP3 .CFCF :CMR Bin Porosity 3 {F11.4}
CBP4 .CFCF :CMR Bin Porosity 4 {F11.4}
CBP5 .CFCF :CMR Bin Porosity 5 {F11.4}
CBP6 .CFCF :CMR Bin Porosity 6 {F11.4}
CBP7 .CFCF :CMR Bin Porosity 7 {F11.4}
CBP8 .CFCF :CMR Bin Porosity 8 {F11.4}
CFTC .HZ :Corrected Far Thermal Count Rate {F11.4}
CMFF .CFCF :CMR Free Fluid {F11.4}
CMFF_SIG.CFCF :Standard Deviation of CMR Free Fluid {F11.4}
CMR_PHI_CONV. :CMR Porosity Conversion factor {F11.4}
CMRP_3MS.CFCF :CMR Porosity with T2 values greater than 3 ms {F11.4}
#-----------------------------------------------------------------------------
#
# DEPT BFV CBP1 CBP2 CBP3 CBP4 CBP5 CBP6 CBP7 CBP8 CFTC CMFF CMFF_SIG CMR_PHI_CO CMRP_3MS
# NV
~A
7508.0 0.0201 0.0144 0.0055 0.0001 0.0000 0.0000 0.0000 0.0000 0.0003 841.0595 0.0004 0.0059 0.0007 0.0005
7507.5 0.0095 0.0044 0.0045 0.0006 0.0000 0.0000 0.0000 0.0000 0.0000 841.0595 0.0000 0.0059 0.0007 0.0006
7507.0 0.0155 0.0020 0.0119 0.0016 0.0000 0.0000 0.0000 0.0000 0.0000 841.0595 0.0000 0.0058 0.0007 0.0016
7506.5 0.0101 0.0006 0.0064 0.0031 0.0000 0.0000 0.0000 0.0001 0.0010 841.0595 0.0011 0.0059 0.0007 0.0043
7506.0 0.0072 0.0008 0.0038 0.0026 0.0000 0.0000 0.0000 0.0002 0.0020 841.0595 0.0022 0.0059 0.0007 0.0048
52 changes: 52 additions & 0 deletions tests/examples/multi_channel_natural_sorting.las
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
~VERSION INFORMATION
VERS. 2.0 :CWLS Log ASCII Standard - VERSION 2.0
WRAP. NO :One Line per depth step
#--------------------------------------------------
~WELL INFORMATION
#MNEM.UNIT DATA DESCRIPTION
#---- ------ -------------- -----------------------------
STRT .F 7508.0 :START DEPTH
STOP .F 7506.0 :STOP DEPTH
STEP .F -0.5 :STEP
NULL . -999.25 :NULL VALUE
COMP . HIGHMOUNT EXPL & PROD TEXAS LLC :COMPANY
WELL . UNIVERSITY 54-5 # 3 :WELL
CNTY . SCHLEICHER :COUNTY
STAT . TEXAS :STATE
CTRY . USA :COUNTRY
API . 42-413-32879 :API NUMBER
#-----------------------------------------------------------------------------
~PARAMETER INFORMATION
#MNEM.UNIT VALUE DESCRIPTION
#---- ----- -------------------- ------------------------
BHT .DEGF 175.00000 :Bottom Hole Temperature
BS .IN 7.87500 :Bit Size
#-----------------------------------------------------------------------------
~CURVE INFORMATION
#MNEM.UNIT API CODE DESCRIPTION
#---- ----- -------- -----------------------
DEPT .F :DEPTH (BOREHOLE) {F10.1}
BFV .CFCF :Bound Fluid Volume {F11.4}
CBP1 .CFCF :CMR Bin Porosity 1 {F11.4}
CBP20 .CFCF :CMR Bin Porosity 20 {F11.4}
CBP13 .CFCF :CMR Bin Porosity 13 {F11.4}
CBP11 .CFCF :CMR Bin Porosity 11 {F11.4}
CBP55 .CFCF :CMR Bin Porosity 55 {F11.4}
CBP103 .CFCF :CMR Bin Porosity 103 {F11.4}
CBP2003 .CFCF :CMR Bin Porosity 2003 {F11.4}
CBP543 .CFCF :CMR Bin Porosity 543 {F11.4}
CFTC .HZ :Corrected Far Thermal Count Rate {F11.4}
CMFF .CFCF :CMR Free Fluid {F11.4}
CMFF_SIG.CFCF :Standard Deviation of CMR Free Fluid {F11.4}
CMR_PHI_CONV. :CMR Porosity Conversion factor {F11.4}
CMRP_3MS.CFCF :CMR Porosity with T2 values greater than 3 ms {F11.4}
#-----------------------------------------------------------------------------
#
# DEPT BFV CBP1 CBP20 CBP13 CBP11 CBP55 CBP103 CBP2003 CBP543 CFTC CMFF CMFF_SIG CMR_PHI_CO CMRP_3MS
# NV
~A
7508.0 0.0201 0.0144 0.0020 0.0013 0.0011 0.0055 0.0103 0.2003 0.0543 841.0595 0.0004 0.0059 0.0007 0.0005
7507.5 0.0095 0.0044 0.0045 0.0006 0.0000 0.0000 0.0000 0.0000 0.0000 841.0595 0.0000 0.0059 0.0007 0.0006
7507.0 0.0155 0.0020 0.0119 0.0016 0.0000 0.0000 0.0000 0.0000 0.0000 841.0595 0.0000 0.0058 0.0007 0.0016
7506.5 0.0101 0.0006 0.0064 0.0031 0.0000 0.0000 0.0000 0.0001 0.0010 841.0595 0.0011 0.0059 0.0007 0.0043
7506.0 0.0072 0.0008 0.0038 0.0026 0.0000 0.0000 0.0000 0.0002 0.0020 841.0595 0.0022 0.0059 0.0007 0.0048
52 changes: 52 additions & 0 deletions tests/examples/multi_channel_out_of_order.las
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
~VERSION INFORMATION
VERS. 2.0 :CWLS Log ASCII Standard - VERSION 2.0
WRAP. NO :One Line per depth step
#--------------------------------------------------
~WELL INFORMATION
#MNEM.UNIT DATA DESCRIPTION
#---- ------ -------------- -----------------------------
STRT .F 7508.0 :START DEPTH
STOP .F 7506.0 :STOP DEPTH
STEP .F -0.5 :STEP
NULL . -999.25 :NULL VALUE
COMP . HIGHMOUNT EXPL & PROD TEXAS LLC :COMPANY
WELL . UNIVERSITY 54-5 # 3 :WELL
CNTY . SCHLEICHER :COUNTY
STAT . TEXAS :STATE
CTRY . USA :COUNTRY
API . 42-413-32879 :API NUMBER
#-----------------------------------------------------------------------------
~PARAMETER INFORMATION
#MNEM.UNIT VALUE DESCRIPTION
#---- ----- -------------------- ------------------------
BHT .DEGF 175.00000 :Bottom Hole Temperature
BS .IN 7.87500 :Bit Size
#-----------------------------------------------------------------------------
~CURVE INFORMATION
#MNEM.UNIT API CODE DESCRIPTION
#---- ----- -------- -----------------------
DEPT .F :DEPTH (BOREHOLE) {F10.1}
BFV .CFCF :Bound Fluid Volume {F11.4}
CBP3 .CFCF :CMR Bin Porosity 3 {F11.4}
CBP5 .CFCF :CMR Bin Porosity 5 {F11.4}
CBP1 .CFCF :CMR Bin Porosity 1 {F11.4}
CBP7 .CFCF :CMR Bin Porosity 7 {F11.4}
CBP2 .CFCF :CMR Bin Porosity 2 {F11.4}
CBP4 .CFCF :CMR Bin Porosity 4 {F11.4}
CBP8 .CFCF :CMR Bin Porosity 8 {F11.4}
CBP6 .CFCF :CMR Bin Porosity 6 {F11.4}
CFTC .HZ :Corrected Far Thermal Count Rate {F11.4}
CMFF .CFCF :CMR Free Fluid {F11.4}
CMFF_SIG.CFCF :Standard Deviation of CMR Free Fluid {F11.4}
CMR_PHI_CONV. :CMR Porosity Conversion factor {F11.4}
CMRP_3MS.CFCF :CMR Porosity with T2 values greater than 3 ms {F11.4}
#-----------------------------------------------------------------------------
#
# DEPT BFV CBP3 CBP5 CBP1 CBP7 CBP2 CBP4 CBP8 CBP6 CFTC CMFF CMFF_SIG CMR_PHI_CO CMRP_3MS
# NV
~A
7508.0 0.0201 0.0001 0.0000 0.0144 0.0000 0.0055 0.0000 0.0003 0.0000 841.0595 0.0004 0.0059 0.0007 0.0005
7507.5 0.0095 0.0006 0.0000 0.0044 0.0000 0.0045 0.0000 0.0000 0.0000 841.0595 0.0000 0.0059 0.0007 0.0006
7507.0 0.0155 0.0016 0.0000 0.0020 0.0000 0.0119 0.0000 0.0000 0.0000 841.0595 0.0000 0.0058 0.0007 0.0016
7506.5 0.0101 0.0031 0.0000 0.0006 0.0001 0.0064 0.0000 0.0010 0.0000 841.0595 0.0011 0.0059 0.0007 0.0043
7506.0 0.0072 0.0008 0.0038 0.0026 0.0000 0.0000 0.0000 0.0002 0.0020 841.0595 0.0022 0.0059 0.0007 0.0048
53 changes: 53 additions & 0 deletions tests/test_stack_curves.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
import os, sys; sys.path.insert(0, os.path.dirname(os.path.dirname(__file__)))

import pytest
import numpy as np

import lasio

test_dir = os.path.dirname(__file__)

egfn = lambda fn: os.path.join(os.path.dirname(__file__), "examples", fn)


def test_stack_curves_with_stub():
las = lasio.read(egfn("multi_channel.las"))
sc = las.stack_curves(stub='CBP')
assert (sc[0] == np.array([0.0144, 0.0055, 0.0001, 0. , 0. , 0. , 0. , 0.0003])).all()


def test_stack_unordered_curves_with_stub():
las = lasio.read(egfn("multi_channel_out_of_order.las"))
sc = las.stack_curves(stub='CBP')
assert (sc[0] == np.array([0.0144, 0.0055, 0.0001, 0. , 0. , 0. , 0. , 0.0003])).all()


def test_stack_unordered_natural_sorting_with_stub():
las = lasio.read(egfn("multi_channel_natural_sorting.las"))
sc = las.stack_curves(stub='CBP')
assert (sc[0] == np.array([0.0144, 0.0011, 0.0013, 0.002 , 0.0055, 0.0103, 0.0543, 0.2003])).all()


def test_stack_curves_with_list():
las = lasio.read(egfn("multi_channel.las"))
sc = las.stack_curves(curve_list=['CBP1', 'CBP2', 'CBP3', 'CBP4', 'CBP5', 'CBP6', 'CBP7', 'CBP8'])
assert (sc[0] == np.array([0.0144, 0.0055, 0.0001, 0. , 0. , 0. , 0. , 0.0003])).all()


def test_stack_unordered_curves_with_list():
las = lasio.read(egfn("multi_channel_out_of_order.las"))
sc = las.stack_curves(curve_list=['CBP1', 'CBP2', 'CBP3', 'CBP4', 'CBP5', 'CBP6', 'CBP7', 'CBP8'])
assert (sc[0] == np.array([0.0144, 0.0055, 0.0001, 0. , 0. , 0. , 0. , 0.0003])).all()


def test_stack_unordered_natural_sorting_with_list():
las = lasio.read(egfn("multi_channel_natural_sorting.las"))
sc = las.stack_curves(['CBP13', 'CBP2003', 'CBP11', 'CBP1', 'CBP103', 'CBP543', 'CBP20', 'CBP55'])
assert (sc[0] == np.array([0.0144, 0.0011, 0.0013, 0.002 , 0.0055, 0.0103, 0.0543, 0.2003])).all()


def test_stack_unordered_natural_no_sort_with_list():
las = lasio.read(egfn("multi_channel_natural_sorting.las"))
sc = las.stack_curves(['CBP13', 'CBP2003', 'CBP11', 'CBP1', 'CBP103', 'CBP543', 'CBP20', 'CBP55'],
sort_curves=False)
assert (sc[0] == np.array([0.0013, 0.2003, 0.0011, 0.0144, 0.0103, 0.0543, 0.002 , 0.0055])).all()

0 comments on commit bb4cac7

Please sign in to comment.