Skip to content

Using the Summary() #1043

@nishanghub

Description

@nishanghub

Hello everyone,

I am newbie to python resdata. I am on widows WSL and using VSCode. I have listed the steps that I have tried. Please let me know what I am doing wrong as I am getting an error message.

  1. Created a new directory called "resdatatest" on WSL (\wsl.localhost\Ubuntu-22.04\home\ynot\mydata\sourcecode\mytest\resdatatest)
  2. cd to that directory.
  3. Opened code (code .)
  4. create virtual environment "virtualenv -p /usr/bin/python3.11 myresenv"
  5. Activated the virtual environment (source myresenv/bin/activate)
  6. Now I can see the virtual environment name is just in front of the shell root.
    (myresenv) ynot@COG-NishanK:~/mydata/sourcecode/mytest/resdatatest$
  7. Now I installed resdata (pip install resdata)
  8. I verified the resdata packages.
    Noticed "\wsl.localhost\Ubuntu-22.04\home\ynot\mydata\sourcecode\mytest\resdatatest\myresenv\lib\python3.11\site-packages\resdata" and lot more other packages like "cwrap".
  9. Now I placed two files called "HistoryMatch_07-01-2024.UNSMRY" and "HistoryMatch_07-01-2024.SMSPEC" inside "\wsl.localhost\Ubuntu-22.04\home\ynot\mydata\sourcecode\mytest\resdatatest" and executed the following code

`My Code:

  def convert_files():
      converted_files = []
      if not os.path.isfile("HistoryMatch_07-01-2024.SMSPEC"):
          print("HistoryMatch_07-01-2024.SMSPEC file does not exist")
      else:
          print("HistoryMatch_07-01-2024.SMSPEC file exist")
      ecl_sum = Summary("HistoryMatch_07-01-2024")  
      ecl_sum.export_csv(f"HistoryMatch_07-01-2024_SUMMARY.csv")
      converted_files.append(f"HistoryMatch_07-01-2024_SUMMARY.csv")
      return converted_files`

The error that I am getting

`Error:

  HistoryMatch_07-01-2024.SMSPEC file exist
  Traceback (most recent call last):
    File "/home/ynot/mydata/sourcecode/mytest/resdatatest/covertest.py", line 73, in <module>
      converted_files = convert_files()
                        ^^^^^^^^^^^^^^^
    File "/home/ynot/mydata/sourcecode/mytest/resdatatest/covertest.py", line 46, in convert_files
      ecl_sum = Summary("HistoryMatch_07-01-2024")  
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "/home/ynot/mydata/sourcecode/mytest/resdatatest/myresenv/lib/python3.11/site-packages/resdata/summary/rd_sum.py", line 256, in __init__
      raise IOError(
  OSError: Failed to create summary instance from argument:HistoryMatch_07-01-2024`

Any help is greatly appreciated.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions