-
Notifications
You must be signed in to change notification settings - Fork 42
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
Fix bug preventing raw scans without optional elements from being written #36
base: master
Are you sure you want to change the base?
Conversation
👍 |
@davidcaron Is there anything preventing you from merging this pull request? And if so, can I help? |
Hello this looks pretty easy to do - I should be able to merge it! Do you have a reference to those being optional fields? Adding a test using a very small e57 test file (e.g. heavily subsampled / cut down using cloud compare ?) would be awesome too if possible. |
To explain the checks and launch the tests
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ahh the tests fail - can you have a look at why @gredin ?
ahh got it - it looks like the required and optional fields are given in table 13 of this document https://cdn.standards.iteh.ai/samples/102656/ef2c1f2f33344506946c5ad65aad924f/ASTM-E2807-11-2019-.pdf |
I haven't had time to fully dig into the issue yet, but at a quick glance if looks like the test Additionally, the asset statements for |
Hah yes good spot with the header written tests! |
Just coming back to this - the test file does include temperature, relativeHumidity and atmospheric pressure so I'm not sure why the tests failed. |
As per the standards for e57 files, several child elements (listed below) are optional, but write_scan_raw fails if they aren't present in the data. The calls to getattr aren't returning the default values but instead are throwing exceptions. To fix this I've refactored these elements to be written out only if they're present in the source data, using the "if [] in data" that other optional elements use.
temperature
relativeHumidity
atmosphericPressure
acquisitionStart_dateTimeValue
acquisitionStart_isAtomicClockReferenced
acquisitionEnd_dateTimeValue
acquisitionEnd_isAtomicClockReferenced
Here's a code snippet that demonstrates the issue, using pump.e57 from the libe57 website: