Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add tests for data-section-header column names #466

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
159 changes: 159 additions & 0 deletions tests/test_write.py
Original file line number Diff line number Diff line change
Expand Up @@ -780,3 +780,162 @@ def test_write_empty_las():
~ASCII -----------------------------------------------------
"""
)


def test_write_data_section_header_default():
# Verify default behavior
s = StringIO()
las = read(egfn("2.0/sample_2.0.las"))
las.write(s)
s.seek(0)
assert (
s.read()
== """~Version ---------------------------------------------------
VERS. 2.0 : CWLS log ASCII Standard -VERSION 2.0
WRAP. NO : ONE LINE PER DEPTH STEP
~Well ------------------------------------------------------
STRT.M 1670.0 : START DEPTH
STOP.M 1669.75 : STOP DEPTH
STEP.M -0.125 : STEP
NULL. -999.25 : NULL VALUE
COMP. ANY OIL COMPANY INC. : COMPANY
WELL. AAAAA_2 : WELL
FLD . WILDCAT : FIELD
LOC . 12-34-12-34W5M : LOCATION
PROV. ALBERTA : PROVINCE
SRVC. ANY LOGGING COMPANY INC. : SERVICE COMPANY
DATE. 13-DEC-86 : LOG DATE
UWI . 100123401234W500 : UNIQUE WELL ID
~Curve Information -----------------------------------------
DEPT.M : 1 DEPTH
DT .US/M 60 520 32 00 : 2 SONIC TRANSIT TIME
RHOB.K/M3 45 350 01 00 : 3 BULK DENSITY
NPHI.V/V 42 890 00 00 : 4 NEUTRON POROSITY
SFLU.OHMM 07 220 04 00 : 5 SHALLOW RESISTIVITY
SFLA.OHMM 07 222 01 00 : 6 SHALLOW RESISTIVITY
ILM .OHMM 07 120 44 00 : 7 MEDIUM RESISTIVITY
ILD .OHMM 07 120 46 00 : 8 DEEP RESISTIVITY
~Params ----------------------------------------------------
MUD . GEL CHEM : MUD TYPE
BHT .DEGC 35.5 : BOTTOM HOLE TEMPERATURE
BS .MM 200.0 : BIT SIZE
FD .K/M3 1000.0 : FLUID DENSITY
MATR. SAND : NEUTRON MATRIX
MDEN. 2710.0 : LOGGING MATRIX DENSITY
RMF .OHMM 0.216 : MUD FILTRATE RESISTIVITY
DFD .K/M3 1525.0 : DRILL FLUID DENSITY
~Other -----------------------------------------------------
Note: The logging tools became stuck at 625 metres causing the data
between 625 metres and 615 metres to be invalid.
~ASCII -----------------------------------------------------
1670.00000 123.45000 2550.00000 0.45000 123.45000 123.45000 110.20000 105.60000
1669.87500 123.45000 2550.00000 0.45000 123.45000 123.45000 110.20000 105.60000
1669.75000 123.45000 2550.00000 0.45000 123.45000 123.45000 110.20000 105.60000
"""
)


def test_write_data_section_header_with_curve_names():
# Verify that the Curve headers are included in the ~ASCII data_header
s = StringIO()
las = read(egfn("2.0/sample_2.0.las"))
las.write(s, mnemonics_header=True, data_section_header="~ASCII")
s.seek(0)
assert (
s.read()
== """~Version ---------------------------------------------------
VERS. 2.0 : CWLS log ASCII Standard -VERSION 2.0
WRAP. NO : ONE LINE PER DEPTH STEP
~Well ------------------------------------------------------
STRT.M 1670.0 : START DEPTH
STOP.M 1669.75 : STOP DEPTH
STEP.M -0.125 : STEP
NULL. -999.25 : NULL VALUE
COMP. ANY OIL COMPANY INC. : COMPANY
WELL. AAAAA_2 : WELL
FLD . WILDCAT : FIELD
LOC . 12-34-12-34W5M : LOCATION
PROV. ALBERTA : PROVINCE
SRVC. ANY LOGGING COMPANY INC. : SERVICE COMPANY
DATE. 13-DEC-86 : LOG DATE
UWI . 100123401234W500 : UNIQUE WELL ID
~Curve Information -----------------------------------------
DEPT.M : 1 DEPTH
DT .US/M 60 520 32 00 : 2 SONIC TRANSIT TIME
RHOB.K/M3 45 350 01 00 : 3 BULK DENSITY
NPHI.V/V 42 890 00 00 : 4 NEUTRON POROSITY
SFLU.OHMM 07 220 04 00 : 5 SHALLOW RESISTIVITY
SFLA.OHMM 07 222 01 00 : 6 SHALLOW RESISTIVITY
ILM .OHMM 07 120 44 00 : 7 MEDIUM RESISTIVITY
ILD .OHMM 07 120 46 00 : 8 DEEP RESISTIVITY
~Params ----------------------------------------------------
MUD . GEL CHEM : MUD TYPE
BHT .DEGC 35.5 : BOTTOM HOLE TEMPERATURE
BS .MM 200.0 : BIT SIZE
FD .K/M3 1000.0 : FLUID DENSITY
MATR. SAND : NEUTRON MATRIX
MDEN. 2710.0 : LOGGING MATRIX DENSITY
RMF .OHMM 0.216 : MUD FILTRATE RESISTIVITY
DFD .K/M3 1525.0 : DRILL FLUID DENSITY
~Other -----------------------------------------------------
Note: The logging tools became stuck at 625 metres causing the data
between 625 metres and 615 metres to be invalid.
~ASCII DEPT DT RHOB NPHI SFLU SFLA ILM ILD
1670.00000 123.45000 2550.00000 0.45000 123.45000 123.45000 110.20000 105.60000
1669.87500 123.45000 2550.00000 0.45000 123.45000 123.45000 110.20000 105.60000
1669.75000 123.45000 2550.00000 0.45000 123.45000 123.45000 110.20000 105.60000
"""
)


def test_write_data_section_header_renamed_with_curve_names():
# Verify that the Curve headers are included in the ~A data_header
s = StringIO()
las = read(egfn("2.0/sample_2.0.las"))
las.write(s, mnemonics_header=True, data_section_header="~A")
s.seek(0)
assert (
s.read()
== """~Version ---------------------------------------------------
VERS. 2.0 : CWLS log ASCII Standard -VERSION 2.0
WRAP. NO : ONE LINE PER DEPTH STEP
~Well ------------------------------------------------------
STRT.M 1670.0 : START DEPTH
STOP.M 1669.75 : STOP DEPTH
STEP.M -0.125 : STEP
NULL. -999.25 : NULL VALUE
COMP. ANY OIL COMPANY INC. : COMPANY
WELL. AAAAA_2 : WELL
FLD . WILDCAT : FIELD
LOC . 12-34-12-34W5M : LOCATION
PROV. ALBERTA : PROVINCE
SRVC. ANY LOGGING COMPANY INC. : SERVICE COMPANY
DATE. 13-DEC-86 : LOG DATE
UWI . 100123401234W500 : UNIQUE WELL ID
~Curve Information -----------------------------------------
DEPT.M : 1 DEPTH
DT .US/M 60 520 32 00 : 2 SONIC TRANSIT TIME
RHOB.K/M3 45 350 01 00 : 3 BULK DENSITY
NPHI.V/V 42 890 00 00 : 4 NEUTRON POROSITY
SFLU.OHMM 07 220 04 00 : 5 SHALLOW RESISTIVITY
SFLA.OHMM 07 222 01 00 : 6 SHALLOW RESISTIVITY
ILM .OHMM 07 120 44 00 : 7 MEDIUM RESISTIVITY
ILD .OHMM 07 120 46 00 : 8 DEEP RESISTIVITY
~Params ----------------------------------------------------
MUD . GEL CHEM : MUD TYPE
BHT .DEGC 35.5 : BOTTOM HOLE TEMPERATURE
BS .MM 200.0 : BIT SIZE
FD .K/M3 1000.0 : FLUID DENSITY
MATR. SAND : NEUTRON MATRIX
MDEN. 2710.0 : LOGGING MATRIX DENSITY
RMF .OHMM 0.216 : MUD FILTRATE RESISTIVITY
DFD .K/M3 1525.0 : DRILL FLUID DENSITY
~Other -----------------------------------------------------
Note: The logging tools became stuck at 625 metres causing the data
between 625 metres and 615 metres to be invalid.
~A DEPT DT RHOB NPHI SFLU SFLA ILM ILD
1670.00000 123.45000 2550.00000 0.45000 123.45000 123.45000 110.20000 105.60000
1669.87500 123.45000 2550.00000 0.45000 123.45000 123.45000 110.20000 105.60000
1669.75000 123.45000 2550.00000 0.45000 123.45000 123.45000 110.20000 105.60000
"""
)