-
Notifications
You must be signed in to change notification settings - Fork 4
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
Improve bc file formatting #308
Comments
Discussed the issue with @veenstrajelmer. The data blocks in the .bc file were not as bad as he remembered. We did discuss that we will do the following:
|
Initially, I had a working implementation by adding a new optional property (that defaults to none) to the In the
This correctly formats the datablocks in the .bc file and can be used as follows:
or by specifiying the However, after discussing it with Jelmer, we came to the conclusion that this is not very intuitive for the user. The user may think that the precision of the actual data (so the floats) are set, but that's not the case. We also came to the conclusion that it would be more intuitive to somehow add it to the save method. For example: |
So I discussed these requirements with Prisca and she thought it would be best to make something like a Also, after talking to Jelmer once more, he also mentioned that he would like to be able to specifiy the precision for, for example, the poly file. So the issue is in fact bigger than only the datablock in the .bc file and therefore requires a solution at a higher level. We should create a better design than the very limited option I initially wrote. |
(cherry picked from commit 2fe68d9)
PR #407 has been created to reduce the datablock spacing from 4 to 2. |
Just tested the performance with the code in #313. These are the results:
In the original issue, the performance of hydrolib and savetxt was equal in unformatted mode, while it is a factor 5 different now. The limited performance of hydrolib seems to mainly come from the formatting, the writing of the file seems quite fast. numpy.savetxt() seems to format per line instead of per item (if I interpret it correctly): https://github.com/numpy/numpy/blob/v1.23.0/numpy/lib/npyio.py#L1553 |
…matting #308: Improve file float formatting
… formatting when saving refs: #308
Is your feature request related to a problem? Please describe.
example code:
Results in this file:
Describe the solution you'd like
The time and data values are not neatly aligned. This can easily be solved. User provides a formatting string for time and data columns, or done semi-automatically. Some thinking is still required, since different data types require different precision.
Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered (if applicable).
Additional context
This is important with large t3D bc files, because of readability, but also disk space. The latter is significantly reduced when reducing precision and that is relevant since even then the bc files are >1GB. It could also be that formatting with limited significance improves writing speed.
The text was updated successfully, but these errors were encountered: