Skip to content

Commit

Permalink
Fix csv export to 6 decimals
Browse files Browse the repository at this point in the history
otherwise sensitive to float precision difference between parameters (currently 64bit) and responses (32bit)
  • Loading branch information
Yngve S. Kristiansen authored and yngve-sk committed Sep 30, 2024
1 parent 72a1fc0 commit 8e0815b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ def run(
if drop_const_cols:
data = data.loc[:, (data != data.iloc[0]).any()]

data.to_csv(output_file)
data.to_csv(output_file, float_format="%.6f")

export_info = (
f"Exported {len(data.index)} rows and {len(data.columns)} "
Expand Down
2 changes: 1 addition & 1 deletion tests/ert/ui_tests/gui/test_csv_export.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def verify_exported_content(file_name, gui, ensemble_select):

for i in range(ensemble.ensemble_size):
assert (
f",{name},{gen_kw_data.iloc[i]['COEFFS:a']},{gen_kw_data.iloc[i]['COEFFS:b']},{gen_kw_data.iloc[i]['COEFFS:c']},{misfit_data.iloc[i]['MISFIT:POLY_OBS']},{misfit_data.iloc[i]['MISFIT:TOTAL']}"
f",{name},{gen_kw_data.iloc[i]['COEFFS:a']:.6f},{gen_kw_data.iloc[i]['COEFFS:b']:.6f},{gen_kw_data.iloc[i]['COEFFS:c']:.6f},{misfit_data.iloc[i]['MISFIT:POLY_OBS']:.6f},{misfit_data.iloc[i]['MISFIT:TOTAL']:.6f}"
in file_content
)

Expand Down

0 comments on commit 8e0815b

Please sign in to comment.