Skip to content

Add hourAngle function and wrapper function w/ equatorial coordinates #25

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

elon-code
Copy link

For telescopes and other things that rely on equatorial mounts, it is necessary to calculate hour angle in addition to declination. I added one new function and two wrapper functions that calculate equatorial coordinates and hour angle (one w/ unix time one with time a variables, like the existing equatorial coordinates function).

@jpb10
Copy link
Owner

jpb10 commented May 7, 2023

Hi, sorry for the delay. I will respond in a few days.

@jpb10
Copy link
Owner

jpb10 commented May 31, 2023

Since the hour angle (HA) can be determined from the Greenwich sidereal time (GMST), observer's longitude, and target's right ascension (RA), I suggest simply adding the two last lines to your code:

JulianDay jd(utc);

double ra, dec, r;
calcEquatorialCoordinates(jd, ra, dec, r);

double gmst = calcGrMeanSiderealTime(jd);
double sun_ha = gmst + obs_lon - ra;

The reason is: I'm already not a fan of the wrapper function scheme I am using. Although it reduces the final program size (in bytes), it is redundant. I'm hesitant to add any more before figuring out a better way.

I agree that in improved version of this library, HA/Dec coordinates should be available as an alternative to RA/Dec.

@elon-code
Copy link
Author

Thank you for your response. It may also be useful in some situations to have the coordinates in vector form as well (specifically useful for mirrors/heliostats), but of course it's not that hard to just add this in my code.

I do agree that using the wrapper functions causes some redundant calcs, but I'm not really an experienced enough programmer to come up with any ideas for an alternative.

Feel free to close pull request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants