Output stream visitor bug fix #799
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR addresses a rounding issue that is only relevant to the CSV output stream & addresses an inline TODO item related to the csvouput stream visitor.
The Problem
While working on #795, I realized that there were some numerical differences between Hector results written out by the CSV output stream visitor vs. fetched via R.
When we compare the numerical results from hector output via R vs. csv outputter the overall summary table absolute error (this is across multiple scenarios & variables)
Of the 80 variables considered 57 of them had a MAE > 1E-6
Looking at the variable with the largest error, DO ocean C, while the relative MAE of 4.999791. A visual comparison of DO ocean C reveals a step like behavior in the csv result which seems odd and is most likely due to rounding.
Same data but different perspective.
the solution
It turns out the csvFile has a default precision level of 6 whereas typical C++ double precision is 16. Since R was pulling directly from the C++ precision level we needed to make sure that the csvFile was using the same precision level.
After changing the precision level of the csvFile the MAE between R and the csv output the MAE is now 1.035752e-13. Which is much better! And now no longer see the step behavior we were seeing before.