Skip to main content

An not-so-accurate ephemeris for the Sun and the Moon using a sum of sines approximation

Project description

Fourier Ephemeris

An not-so-accurate ephemeris for the Sun and the Moon using a sum of sines approximation.

pip install fourier-ephem

Introduction

This recreational project presents a simple ephemeris developed by performing a Fourier transform on the Geocentric Solar Ecliptic (GSE) coordinates of the Moon and applying a least squares fit. The data used for this project is sourced from NASA's SSC Locator Form and spans from 1959 to 2040.

The motivation for creating this ephemeris was to show how one can predict the motion of the Sun and the Moon in a simple way without the need for the advanced methods used by modern ephemeris, with the original final goal of predicting solar eclipses. However, this project seeks to also support ephemerides for the planets and stars in the future.

The ephemeris contains 20, 8, and 9 terms for the longitude, latitude, and distance of the Moon, respectively. For the Sun, the distance is represented by a single sine wave, while its latitude and longitude are assumed to be 0.

Precision

The root-mean-square deviation of the Moon's latitude, longitude, and distance in the fitted period is 40", 51", and 165 km, respectively. While this error may be considered high by modern standards, it is sufficient for predicting eclipses, as demonstrated below with the total solar eclipse of August 2, 2027. Note that the ephemeris can predict eclipses even from the year 3000, rendering it accurate enough for many centuries.

anigif

Features

The ephemeris currently supports the following calculations:

  • Position of the Sun and the Moon in the GSE system
  • Altitude and azimuth of the Sun and the Moon for a given observer at specific latitude and longitude coordinates, with a simple atmospheric correction.
  • Angular distance and apparent intersection of the Sun and the Moon, particularly useful for eclipse calculations (Eclipse animations can be created using the eclipseAnimation.py file and eclipses within a time range can be found using the searchEclipses.py file)
  • Obliquity of the ecliptic, mean and true anomaly of the Earth

Example code

from fourier_ephem import *

lat, lon = -22.01134350210518, -47.89648023382425
date = get_date(2023,6,28,20,0,0)

observer, obs_rm = observer_position(date, lat, lon, return_rotation=True)
moon = moon_position(date)
sun = sun_position(date)

moon_az, moon_alt = az(observer, obs_rm, moon), alt(observer, moon)
sun_az, sun_alt = az(observer, obs_rm, sun), alt(observer, sun)

print(f"The Moon is at an altitude of {moon_alt:.2f}° and azimuth of {moon_az:.2f}°")
print(f"The Sun is at an altitude of {sun_alt:.2f}° and azimuth of {sun_az:.2f}°")

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

fourier_ephem-1.0.2.tar.gz (6.5 kB view details)

Uploaded Source

File details

Details for the file fourier_ephem-1.0.2.tar.gz.

File metadata

  • Download URL: fourier_ephem-1.0.2.tar.gz
  • Upload date:
  • Size: 6.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.1

File hashes

Hashes for fourier_ephem-1.0.2.tar.gz
Algorithm Hash digest
SHA256 1d33529777144af52768f63ddc8466fe0f691fc5ed2b15b9e70cd6f3a4c093dc
MD5 a6d1fcca5aa287e58868df7baccaed61
BLAKE2b-256 6093cf1a2add91652eb59f42053c3dbb79d3ffecf71bb95cf7f27bfc0e361514

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page