Skip to content

Commit

Permalink
Merge 8aaac82 into 9b2ecff
Browse files Browse the repository at this point in the history
  • Loading branch information
kinverarity1 committed Aug 11, 2015
2 parents 9b2ecff + 8aaac82 commit 98b5741
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 11 deletions.
7 changes: 5 additions & 2 deletions lasio/las.py
Original file line number Diff line number Diff line change
Expand Up @@ -628,12 +628,15 @@ def read_line(line, pattern=None):

d = {}
if pattern is None:
pattern = (r"\.?(?P<name>[^.]+)\." +
pattern = (r"\.?(?P<name>[^.]*)\." +
r"(?P<unit>[^\s:]*)" +
r"(?P<value>[^:]*):" +
r"(?P<descr>.*)")
m = re.match(pattern, line)
for key, value in m.groupdict().items():
mdict = m.groupdict()
if mdict["name"] == "":
mdict["name"] = "UNKNOWN"
for key, value in mdict.items():
d[key] = value.strip()
if key == "unit":
if d[key].endswith("."):
Expand Down
18 changes: 9 additions & 9 deletions lasio/test_read.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,12 @@ def test_mnemonic_leading_period():
assert [c.mnemonic for c in l.curves] == [
"DEPT", "DT", "RHOB", "NPHI", "SFLU", "SFLA", "ILM", "ILD"]

# def test_mnemonic_missing():
# l = read(egfn("mnemonic_missing.las"))
# assert [c.mnemonic for c in l.curves] == [
# "DEPT", "DT", "RHOB", "NPHI", "UNKNOWN", "SFLA", "ILM", "ILD"]

# def test_mnemonic_missing_multiple():
# l = read(egfn("mnemonic_missing_multiple.las"))
# assert [c.mnemonic for c in l.curves] == [
# "DEPT", "DT", "RHOB", "NPHI", "UNKNOWN[0]", "UNKNOWN[1]", "ILM", "ILD"]
def test_mnemonic_missing():
l = read(egfn("mnemonic_missing.las"))
assert [c.mnemonic for c in l.curves] == [
"DEPT", "DT", "RHOB", "NPHI", "UNKNOWN", "SFLA", "ILM", "ILD"]

def test_mnemonic_missing_multiple():
l = read(egfn("mnemonic_missing_multiple.las"))
assert [c.mnemonic for c in l.curves] == [
"DEPT", "DT", "RHOB", "NPHI", "UNKNOWN[0]", "UNKNOWN[1]", "ILM", "ILD"]

0 comments on commit 98b5741

Please sign in to comment.