sunmoonpos: import some of the SOFA C library #583
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.
for a better estimate of the sun and moon positions.
The original C code is add in lib/sofa/src/ and the bundle of functions used are added together in src/sofa.c
Noticed that the sun and moon position did not agree well with that from SOFA, and these are inputs into some of the tide displacement calculations and it can make a significant difference to the tide displacements.
This PR is a possible alternative using the SOFA C library. Just a few files from this library, bundled into a single file src/sofa.c to keep the build simple. Alternatively the SOFA library could be built and linked separately, but having tried both approaches it seems simpler to just bundle the few functions into a single file. The original code is placed in lib/sofa/src/ for reference.
Also noted that these return the ECI position and this still needs to be convert to ECEF using eci2ecef() and this also appears to be a little off, but the differences for eci2ecef() appear to have a negligible impact on the tide displacements.
Does anyone care enough about the sun and moon position to bother with this?
Is using SOFA a useful approach?
Any strong opinions on bundling the few functions into one file vs building a separate library?