Skip to content

Commit

Permalink
Split if table is summary
Browse files Browse the repository at this point in the history
  • Loading branch information
equinor-ruaj committed Jan 23, 2025
1 parent 4df1662 commit 314372b
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
5 changes: 3 additions & 2 deletions src/fmu/sumo/sim2sumo/tables.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ def generate_table_meta(datafile, obj, tagname, config):

def convert_table_2_sumo_file(datafile, obj, tagname, config):
"""Convert table to Sumo File ready for shipping to sumo
If the table has more than 500 columns and a table index is defined
If the table is a summary table and has a defined table_index
we also return the table in chunks of 500 columns with
_sumo.hidden set to True
Expand All @@ -137,8 +137,9 @@ def convert_table_2_sumo_file(datafile, obj, tagname, config):
chunk_size = 500
columns = metadata["data"]["spec"]["columns"]
table_index = metadata["data"]["table_index"]
tagname = metadata["data"]["tagname"]

if len(columns) > chunk_size and table_index:
if table_index and tagname == "summary":
cols = [c for c in columns if c not in table_index]
chunks = batched(cols, chunk_size - len(table_index))
for idx, chunk in enumerate(chunks):
Expand Down
2 changes: 1 addition & 1 deletion tests/test_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ def test_upload_tables_from_simulation_run(
monkeypatch.chdir(scratch_files[0])

disp = Dispatcher(scratch_files[1], "dev")
expected_results = 2
expected_results = 3
tables.upload_tables_from_simulation_run(
REEK_DATA_FILE,
{"summary": {"arrow": True}, "rft": {"arrow": True}},
Expand Down
2 changes: 1 addition & 1 deletion tests/test_with_ert.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def test_sim2sumo_with_ert(
real0 = ert_run_scratch_files[0]
# ! This changes files in the current directory and deletes parameters.txt
write_ert_config_and_run(real0)
expected_exports = 88
expected_exports = 90
path = f"/objects('{ert_run_case_uuid}')/search"
results = sumo.post(
path,
Expand Down

0 comments on commit 314372b

Please sign in to comment.