Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TyperError about the data indexing problem #3610

Open
soulstealer-star opened this issue Jul 27, 2023 · 0 comments
Open

TyperError about the data indexing problem #3610

soulstealer-star opened this issue Jul 27, 2023 · 0 comments

Comments

@soulstealer-star
Copy link

soulstealer-star commented Jul 27, 2023

Hi there is still some error from the OPM FLOW REFERENCE manual for the Python code part.

In the part of APPENDIX D: PYTHON INTERFACE TO OPM FLOW, one example is as follow:

kw = deck["WELSPECS"] 
print(f"Keyword has {len(kw)} records")
for record in kw:
    well = record["WELL"].get_str()
    group = record[1].get_str()
    print(f"Well {num}: {well} is part of group{group})

After I load a new deck to this code, the main error occurs on this code: well = record["WELL"].get_str()

The error is:

well = record["WELL"].get_str()
**TypeError: __getitem__(): incompatible function arguments. The following argument types are supported:
1. (self: opm.opmcommon_python.DeckRecord, arg0: int) -> Opm::DeckItem**

Which means I cannot use the keyword index to get the values,only can use the int number. Also there is other example in the manual using the same kind of code.

Is this because the latest python library really doesn't support keyword indexing now, or do I need to use some other method?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant