Skip to content

Commit

Permalink
F1
Browse files Browse the repository at this point in the history
  • Loading branch information
ErichSuter committed May 2, 2024
1 parent 2f9f1a7 commit e5cd4b5
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/xtgeo/well/_well_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,8 @@ def import_wlogs(wlogs: dict):
else:
raise ValueError(f"Invalid log type found in input: {typ}")

print("@ecs: Type(rec): ", type(rec))

if rec is None or isinstance(rec, Iterable):
wlogrecords[key] = deepcopy(rec)
else:
Expand Down
37 changes: 37 additions & 0 deletions tests/test_well/test_well.py
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,14 @@ def test_hdf_io_single(tmp_path, testdata_path):
wname = (tmp_path / "hdfwell").with_suffix(".hdf")
mywell.to_hdf(wname)
mywell2 = xtgeo.well_from_file(wname, fformat="hdf")

print("*****************************")
print(mywell)
print("*****************************")
print(mywell2)
print("*****************************")
# Doesn't print the details, so no help in doing this

assert mywell2.nrow == mywell.nrow


Expand All @@ -278,6 +286,35 @@ def test_import_as_rms_export_as_hdf_many(tmp_path, simple_well):

t0 = xtg.timer()
result = xtgeo.well_from_file(wuse, fformat="hdf5")

#######################################

orig_wlogs = simple_well.get_wlogs()['X_UTME'][1]
res_wlogs = result.get_wlogs()['X_UTME'][1]

file1 = tmp_path / "orig.json"
file2 = tmp_path / "result.json"
# fr1 = simple_well.get_dataframe()
# fr1.to_json(file1)
# fr2 = result.get_dataframe()
# fr2.to_json(file2)

# Result of investigations:
# Dataframes are equal. But that is of course after a conversion
# Parts of the well objects are not equal:
# wlogs is ordered differently, and contain mix of lists and dicts. But not sure if it matters, they may be converted/handled equally anyway ...
# Try to see if they can be made equal by working with "json.loads(jmeta, object_pairs_hook=dict)"
# Nope, nothing changes this

# object_pairs_hook: handles multiple keys with equal value
# So it must be in the code

# TODO:
# - Verify that fr1.to_well_file, and fr2, gives the same well
# - Could write our own decoder

#######################################

assert result.get_dataframe().equals(simple_well.get_dataframe())
print("Time for load HDF: ", xtg.timer(t0))

Expand Down

0 comments on commit e5cd4b5

Please sign in to comment.