Skip to content

Commit

Permalink
Merge pull request #77 from keurfonluu/devel
Browse files Browse the repository at this point in the history
Fix TOUGH3 history file reader
  • Loading branch information
keurfonluu authored Sep 19, 2020
2 parents 6ca7ff4 + 0a13123 commit 4c6fe52
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 7 deletions.
4 changes: 2 additions & 2 deletions test/support_files/outputs/FOFT_A1912.csv
Git LFS file not shown
3 changes: 3 additions & 0 deletions test/support_files/outputs/FOFT_A1912_T2.csv
Git LFS file not shown
4 changes: 2 additions & 2 deletions test/support_files/outputs/GOFT_A1162.csv
Git LFS file not shown
3 changes: 3 additions & 0 deletions test/support_files/outputs/GOFT_A1162_T2.csv
Git LFS file not shown
14 changes: 14 additions & 0 deletions test/test_output.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,16 @@
[
(
"FOFT_A1912.csv",
{
"TIME": 4.393722000e9,
"PRES": 1.8740899675005e8,
"TEMP": 720.0,
"SAT_G": 0.0,
"SAT_L": 24.0,
},
),
(
"FOFT_A1912_T2.csv",
{
"TIME": 3.06639400e9,
"PRES": 1.83000721e8,
Expand All @@ -31,6 +41,10 @@
),
(
"GOFT_A1162.csv",
{"TIME": 4.393722000e9, "GEN": -30.0, "ENTG": 1.528048035348e7, "PWB": 0.0},
),
(
"GOFT_A1162_T2.csv",
{"TIME": 3.06639400e9, "GEN": -27.5, "ENTG": 1.40141971e7, "PWB": 0.0},
),
],
Expand Down
2 changes: 1 addition & 1 deletion toughio/__about__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
__version__ = "1.4.1"
__version__ = "1.4.2"
__author__ = "Keurfon Luu"
__author_email__ = "[email protected]"
__website__ = "https://github.com/keurfonluu/toughio"
Expand Down
10 changes: 8 additions & 2 deletions toughio/_io/output/_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,12 +151,18 @@ def read_history(filename):

with open(filename, "r") as f:
line = f.readline().strip()
headers = line.split()[1:]

if line.startswith('"'):
sep = ","
line = line.replace('"', "")
else:
sep = None
headers = [x.strip() for x in line.split(sep)[1:]]

data = []
line = f.readline().strip()
while line:
data += [[float(x) for x in line.split()]]
data += [[float(x) for x in line.split(sep)]]
line = f.readline().strip()
data = numpy.transpose(data)

Expand Down

0 comments on commit 4c6fe52

Please sign in to comment.