lasio
lasio copied to clipboard
Data section not identified if ~Other line immediately precedes ~ASCII line
LASIO Version 2.8 Log ASCII Standard (LAS) 2.0
Describe the issue
When reading a LAS file with an empty ~Other
section, the section is incorrectly filled with data from the ~ASCII
section.
I am new to LASIO / LAS files so I may be missing something obvious here. :) But being simple about this, I can correctly write an empty ~Other
section to file so I also expect to be able to correctly read an empty ~Other
section from file. Additionally: the ~Other
section is optional by LAS standard 2.0 and not always present in LAS files. However, it is seems to be required for writing a LASFile to file. Same for section ~Parameter
. Should these sections be made optional for writing a LASFile to file?
Steps to reproduce Write and read back a minimal LASFile (see documentation):
import lasio
import numpy as np
testfn = 'testfile.las'
dstart = 10
dstop = 50
dstep = 0.5
las = lasio.las.LASFile()
depths = np.arange(dstart, dstop, dstep)
las.add_curve('DEPTH', depths, unit='m')
las.write(testfn)
contents of testfile.las
:
$ cat testfile.las
~Version ---------------------------------------------------
VERS. 2.0 : CWLS log ASCII Standard -VERSION 2.0
WRAP. NO : One line per depth step
DLM . SPACE : Column Data Section Delimiter
~Well ------------------------------------------------------
STRT.m 10.0 : START DEPTH
STOP.m 49.5 : STOP DEPTH
STEP.m 0.5 : STEP
NULL. -9999.25 : NULL VALUE
COMP. : COMPANY
WELL. : WELL
FLD . : FIELD
LOC . : LOCATION
PROV. : PROVINCE
CNTY. : COUNTY
STAT. : STATE
CTRY. : COUNTRY
SRVC. : SERVICE COMPANY
DATE. : DATE
UWI . : UNIQUE WELL ID
API . : API NUMBER
~Curve Information -----------------------------------------
DEPTH.m :
~Params ----------------------------------------------------
~Other -----------------------------------------------------
~ASCII -----------------------------------------------------
10.00000
10.50000
...
Reading testfile.las
:
testlas = lasio.read(testfn)
testlas.header
>>>>
{'Version': [HeaderItem(mnemonic="VERS", unit="", value="2.0", descr="CWLS log ASCII Stan...),
HeaderItem(mnemonic="WRAP", unit="", value="NO", descr="One line per depth s...),
HeaderItem(mnemonic="DLM", unit="", value="SPACE", descr="Column Data Sectio...)],
'Well': [HeaderItem(mnemonic="STRT", unit="m", value="10.0", descr="START DEPTH"),
HeaderItem(mnemonic="STOP", unit="m", value="49.5", descr="STOP DEPTH"),
HeaderItem(mnemonic="STEP", unit="m", value="0.5", descr="STEP"),
HeaderItem(mnemonic="NULL", unit="", value="-9999.25", descr="NULL VALUE"),
HeaderItem(mnemonic="COMP", unit="", value="", descr="COMPANY"),
HeaderItem(mnemonic="WELL", unit="", value="", descr="WELL"),
HeaderItem(mnemonic="FLD", unit="", value="", descr="FIELD"),
HeaderItem(mnemonic="LOC", unit="", value="", descr="LOCATION"),
HeaderItem(mnemonic="PROV", unit="", value="", descr="PROVINCE"),
HeaderItem(mnemonic="CNTY", unit="", value="", descr="COUNTY"),
HeaderItem(mnemonic="STAT", unit="", value="", descr="STATE"),
HeaderItem(mnemonic="CTRY", unit="", value="", descr="COUNTRY"),
HeaderItem(mnemonic="SRVC", unit="", value="", descr="SERVICE COMPANY"),
HeaderItem(mnemonic="DATE", unit="", value="", descr="DATE"),
HeaderItem(mnemonic="UWI", unit="", value="", descr="UNIQUE WELL ID"),
HeaderItem(mnemonic="API", unit="", value="", descr="API NUMBER")],
'Curves': [CurveItem(mnemonic="DEPTH", unit="m", value="", descr="", original_mnemonic="DEPTH", data.shape=(80,))],
'Parameter': [],
'Other': '10.00000\n10.50000\n11.00000\n11.50000\n12.00000\n12.50000\n13.00000\n13.50000\n14.00000\n14.50000\n15.00000\n15.50000\n16.00000\n16.50000\n17.00000\n17.50000\n18.00000\n18.50000\n19.00000\n19.50000\n20.00000\n20.50000\n21.00000\n21.50000\n22.00000\n22.50000\n23.00000\n23.50000\n24.00000\n24.50000\n25.00000\n25.50000\n26.00000\n26.50000\n27.00000\n27.50000\n28.00000\n28.50000\n29.00000\n29.50000\n30.00000\n30.50000\n31.00000\n31.50000\n32.00000\n32.50000\n33.00000\n33.50000\n34.00000\n34.50000\n35.00000\n35.50000\n36.00000\n36.50000\n37.00000\n37.50000\n38.00000\n38.50000\n39.00000\n39.50000\n40.00000\n40.50000\n41.00000\n41.50000\n42.00000\n42.50000\n43.00000\n43.50000\n44.00000\n44.50000\n45.00000\n45.50000\n46.00000\n46.50000\n47.00000\n47.50000\n48.00000\n48.50000\n49.00000\n49.50000'}
Note this behaviour is also reproducible with ignore_data=True
on read:
testlas = lasio.read(testfn, ignore_data=True)
testlas.header
Additional The information originally added here has been moved to #435
Thank you for raising this issue, I am quite busy at the moment but will take a look. Certainly lasio should be capable of reading files without ~Other sections.