Skip to content
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

I couldn't find any method for LMT, LAT, Hour angle (Local (LHA), Greenwich (GHA)) and Equation of Time (EOT). #509

Closed
reza-ghazi opened this issue Dec 18, 2020 · 14 comments

Comments

@reza-ghazi
Copy link

reza-ghazi commented Dec 18, 2020

Hello Brandon,

Do we have any method for:

  1. Local Mean Time or Local Mean Solar Time (LMT),
  2. Local Apparent Solar Time (LAT),
  3. Greenwich Hour angle (GHA),
  4. Local Hour Angle (LHA or h)
  5. Equation of Time?

I couldn't find it in any libraries of the Skyfiled. Maybe I am wrong?

If not there? Are you planning to add them in the future?

Thank you,

@brandon-rhodes
Copy link
Member

No, I don't think any of those quantities are present? Skyfield’s users seem to primarily use it to plan observations using modern clock time, generating positions at a given UTC, or asking the UTC time of an event of interest — neither of which involves any of the old solar-time concepts. I do see that one Skyfield user has computed some of those values, like GHA, to produce an Almanac, though:

If you find their definitions, it should be straightforward to compute them from the values Skyfield provides. If we think they might be of interest to more users, maybe those formulae could then be added to either the Time object, the Topos object, or maybe instead as stand-alone functions in almanac.py, depending on which pattern seemed to fit?

@reza-ghazi
Copy link
Author

Hello Brandon.

Yes, you right; for current purposes, we usually do not need these items, but I need to compare results with some old fashion almanacs and historical events, so I need them.

On the other hand, these items are handy for Nautical almanacs, and there are still in use.

So, if you don't mind, adding these features would be very beneficial.

Thank you,

@reza-ghazi
Copy link
Author

Besides, please note the difference between accuracy in nautical almanacs and astronomical almanacs. If you want to add them, please use the definitions in the explanatory supplement.

In Nautical almanacs, they usually reduce the accuracy to minutes, and Skyfiled has excellent accuracy.

Best,

@brandon-rhodes
Copy link
Member

Yes, I agree that the Explanatory Supplement definitions are the ones that should govern in this case! Please feel free to try working out some sample code yourself for each quantity, if you are interested in turning the official definitions into Python code; if you pasted the results in here along with how they compare to test values, it would be easy enough then for me to incorporate them into Skyfield. But with my list of other projects at the moment, it’s not clear when I will have time to look these quantities up.

@mkbrewer
Copy link

Well, Skyfield does give you everything that you need to easily calculate these things. For GHA all you need is the apparent right ascension of the object and Greenwich Apparent Sidereal Time (GAST). LMT is just GMT (UTC) plus the observer's longitude. Likewise, LHA is just GHA plus the observer's longitude. The equation of time is just the difference between the GHA of the Sun and GMT plus 12 hours. This does bring up the issue of the ITRS hour angle though. I'll raise a separate issue for that.

@reza-ghazi
Copy link
Author

reza-ghazi commented Dec 20, 2020

Hello, mkbrewer

Thank you for participating.
Yes. Skyfield has everything that we need. But I meant to have these functions inside the library as a standard. Skyfield is worth it to be more complete.

Anyhow. I need to mention some important points in your suggestions, which makes the definitions more clear.

  • GMT = UT1 ≠ UTC (They have around ± 0.9 s difference)
  • LMT or Local Mean Solar Time = UT1 + East Longitude (or - West Longitude)

note that changing to hours and adjusting in the range 24 hours is necessary.

  • LAT or Local Apparent Solat Time = LST - α - 12.
  • LHA = LST - α
    • LST is Local Apparent Sidereal Time,
    • α is the apparent topocentric right ascension of the object
  • Equation of Time = Local Apparent Solar Time - Local Mean Solar Time = LAT - LMT

You can see the time section of the Explanatory Supplement to the AA for more info and exact definitions.

Thank you,

@mkbrewer
Copy link

While for most purposes GMT is synonymous with UTC, I do see that for navigational purposes it is, in fact, defined as UT1. Thank you for that correction.

However, I must disagree with the 12 hour offset of LHA. When a star transits the local meridian, the LHA must be zero. This occurs when its right ascension is equal to the local sidereal time.

@reza-ghazi
Copy link
Author

My bad! You are absolutely right. That was my mistake. The definition is for LAT, not LHA.

For the record, I updated the note too.

Thank you,

@reza-ghazi reza-ghazi changed the title I couldn't find any method for LMT, Hour angle (Local, Greenwich) and Equation of Time. I couldn't find any method for LMT, LAT, Hour angle (Local (LHA), Greenwich (GHA)) and Equation of Time (EOT). Dec 22, 2020
@brandon-rhodes
Copy link
Member

(So I can find each issue from the other: #510 is where Hour Angle discussion is taking place.)

@brandon-rhodes
Copy link
Member

A method hadec() has just been added to position objects! To try it out before the next Skyfield release:

pip install https://github.com/skyfielders/python-skyfield/archive/master.zip

Next I'll go see whether the other quantities you are interested in could easily live somewhere in the API.

@brandon-rhodes
Copy link
Member

@DataAdvisor — I suspect that my next tasks in Skyfield need to be focused on the documentation, as there are several outstanding issues about positions in particular that need attention. Given my other responsibilities, it may be a while before I can return to this issue. If you do happen to put together code that computes these quantities based on the above discussion, however, please feel free to drop the code in a comment here; having working code would make it easy to put these into the next release.

@reza-ghazi
Copy link
Author

Hello, Brandon

Thank you for the notice. I will check and inform you about the function.

Best,

@ziman
Copy link

ziman commented May 15, 2021

I compute GHA and declination by calculating the WGS84 latitude+longitude of the subpoint:

skyfield.api.wgs84.subpoint(
  earth.at(timescale.utc(y,m,d,h,m,s)).observe(celestial_body)
)

This seems to agree with the Nautical Almanac to 0.1' on the couple of examples I tried.

@brandon-rhodes
Copy link
Member

I am going to close this for now in the hopes that the issue has gone quiet because the new hadec() method indeed filled the most important gap that this issue identified — thanks again to @mkbrewer for suggesting the feature.

@ziman, thanks for the code snippet for GHA and declination!

Everyone should feel free to make further comments on this closed issue if you feel something has been left unresolved. Thanks!

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

No branches or pull requests

4 participants