NavList:
A Community Devoted to the Preservation and Practice of Celestial Navigation and Other Methods of Traditional Wayfinding
From: Frank Reed
Date: 2020 Oct 3, 15:59 -0700
Jim, you wrote:
" I just bought a telescope with the idea of studying and photographing the moon. My house is surrounded by tall trees, and the only view that I have of the ecliptic is a 30-degree gap in the trees. Azimuth of about 150 degrees to 180 degrees. So, I wanted to develop a little program, either in excel or java or python to tell me the following: When is the moon in that gap between the hours of 1 hour past sunset to about 11:00pm?"
Aha! Your explanation helps tremendously. I expect most everyone else reading along, including me, had assumed you needed something on the order of minute of arc accuracy or even better. But for this application, you only need +/1°, and that's not difficult with relatively simple algorithms that would cover a couple of decades. We can easily get you equations for the ecliptic latitude, β, and longitude, λ, of the Moon at that level of accuracy, and then you can do standard coordinate transformations to get RA (equiv. to SHA), Dec, and then Altitude and Azimuth.
Could someone (not me, at least not today) dig that up? Simple code to calculate the Moon's ecliptic coordinates to the nearest degree? I can recommend this site by Paul Schlyter: https://stjarnhimlen.se/comp/ppcomp.html which is still more than you need, but not unreasonably so. It has good, short algorithms for most astronomical calculations with moderate accuracy, good enough for planning purposes.
You added:
"But the moon has been my biggest problem. Yesterday I did find a neat excel program from Navigation Spreadsheets that may solve my moon problem"
Yes, I was going to suggest that as an option for you. The developer is a NavList regular (Peter? You here?), and I'm sure he can help you with any questions you may have on those spreadsheets.
You continued:
"but I actually like the idea of trying a table lookup of the GHA moon then interpolating to get the accuracy. This is probably more info than you wanted, but you did ask. So, do you have any hints as to where I can download the moon table (could be in any format, excel, CSV, or any other)? "
I'll see if I can find that for you in a simple source. Since you're only looking for 1° accuracy or so, you could get a table with the Moon's position on a daily basis and interpolate linearly. That would work just fine. And yes, simple linear interpolation has the advantage of being relatively foolproof, but you still have to deal with little quirks. For example, the Moon's SHA at 0:00 UT on Oct 28, 2020 is 1° 58.0'. Twenty-fours later, it is 351° 06'. So what is the SHA at 12:00 UT? Obviously to get it right using linear interpolation, you have to treat the first SHA as 361° 58', and then the interpolation is easy. You get 356° 32'. That's only 2' from the truth. But notice the trick you have to include in your algorithm. You need to identify those cases where you have crossed the 360° line. It's not difficult --just something you have to work out.
You concluded:
"but I do wonder what your motivation is?"
Pure, raw cash, Jim. I make incredible sums of money as a consultant on calculations of the Moon's position like this. I'll send you my invoice. Ha ha. ;)
Frank Reed