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

Save fields as 32 bit floats #6038

Merged
merged 1 commit into from
Sep 5, 2023
Merged

Save fields as 32 bit floats #6038

merged 1 commit into from
Sep 5, 2023

Conversation

dafeda
Copy link
Contributor

@dafeda dafeda commented Sep 4, 2023

Issue
Resolves #5965

Pre review checklist

  • Read through the code changes carefully after finishing work
  • Make sure tests pass locally (after every commit!)
  • Wait for tests in CI to pass (see "checks" below)
  • Prepare changes in small commits for more convenient review (optional)
  • PR title captures the intent of the changes, and is fitting for release notes.
  • Updated documentation
  • Ensured new behaviour is tested (opened GUI? screenshots? tried workflows?)
  • Commit history is consistent and clean, in line with the contribution guidelines.

Pre merge checklist

  • Added appropriate release note label
  • Commit history is consistent and clean, in line with the contribution
    guidelines
    .

@@ -50,7 +50,7 @@ def export_roff(

def import_roff(
filelike: Union[TextIO, BinaryIO, _PathLike], name: Optional[str] = None
) -> np.ma.MaskedArray[Any, np.dtype[np.double]]:
) -> np.ma.MaskedArray[Any, np.dtype[np.float32]]:
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@JHolba
Can I assume that the code that does the import does the right thing and loads 32bit floats as that is what is stored in .roff files?

Copy link
Contributor

@JHolba JHolba Sep 4, 2023

Choose a reason for hiding this comment

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

looks like that should be returning 32bit as long as the file is 32bit.
the typing is currently incorrect.
it will return a 64 bit array if the file is 64 bit though.
@eivindjahren

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've added an explicit conversion to 32bit in case it is 64bit as xtgeo can create 64bit .roff files.

@dafeda dafeda changed the title Commitin Save fields as 32 bit floats Sep 4, 2023
@dafeda dafeda marked this pull request as ready for review September 4, 2023 13:49
@dafeda dafeda self-assigned this Sep 4, 2023
@dafeda dafeda added the release-notes:bug-fix Automatically categorise as bug fix in release notes label Sep 4, 2023
@dafeda
Copy link
Contributor Author

dafeda commented Sep 4, 2023

Ran Drogon and seems to work.

storage:
3.4M Sep 4 20:49 aps_Therys_GRF1.nc

runpath:
3.4M Sep 4 20:27 aps_Therys_GRF1.roff

RMS and ECLIPSE use 32 bit floats
so there's no point in using 64 bits.
@codecov-commenter
Copy link

Codecov Report

Merging #6038 (3c931c9) into main (a46cb83) will increase coverage by 0.01%.
Report is 3 commits behind head on main.
The diff coverage is 85.71%.

@@            Coverage Diff             @@
##             main    #6038      +/-   ##
==========================================
+ Coverage   82.56%   82.58%   +0.01%     
==========================================
  Files         352      352              
  Lines       21897    21899       +2     
  Branches      826      826              
==========================================
+ Hits        18080    18085       +5     
+ Misses       3518     3516       -2     
+ Partials      299      298       -1     
Files Changed Coverage Δ
src/ert/config/field.py 97.45% <ø> (ø)
src/ert/field_utils/field_utils.py 85.86% <50.00%> (-1.09%) ⬇️
src/ert/field_utils/grdecl_io.py 92.22% <100.00%> (ø)
src/ert/field_utils/roff_io.py 98.30% <100.00%> (+0.05%) ⬆️

... and 2 files with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@JHolba
Copy link
Contributor

JHolba commented Sep 5, 2023

lgtm

@dafeda dafeda merged commit ea08d99 into equinor:main Sep 5, 2023
40 checks passed
@dafeda dafeda deleted the float32 branch September 5, 2023 12:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release-notes:bug-fix Automatically categorise as bug fix in release notes
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Change FIELDS to being stored with float32
3 participants