I did a similar one recently but have not been able to validate it's calculations against any other source. Thanks for posting the link to yours when I get time I'll compare and see if they match up. https://git.mikedilger.com/mikedilger/sunangle
The solution to bad relays is to just use different relays. Changing your relays is just a matter of publishing a new 10002 relay list, and optionally copying over your old notes (or reseeding them from local backups).