Skip to content

Commit

Permalink
keep columns with duplicate tags
Browse files Browse the repository at this point in the history
  • Loading branch information
ttricco committed Jan 18, 2024
1 parent 2f57677 commit fc261e5
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions sarracen/readers/read_phantom.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,14 @@ def _read_array_block(fp, df, n, nums, def_int_dtype, def_real_dtype):
for j in range(nums[i]):

tag = _read_fortran_block(fp, 16).decode('ascii').strip()

if tag in df.columns:
count = 1
original_tag = tag
while tag in df.columns:
count += 1
tag = original_tag + f"_{count}"

data = np.frombuffer(_read_fortran_block(fp, dtype().itemsize * n), dtype=dtype)
df[tag] = data

Expand Down

0 comments on commit fc261e5

Please sign in to comment.