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

Support latest sumo metadata #434

Merged

Conversation

HansKallekleiv
Copy link
Collaborator

@HansKallekleiv HansKallekleiv commented Oct 22, 2023

  • Use new Sumo parameter table collection for retrieving parameters
  • Use new metadata definition for Sumo Summary data
  • Handle surfaces with missing metadata
  • Set default sumo environment to production

Copy link
Collaborator

@anders-kiaer anders-kiaer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A couple of comments - otherwise LGTM.


sensitivities = create_ensemble_sensitivities(sumo_parameters)
parameters = [create_ensemble_parameter(sumo_parameter) for sumo_parameter in sumo_parameters]
table = table_collection[0]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
table = table_collection[0]
table = await table_collection.getitem_async(0)

sensitivities = create_ensemble_sensitivities(sumo_parameters)
parameters = [create_ensemble_parameter(sumo_parameter) for sumo_parameter in sumo_parameters]
table = table_collection[0]
byte_stream: BytesIO = table.blob
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be async in some way?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a table.blob_async which do return a BytesIO object, but the following lines:

        table = await table_collection.getitem_async(0)
        byte_stream: BytesIO = await table.blob_async
        table = pq.read_table(byte_stream)

gives: pyarrow.lib.ArrowInvalid: Could not open Parquet input source '<Buffer>': Parquet magic bytes not found in footer. Either the file is corrupted or this is not a parquet file.

Not entirely sure why...

Comment on lines 295 to 311
def get_smry_table_collection(case: Case, iteration_name: str, column_name: Optional[str] = None) -> TableCollection:
"""Get a collection of summary tables for a case and iteration"""
all_smry_table_collections = case.tables.filter(
aggregation="collection",
tagname="summary",
iteration=iteration_name,
column=column_name,
)
table_names = all_smry_table_collections.names
if len(table_names) == 0:
raise ValueError("No summary table collections found")
if len(table_names) == 1:
return all_smry_table_collections

raise ValueError(f"Multiple summary table collections found: {table_names}. Expected only one.")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this function also be async, and use async/await on its calls to sumo?

@HansKallekleiv HansKallekleiv force-pushed the support-latest-sumo-metadata branch from 6cf2728 to c6305a6 Compare October 23, 2023 13:10
@HansKallekleiv HansKallekleiv merged commit 63e1180 into equinor:main Oct 23, 2023
3 checks passed
@HansKallekleiv HansKallekleiv deleted the support-latest-sumo-metadata branch October 23, 2023 13:18
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

Successfully merging this pull request may close these issues.

2 participants