equinor / equinor/resdata

Difference between `EclSumKeyWordVector` and `eclsum.keys()`

Open
#816 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
127
Forks
103
Avg merge
2d 5h
Merged PRs (30d)
18

Description

```python
from ecl.summary import EclSum, EclSumKeyWordVector

eclsum = EclSum("./SOME.UNSMRY", lazy_load=False)

column_names1 = list(EclSumKeyWordVector(eclsum, add_keywords = True))
column_names2 = list(eclsum.keys())

print(len(column_names1))
print(len(set(column_names1)))

print(len(column_names2))
print(len(set(column_names2)))
```
gives on a test model:
```
11260
10731
12895
12895
```
I.e. `EclSumKeyWordVector` gives fewer vectors than `eclsum.keys()` - especially when duplicate keys are removed 🤔

It looks like `EclSumKeyWordVector` is the one used in `pandas.DataFrame` export function, while the `keys()` function is used in the CSV export function.
https://github.com/equinor/ecl/blob/3d6d17e1470419fc5af0c891560fb2211b2eda0d/python/ecl/summary/ecl_sum.py#L469-L525 https://github.com/equinor/ecl/blob/3d6d17e1470419fc5af0c891560fb2211b2eda0d/python/ecl/summary/ecl_sum.py#L1515-L1535

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.