question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Sun-Moon Ephemeris for Negative Years

See original GitHub issue

Hi,

I am trying to produce Sun-Moon Ephemeris for Lunar Crescent Visibility Records. My code able to calculate the ephemeris correctly for modern Lunar Crescent Visibility, however when calculating the Babylonian data, my ephemeris unable to produce a accurate result.

Here is my some of my code.

#Find Sunset

def sunset(x):

    location = Topos(latitude_degrees=x['Lat'], longitude_degrees=x['Long'])
    t0 = ts.utc(x['Year'], x['Month'], x['Day'])
    t1 = ts.utc(x['Year'], x['Month'], x['Day']+1)
    f = almanac.risings_and_settings(eph, eph['Sun'], location)
    t, y = almanac.find_discrete(t0, t1, f)
    
   # print(x['Day'], x['Month'] ,x['Year'],x['Lat'],x['Long'])


    for ti, yi in zip(t, y):
        if yi == False:
            hsunset = ti.utc.hour
            msunset = ti.utc.minute
            ssunset = ti.utc.second
            str_sunset = str(hsunset)+":"+str(msunset)
            jd_sunset = float(format(ti.tai))
            t = ts.tt_jd(float(jd_sunset))
            t = ts.tt_jd(float(jd_sunset))
            u=t.utc_iso()

            return str_sunset
        else:
            None
    print(t)

df['Sunset'] = df.apply(sunset, axis=1)

df

And here is my result Ephemeris, notice that the Data for Negative years is not accurate.



No     Day	Month	Year	Lat	Long	Ele	V	M	Sunset	Moonset	lagtime	Moonage	ArcV	DAZ	Width in Arc Second	ArcL
0	1	7	1973	-44.0	170.5	1189	V	B	5:8	5:58	50.0	17.49	6.28	6.35	7.285310	9.614935
1	29	1	1922	-33.9	18.5	30	I	I	17:52	18:32	40.0	42.08	7.34	17.13	9.821328	19.025304
2	28	2	1922	-33.9	18.5	30	V	N	17:23	18:11	48.0	46.60	9.06	18.07	12.930653	20.586570
3	29	3	1922	-33.9	18.5	30	I	I	16:44	17:19	35.0	27.70	6.10	10.01	5.599340	12.263027
4	10	7	-368	32.6	44.4	15	V	N	20:18	0:22	-677.0	158.98	44.20	212.45	161.990073	138.158263
5	19	7	-73	32.6	44.4	15	V	N	19:14	21:19	-847.0	100.91	24.90	185.97	2.697795	174.003688
6	20	7	-179	32.6	44.4	15	V	N	19:33	22:29	-876.0	116.53	35.19	179.64	18.775558	179.717161
7	23	7	-372	32.6	44.4	15	V	N	20:14	23:39	-764.0	150.94	35.24	197.62	29.737782	159.553862
8	23	7	-87	32.6	44.4	15	V	N	19:14	21:44	-870.0	83.59	29.75	180.57	1.432747	178.656614
9	29	7	-307	32.6	44.4	15	V	N	19:54	2:1	-468.0	240.22	30.09	255.21	444.171906	99.947300


I have check the Data with the literature. All of the Ephemeris for positive year is correct while ephemeris for negative year is incorrect. I am using de422.bsp for this calculation.

Greatly appreciate for help. Been stuck here for days. Thanks!

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
brandon-rhodescommented, Nov 24, 2020

Without any examples of the dates from the literature, I won’t be able to make specific comments, since I cannot see how big the differences are between the literature and your own data.

But — have you read the Skyfield documentation on dates? Your code makes no mention of the Julian calendar, and if the literature used that calendar instead of our modern one, the dates will not match:

https://rhodesmill.org/skyfield/time.html#ancient-and-modern-dates

0reactions
brandon-rhodescommented, Nov 25, 2020

I’m glad it’s working now!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Astrology Ephemeris Files for 9000 years - Astrodienst
This format allows to view and print ephemerides in excellent quality. Each ephemeris file covers one year and prints on six pages, with...
Read more >
Almagest Ephemeris Calculator - Departement Natuurkunde
This web page provides a set of JavaScript calendar and ephemeris modules for calculating geocentric luni-solar and planetary positions for an ...
Read more >
Accurate and fast Sun/Moon ephemerides suitable for Android ...
It can be used during several millenia, but note for negative years that year 500 B.C. is here year -499. /** * Computes...
Read more >
NOAA Improved Sunrise/Sunset Calculation
Negative in Eastern Hemisphere, Negative in Southern Hemisphere ... When entering a day or year, you will need to click the "Calculate Sunrise/Sunset" ......
Read more >
Sun, moon, and bright planet rise and set times - RSAA - ANU
Simple tool to find ephemerides for sun, moon and bright planets.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found